summaryrefslogtreecommitdiff
path: root/indra/llcommon/llfasttimer.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-11-16 10:56:05 -0500
committerNat Goodspeed <nat@lindenlab.com>2016-11-16 10:56:05 -0500
commit934b94e74a94f13521b67bdd016a5b591e16fe13 (patch)
treed181a0811e1f6773f0a4bd44c72dae48fae45a4e /indra/llcommon/llfasttimer.h
parentaf349febb3275bc1d75026f1f022595b50abda24 (diff)
parent0c8556921d05a356afd4014b966ee8c0e1002e36 (diff)
DRTVWR-418: pull in new viewer-release via viewer64
Diffstat (limited to 'indra/llcommon/llfasttimer.h')
-rw-r--r--indra/llcommon/llfasttimer.h38
1 files changed, 10 insertions, 28 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index f56e5596f5..2024d707da 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -90,33 +90,15 @@ public:
#if LL_FASTTIMER_USE_RDTSC
static U32 getCPUClockCount32()
{
- U32 ret_val;
- __asm
- {
- _emit 0x0f
- _emit 0x31
- shr eax,8
- shl edx,24
- or eax, edx
- mov dword ptr [ret_val], eax
- }
- return ret_val;
+ unsigned __int64 val = __rdtsc();
+ val = val >> 8;
+ return static_cast<U32>(val);
}
// return full timer value, *not* shifted by 8 bits
static U64 getCPUClockCount64()
{
- U64 ret_val;
- __asm
- {
- _emit 0x0f
- _emit 0x31
- mov eax,eax
- mov edx,edx
- mov dword ptr [ret_val+4], edx
- mov dword ptr [ret_val], eax
- }
- return ret_val;
+ return static_cast<U64>( __rdtsc() );
}
#else
@@ -173,16 +155,16 @@ public:
// Mac+Linux+Solaris FAST x86 implementation of CPU clock
static U32 getCPUClockCount32()
{
- U64 x;
- __asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
- return (U32)(x >> 8);
+ U32 low(0),high(0);
+ __asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
+ return (low>>8) | (high<<24);
}
static U64 getCPUClockCount64()
{
- U64 x;
- __asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
- return x;
+ U32 low(0),high(0);
+ __asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
+ return (U64)low | ( ((U64)high) << 32);
}
#endif