From d27833382868b76673f9dbe744c01d92704f21b0 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 13 Jan 2010 19:16:59 -0800 Subject: fix for mac fast timer resetting too often --- indra/llcommon/llfasttimer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 5058a2e772..85c78198dc 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -77,7 +77,7 @@ inline U32 get_cpu_clock_count_64() { U64 x; __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return x >> 8; + return x; } #endif -- cgit v1.2.3 From d87de15776d937aa2f2b9a5f4db88e16c9c09dbb Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 15 Jan 2010 18:45:18 -0800 Subject: fix for build error in xmmintrins.h --- indra/llcommon/llfasttimer.h | 95 ++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 39 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 85c78198dc..db80e9a624 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -39,45 +39,62 @@ #define TIME_FAST_TIMERS 0 #if LL_WINDOWS -// because MS has different signatures for these functions in winnt.h -// need to rename them to avoid conflicts -#define _interlockedbittestandset _renamed_interlockedbittestandset -#define _interlockedbittestandreset _renamed_interlockedbittestandreset -#include -#undef _interlockedbittestandset -#undef _interlockedbittestandreset - -#define LL_INLINE __forceinline -// 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() -{ - 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() -{ - return __rdtsc(); -} -#else -#define LL_INLINE -#endif // LL_WINDOWS - -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) -inline U32 get_cpu_clock_count_32() -{ - U64 x; - __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return (U32)x >> 8; -} - -inline U32 get_cpu_clock_count_64() -{ - U64 x; - __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return x; +#define LL_INLINE __forceinline + +// +// NOTE: put back in when we aren't using platform sdk anymore +// +// because MS has different signatures for these functions in winnt.h +// need to rename them to avoid conflicts +//#define _interlockedbittestandset _renamed_interlockedbittestandset +//#define _interlockedbittestandreset _renamed_interlockedbittestandreset +//#include +//#undef _interlockedbittestandset +//#undef _interlockedbittestandreset + +//inline U32 get_cpu_clock_count_32() +//{ +// 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() +//{ +// 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() +{ + 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; +} + +// return full timer value, *not* shifted by 8 bits +inline U64 get_cpu_clock_count_64() +{ + 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; } #endif -- cgit v1.2.3 From 9e506e499c5bb993e0e5e4980f999a5ef5132c1c Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 15 Jan 2010 18:50:27 -0800 Subject: wrong line endings --- indra/llcommon/llfasttimer.h | 112 +++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index db80e9a624..15787a7445 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -39,62 +39,62 @@ #define TIME_FAST_TIMERS 0 #if LL_WINDOWS -#define LL_INLINE __forceinline - -// -// NOTE: put back in when we aren't using platform sdk anymore -// -// because MS has different signatures for these functions in winnt.h -// need to rename them to avoid conflicts -//#define _interlockedbittestandset _renamed_interlockedbittestandset -//#define _interlockedbittestandreset _renamed_interlockedbittestandreset -//#include -//#undef _interlockedbittestandset -//#undef _interlockedbittestandreset - -//inline U32 get_cpu_clock_count_32() -//{ -// 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() -//{ -// 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() -{ - 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; -} - -// return full timer value, *not* shifted by 8 bits -inline U64 get_cpu_clock_count_64() -{ - 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; +#define LL_INLINE __forceinline + +// +// NOTE: put back in when we aren't using platform sdk anymore +// +// because MS has different signatures for these functions in winnt.h +// need to rename them to avoid conflicts +//#define _interlockedbittestandset _renamed_interlockedbittestandset +//#define _interlockedbittestandreset _renamed_interlockedbittestandreset +//#include +//#undef _interlockedbittestandset +//#undef _interlockedbittestandreset + +//inline U32 get_cpu_clock_count_32() +//{ +// 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() +//{ +// 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() +{ + 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; +} + +// return full timer value, *not* shifted by 8 bits +inline U64 get_cpu_clock_count_64() +{ + 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; } #endif -- cgit v1.2.3 From 798e33767f89bac520d6598259f003680d64d4da Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 15 Jan 2010 19:15:27 -0800 Subject: fix for gcc build --- indra/llcommon/llfasttimer.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 15787a7445..cd76bfe709 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -96,6 +96,24 @@ inline U64 get_cpu_clock_count_64() } return ret_val; } +#else +#define LL_INLINE +#endif + +#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +inline U32 get_cpu_clock_count_32() +{ + U64 x; + __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); + return (U32)x >> 8; +} + +inline U32 get_cpu_clock_count_64() +{ + U64 x; + __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); + return x >> 8; +} #endif #if ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__))) || (LL_SOLARIS && defined(__sparc__)) -- cgit v1.2.3 From 2d65e6295d5b05c510a87771b4db276028a66669 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 20 Jan 2010 10:35:22 -0800 Subject: Convert all C++ files to Unix line endings --- indra/llcommon/llfasttimer.h | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index cd76bfe709..8af79c90fd 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -1,11 +1,11 @@ -/** +/** * @file llfasttimer.h * @brief Declaration of a fast timer. * * $LicenseInfo:firstyear=2004&license=viewergpl$ - * + * * Copyright (c) 2004-2009, Linden Research, Inc. - * + * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 @@ -13,17 +13,17 @@ * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * + * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or * online at * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * + * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, * and agree to abide by those obligations. - * + * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * COMPLETENESS OR PERFORMANCE. @@ -69,7 +69,7 @@ inline U32 get_cpu_clock_count_32() { U32 ret_val; - __asm + __asm { _emit 0x0f _emit 0x31 @@ -85,7 +85,7 @@ inline U32 get_cpu_clock_count_32() inline U64 get_cpu_clock_count_64() { U64 ret_val; - __asm + __asm { _emit 0x0f _emit 0x31 @@ -99,21 +99,21 @@ inline U64 get_cpu_clock_count_64() #else #define LL_INLINE #endif - -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) -inline U32 get_cpu_clock_count_32() -{ - U64 x; - __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return (U32)x >> 8; -} - -inline U32 get_cpu_clock_count_64() -{ - U64 x; - __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return x >> 8; -} + +#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +inline U32 get_cpu_clock_count_32() +{ + U64 x; + __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); + return (U32)x >> 8; +} + +inline U32 get_cpu_clock_count_64() +{ + U64 x; + __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); + return x >> 8; +} #endif #if ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__))) || (LL_SOLARIS && defined(__sparc__)) @@ -128,7 +128,7 @@ inline U32 get_cpu_clock_count_32() } inline U32 get_cpu_clock_count_64() -{ +{ return get_clock_count(); } #endif @@ -158,7 +158,7 @@ public: }; // stores a "named" timer instance to be reused via multiple LLFastTimer stack instances - class LL_COMMON_API NamedTimer + class LL_COMMON_API NamedTimer : public LLInstanceTracker { friend class DeclareTimer; @@ -193,7 +193,7 @@ public: FrameState& getFrameState() const; - private: + private: friend class LLFastTimer; friend class NamedTimerFactory; @@ -204,14 +204,14 @@ public: // recursive call to gather total time from children static void accumulateTimings(); - // updates cumulative times and hierarchy, + // updates cumulative times and hierarchy, // can be called multiple times in a frame, at any point static void processTimes(); static void buildHierarchy(); static void resetFrame(); static void reset(); - + // // members // @@ -247,7 +247,7 @@ public: private: NamedTimer& mTimer; - FrameState* mFrameState; + FrameState* mFrameState; }; public: @@ -267,7 +267,7 @@ public: frame_state->mCalls++; // keep current parent as long as it is active when we are frame_state->mMoveUpTree |= (frame_state->mParent->mActiveCount == 0); - + LLFastTimer::CurTimerData* cur_timer_data = &LLFastTimer::sCurTimerData; mLastTimerData = *cur_timer_data; cur_timer_data->mCurTimer = this; @@ -305,7 +305,7 @@ public: U64 timer_end = get_cpu_clock_count_64(); sTimerCycles += timer_end - timer_start; sTimerCalls++; -#endif +#endif } public: @@ -321,13 +321,13 @@ public: typedef std::vector info_list_t; static info_list_t& getFrameStateList(); - + // call this once a frame to reset timers static void nextFrame(); // dumps current cumulative frame stats to log // call nextFrame() to reset timers - static void dumpCurTimes(); + static void dumpCurTimes(); // call this to reset timer hierarchy, averages, etc. static void reset(); -- cgit v1.2.3