Skip to content
Snippets Groups Projects
Commit 93a6ec30 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Use rdtsc intrinsic on macos and linux

parent e4110e65
No related branches found
No related tags found
No related merge requests found
......@@ -141,16 +141,13 @@ class BlockTimer
// Mac+Linux FAST x86 implementation of CPU clock
static U32 getCPUClockCount32()
{
U32 low(0),high(0);
__asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
return (low>>8) | (high<<24);
U64 time_stamp = __rdtsc() >> 8U;
return static_cast<U32>(time_stamp);
}
static U64 getCPUClockCount64()
{
U32 low(0),high(0);
__asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
return (U64)low | ( ((U64)high) << 32);
return static_cast<U64>(__rdtsc());
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment