Optimize system_time function
The uint128 code does not optimize as well as expected. Since this function can be called quite often, use a more optimal implementation (quite similar to what we had for x86_64 before refactoring). Unfortunately this is still not as good as the hand-optimized assembler previously used for 32bit x86, unless compiled with clang, where it gets pretty close.
This commit is contained in:
@@ -304,8 +304,10 @@ slower_sample:
|
|||||||
extern "C" bigtime_t
|
extern "C" bigtime_t
|
||||||
system_time()
|
system_time()
|
||||||
{
|
{
|
||||||
uint128 tsc(rdtsc());
|
uint64 tsc = rdtsc();
|
||||||
return uint64((tsc * gTimeConversionFactor) >> 32);
|
uint64 lo = (uint32)tsc;
|
||||||
|
uint64 hi = tsc >> 32;
|
||||||
|
return ((lo * gTimeConversionFactor) >> 32) + hi * gTimeConversionFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user