We use the same strategy for computing the system time as on x86 now.

The time base conversion factor is the 32 bit value
  2^32 * 1000000 / time base frequency,
so the system time can be computed by
  system time = time base * conversion factor / 2^32.
The expression in system_time() looks more complicated now, but is
actually much faster (factor 2.5 on my Mac mini). I'm positively
surprised, how good the assembly looks, that GCC 4 generates. There's
not that much potential for optimization by hand-coding the function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15863 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2006-01-07 23:05:56 +00:00
parent 8baf8813c0
commit 262e0a636b
4 changed files with 12 additions and 14 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ extern void reset_dbats(void);
//extern void setl2cr(unsigned int val);
extern long long get_time_base(void);
void __ppc_setup_system_time(vint64 *cvFactor);
void __ppc_setup_system_time(vint32 *cvFactor);
// defined in libroot: os/arch/system_time.c
int64 __ppc_get_time_base(void);
// defined in libroot: os/arch/system_time_asm.S
@@ -15,7 +15,7 @@ struct ppc_real_time_data {
struct arch_real_time_data {
struct ppc_real_time_data data[2];
vint64 system_time_conversion_factor;
vint32 system_time_conversion_factor;
vint32 version;
// Since there're no cheap atomic_{set,get,add}64() on PPC 32 (i.e. one
// that doesn't involve a syscall), we can't have just a single