diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-25 13:24:45 -0800 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-25 13:24:45 -0800 |
commit | 3d0ff2585eb32c67d503452ce9f8d2198be823c8 (patch) | |
tree | cf2260ea7eae77e40af73cb4f6c18711e9e9cfbe /indra | |
parent | ec7b204ed657f7c1becac3b410ae0bc94c03aa75 (diff) |
Final fix for fast timer reshuffle.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llfasttimer.h | 25 | ||||
-rw-r--r-- | indra/llcommon/llfasttimer_class.cpp | 10 |
2 files changed, 16 insertions, 19 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 0f3280023c..9f9e2ea945 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -37,7 +37,6 @@ #include "llfasttimer_class.h" #if LL_WINDOWS -#define LL_INLINE __forceinline // // Windows implementation of CPU clock // @@ -53,21 +52,21 @@ //#undef _interlockedbittestandset //#undef _interlockedbittestandreset -//inline U32 get_cpu_clock_count_32() +//inline U32 LLFastTimer::getCPUClockCount32() //{ // U64 time_stamp = __rdtsc(); // return (U32)(time_stamp >> 8); //} // //// return full timer value, *not* shifted by 8 bits -//inline U64 get_cpu_clock_count_64() +//inline U64 LLFastTimer::getCPUClockCount64() //{ // return __rdtsc(); //} // shift off lower 8 bits for lower resolution but longer term timing // on 1Ghz machine, a 32-bit word will hold ~1000 seconds of timing -inline U32 get_cpu_clock_count_32() +inline U32 LLFastTimer::getCPUClockCount32() { U32 ret_val; __asm @@ -83,7 +82,7 @@ inline U32 get_cpu_clock_count_32() } // return full timer value, *not* shifted by 8 bits -inline U64 get_cpu_clock_count_64() +inline U64 LLFastTimer::getCPUClockCount64() { U64 ret_val; __asm @@ -97,8 +96,6 @@ inline U64 get_cpu_clock_count_64() } return ret_val; } -#else -#define LL_INLINE #endif @@ -111,7 +108,7 @@ inline U64 get_cpu_clock_count_64() // to synchronize this value between cores at kernel start. It should not be affected // by CPU frequency. If not available use the REALTIME clock, but this may be affected by // NTP adjustments or other user activity affecting the system time. -inline U64 get_cpu_clock_count_64() +inline U64 LLFastTimer::getCPUClockCount64() { struct timespec tp; @@ -123,9 +120,9 @@ inline U64 get_cpu_clock_count_64() return (tp.tv_sec*LLFastTimer::sClockResolution)+tp.tv_nsec; } -inline U32 get_cpu_clock_count_32() +inline U32 LLFastTimer::getCPUClockCount32() { - return (U32)get_cpu_clock_count_64(); + return (U32)LLFastTimer::getCPUClockCount64(); } #endif // (LL_LINUX || LL_SOLARIS)) @@ -133,14 +130,14 @@ inline U32 get_cpu_clock_count_32() #if (LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) // // Mac x86 implementation of CPU clock -inline U32 get_cpu_clock_count_32() +inline U32 LLFastTimer::getCPUClockCount32() { U64 x; __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); return (U32)x >> 8; } -inline U32 get_cpu_clock_count_64() +inline U32 LLFastTimer::getCPUClockCount64() { U64 x; __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); @@ -155,12 +152,12 @@ inline U32 get_cpu_clock_count_64() // // Just use gettimeofday implementation for now -inline U32 get_cpu_clock_count_32() +inline U32 LLFastTimer::getCPUClockCount32() { return (U32)get_clock_count(); } -inline U32 get_cpu_clock_count_64() +inline U32 LLFastTimer::getCPUClockCount64() { return get_clock_count(); } diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index 6dbd90f9fa..abcaee673e 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -56,7 +56,7 @@ S32 LLFastTimer::sCurFrameIndex = -1; S32 LLFastTimer::sLastFrameIndex = -1; -U64 LLFastTimer::sLastFrameTime = get_cpu_clock_count_64(); +U64 LLFastTimer::sLastFrameTime = LLFastTimer::getCPUClockCount64(); bool LLFastTimer::sPauseHistory = 0; bool LLFastTimer::sResetHistory = 0; LLFastTimer::CurTimerData LLFastTimer::sCurTimerData; @@ -426,7 +426,7 @@ void LLFastTimer::NamedTimer::buildHierarchy() //static void LLFastTimer::NamedTimer::accumulateTimings() { - U32 cur_time = get_cpu_clock_count_32(); + U32 cur_time = getCPUClockCount32(); // walk up stack of active timers and accumulate current time while leaving timing structures active LLFastTimer* cur_timer = sCurTimerData.mCurTimer; @@ -556,7 +556,7 @@ void LLFastTimer::NamedTimer::reset() // walk up stack of active timers and reset start times to current time // effectively zeroing out any accumulated time - U32 cur_time = get_cpu_clock_count_32(); + U32 cur_time = getCPUClockCount32(); // root defined by parent pointing to self CurTimerData* cur_data = &sCurTimerData; @@ -649,7 +649,7 @@ std::vector<LLFastTimer::NamedTimer*>& LLFastTimer::NamedTimer::getChildren() void LLFastTimer::nextFrame() { countsPerSecond(); // good place to calculate clock frequency - U64 frame_time = get_cpu_clock_count_64(); + U64 frame_time = getCPUClockCount64(); if ((frame_time - sLastFrameTime) >> 8 > 0xffffffff) { llinfos << "Slow frame, fast timers inaccurate" << llendl; @@ -738,7 +738,7 @@ const LLFastTimer::NamedTimer* LLFastTimer::getTimerByName(const std::string& na LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state) : mFrameState(state) { - U32 start_time = get_cpu_clock_count_32(); + U32 start_time = getCPUClockCount32(); mStartTime = start_time; mFrameState->mActiveCount++; LLFastTimer::sCurTimerData.mCurTimer = this; |