diff options
Diffstat (limited to 'indra/llcommon/llfasttimer.h')
| -rw-r--r-- | indra/llcommon/llfasttimer.h | 28 | 
1 files changed, 26 insertions, 2 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 271dade097..fde168b022 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -79,7 +79,11 @@ public:      // on 1Ghz machine, a 32-bit word will hold ~1000 seconds of timing      static U32 getCPUClockCount32()      { +#if _M_ARM64 +        unsigned __int64 val = _ReadStatusReg(ARM64_PMCCNTR_EL0); +#else          unsigned __int64 val = __rdtsc(); +#endif          val = val >> 8;          return static_cast<U32>(val);      } @@ -87,7 +91,11 @@ public:      // return full timer value, *not* shifted by 8 bits      static U64 getCPUClockCount64()      { +#if _M_ARM64 +        return static_cast<U64>( _ReadStatusReg(ARM64_PMCCNTR_EL0) ); +#else          return static_cast<U64>( __rdtsc() ); +#endif      }  #else @@ -107,8 +115,22 @@ public:  #endif +#if (LL_DARWIN && defined(__arm64__)) + +    static U32 getCPUClockCount64() +    { +        U64 t = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); +        return t/1000; +    } + +    static U64 getCPUClockCount32() +    { +        return (U32) (getCPUClockCount64() >> 8); +    } + +#endif -#if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX && !(defined(__i386__) || defined(__amd64__)))      //      // Linux implementation of CPU clock - non-x86.      // This is accurate but SLOW!  Only use out of desperation. @@ -139,6 +161,7 @@ public:  #endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) +/*  #if LL_DARWIN && LL_ARM64      //      // Mac implementation of CPU clock - non-x86. @@ -153,8 +176,9 @@ public:          return (U32)(getCPUClockCount64() >> 8);      }  #endif // LL_DARWIN && LL_ARM64 +*/ -#if (LL_LINUX || LL_DARWIN) && (LL_X86 || LL_X86_64) +#if (LL_LINUX || LL_DARWIN || __FreeBSD__) && (defined(__i386__) || defined(__amd64__))      //      // Mac+Linux FAST x86 implementation of CPU clock      //  | 
