diff options
Diffstat (limited to 'indra')
67 files changed, 389 insertions, 318 deletions
| diff --git a/indra/llaudio/llstreamingaudio_fmod.h b/indra/llaudio/llstreamingaudio_fmod.h index 9970f0d03b..a189b548dd 100644 --- a/indra/llaudio/llstreamingaudio_fmod.h +++ b/indra/llaudio/llstreamingaudio_fmod.h @@ -30,6 +30,8 @@  #include "stdtypes.h" // from llcommon +#include <list> +  #include "llstreamingaudio.h"  class LLAudioStreamManagerFMOD; diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 0a6a8f9fa6..5138be0711 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -32,6 +32,7 @@  #include "llcharacter.h"  #include "llstring.h" +#include "llfasttimer.h"  #define SKEL_HEADER "Linden Skeleton 1.0" diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index dc3c58cf64..a9cde545f2 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -31,6 +31,7 @@  // Header Files  //-----------------------------------------------------------------------------  #include <string> +#include <list>  #include "linked_lists.h"  #include "v3math.h" diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 829dda9993..5524bba296 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -28,8 +28,9 @@  // Header Files  //-----------------------------------------------------------------------------  #include "linden_common.h" -  #include "llmotioncontroller.h" + +#include "llfasttimer.h"  #include "llkeyframemotion.h"  #include "llmath.h"  #include "lltimer.h" diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 510725ffc6..c77d96c1c9 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -32,16 +32,6 @@  #if LL_LINUX || LL_SOLARIS  #include <sys/param.h>  // Need PATH_MAX in APR headers...  #endif -#if LL_WINDOWS -	// Limit Windows API to small and manageable set. -	// If you get undefined symbols, find the appropriate -	// Windows header file and include that in your .cpp file. -	#define WIN32_LEAN_AND_MEAN -	#include <winsock2.h> -	#include <windows.h> -	#undef min -	#undef max -#endif  #include <boost/noncopyable.hpp> @@ -340,7 +330,7 @@ public:  	LLThreadLocalPointer(const LLThreadLocalPointer<T>& other) -	:	LLThreadLocalPointerBase(other) +		:	LLThreadLocalPointerBase(other)  	{  		set(other.get());		  	} diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 5569b4102d..2efe39e158 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -39,6 +39,7 @@  #include "lltimer.h"  #include "llstring.h" +#include "llfasttimer.h"  static const F64 DATE_EPOCH = 0.0; diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index cced0bdfa9..d007f76e5f 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -58,22 +58,22 @@ namespace LLTrace  //////////////////////////////////////////////////////////////////////////////  // statics -S32 Time::sCurFrameIndex = -1; -S32 Time::sLastFrameIndex = -1; -U64 Time::sLastFrameTime = Time::getCPUClockCount64(); -bool Time::sPauseHistory = 0; -bool Time::sResetHistory = 0; -LLThreadLocalPointer<Time::CurTimerData> Time::sCurTimerData; -bool Time::sLog = FALSE; -std::string Time::sLogName = ""; -bool Time::sMetricLog = FALSE; +S32 BlockTimer::sCurFrameIndex = -1; +S32 BlockTimer::sLastFrameIndex = -1; +U64 BlockTimer::sLastFrameTime = BlockTimer::getCPUClockCount64(); +bool BlockTimer::sPauseHistory = 0; +bool BlockTimer::sResetHistory = 0; +LLThreadLocalPointer<CurTimerData> BlockTimer::sCurTimerData; +bool BlockTimer::sLog = false; +std::string BlockTimer::sLogName = ""; +bool BlockTimer::sMetricLog = false;  static LLMutex*			sLogLock = NULL;  static std::queue<LLSD> sLogQueue;  #if LL_LINUX || LL_SOLARIS -U64 Time::sClockResolution = 1000000000; // Nanosecond resolution +U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution  #else -U64 Time::sClockResolution = 1000000; // Microsecond resolution +U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution  #endif  // FIXME: move these declarations to the relevant modules @@ -114,15 +114,22 @@ BlockTimer& BlockTimer::getRootTimer()  	return root_timer;  } +void BlockTimer::pushLog(LLSD log) +{ +	LLMutexLock lock(sLogLock); + +	sLogQueue.push(log); +} +  //static  #if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) -U64 Time::countsPerSecond() // counts per second for the *32-bit* timer +U64 BlockTimer::countsPerSecond() // counts per second for the *32-bit* timer  {  	return sClockResolution >> 8;  }  #else // windows or x86-mac or x86-linux or x86-solaris -U64 Time::countsPerSecond() // counts per second for the *32-bit* timer +U64 BlockTimer::countsPerSecond() // counts per second for the *32-bit* timer  {  #if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS  	//getCPUFrequency returns MHz and sCPUClockFrequency wants to be in Hz @@ -225,7 +232,7 @@ S32 BlockTimer::getDepth()  // static  void BlockTimer::processTimes()  { -	if (Time::getCurFrameIndex() < 0) return; +	if (getCurFrameIndex() < 0) return;  	buildHierarchy();  	accumulateTimings(); @@ -243,7 +250,7 @@ struct SortTimerByName  //static  void BlockTimer::buildHierarchy()  { -	if (Time::getCurFrameIndex() < 0 ) return; +	if (getCurFrameIndex() < 0 ) return;  	// set up initial tree  	{ @@ -254,11 +261,11 @@ void BlockTimer::buildHierarchy()  			// bootstrap tree construction by attaching to last timer to be on stack  			// when this timer was called -			if (timer.mLastCaller && timer.mParent == &BlockTimer::getRootTimer()) +			if (timer.getPrimaryAccumulator().mLastCaller && timer.mParent == &BlockTimer::getRootTimer())  			{ -				timer.setParent(timer.mLastCaller); +				timer.setParent(timer.getPrimaryAccumulator().mLastCaller);  				// no need to push up tree on first use, flag can be set spuriously -				timer.mMoveUpTree = false; +				timer.getPrimaryAccumulator().mMoveUpTree = false;  			}  		}  	} @@ -274,14 +281,14 @@ void BlockTimer::buildHierarchy()  		// skip root timer  		if (timerp == &BlockTimer::getRootTimer()) continue; -		if (timerp->mMoveUpTree) +		if (timerp->getPrimaryAccumulator().mMoveUpTree)  		{ -			// since ancestors have already been visited, reparenting won't affect tree traversal +			// since ancestors have already been visited, re-parenting won't affect tree traversal  			//step up tree, bringing our descendants with us  			LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() <<  				" to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL;  			timerp->setParent(timerp->getParent()->getParent()); -			timerp->mMoveUpTree = false; +			timerp->getPrimaryAccumulator().mMoveUpTree = false;  			// don't bubble up any ancestors until descendants are done bubbling up  			it.skipAncestors(); @@ -308,21 +315,23 @@ void BlockTimer::accumulateTimings()  	U32 cur_time = getCPUClockCount32();  	// walk up stack of active timers and accumulate current time while leaving timing structures active -	Time* cur_timer = sCurTimerData.mCurTimer; +	Time* cur_timer = sCurTimerData->mCurTimer;  	// root defined by parent pointing to self -	CurTimerData* cur_data = &sCurTimerData; +	CurTimerData* cur_data = sCurTimerData.get(); +	TimerAccumulator& accumulator = sCurTimerData->mTimerData->getPrimaryAccumulator();  	while(cur_timer && cur_timer->mLastTimerData.mCurTimer != cur_timer)  	{  		U32 cumulative_time_delta = cur_time - cur_timer->mStartTime;  		U32 self_time_delta = cumulative_time_delta - cur_data->mChildTime;  		cur_data->mChildTime = 0; -		cur_data->mTimerData->mSelfTimeCounter += self_time_delta; -		cur_data->mTimerData->mTotalTimeCounter += cumulative_time_delta; +		accumulator.mSelfTimeCounter += self_time_delta; +		accumulator.mTotalTimeCounter += cumulative_time_delta;  		cur_timer->mStartTime = cur_time;  		cur_data = &cur_timer->mLastTimerData;  		cur_data->mChildTime += cumulative_time_delta; +		accumulator = cur_data->mTimerData->getPrimaryAccumulator();  		cur_timer = cur_timer->mLastTimerData.mCurTimer;  	} @@ -333,13 +342,14 @@ void BlockTimer::accumulateTimings()  		++it)  	{  		BlockTimer* timerp = (*it); -		timerp->mTreeTimeCounter = timerp->mSelfTimeCounter; +		TimerAccumulator& accumulator = timerp->getPrimaryAccumulator(); +		timerp->mTreeTimeCounter = accumulator.mSelfTimeCounter;  		for (child_const_iter child_it = timerp->beginChildren(); child_it != timerp->endChildren(); ++child_it)  		{  			timerp->mTreeTimeCounter += (*child_it)->mTreeTimeCounter;  		} -		S32 cur_frame = sCurFrameIndex; +		S32 cur_frame = getCurFrameIndex();  		if (cur_frame >= 0)  		{  			// update timer history @@ -347,8 +357,8 @@ void BlockTimer::accumulateTimings()  			timerp->mCountHistory[hidx] = timerp->mTreeTimeCounter;  			timerp->mCountAverage       = ((U64)timerp->mCountAverage * cur_frame + timerp->mTreeTimeCounter) / (cur_frame+1); -			timerp->mCallHistory[hidx]  = timerp->mCalls; -			timerp->mCallAverage        = ((U64)timerp->mCallAverage * cur_frame + timerp->mCalls) / (cur_frame+1); +			timerp->mCallHistory[hidx]  = accumulator.mCalls; +			timerp->mCallAverage        = ((U64)timerp->mCallAverage * cur_frame + accumulator.mCalls) / (cur_frame+1);  		}  	}  } @@ -377,15 +387,19 @@ void BlockTimer::resetFrame()  		LLSD sd;  		{ -			for (instance_iter it = beginInstances(), end_it = endInstances(); it != end_it; ++it) +			for (LLInstanceTracker<BlockTimer>::instance_iter it = LLInstanceTracker<BlockTimer>::beginInstances(),  +					end_it = LLInstanceTracker<BlockTimer>::endInstances();  +				it != end_it;  +				++it)  			{  				BlockTimer& timer = *it; -				sd[timer.getName()]["Time"] = (LLSD::Real) (timer.mSelfTimeCounter*iclock_freq);	 -				sd[timer.getName()]["Calls"] = (LLSD::Integer) timer.mCalls; +				TimerAccumulator& accumulator = timer.getPrimaryAccumulator(); +				sd[timer.getName()]["Time"] = (LLSD::Real) (accumulator.mSelfTimeCounter*iclock_freq);	 +				sd[timer.getName()]["Calls"] = (LLSD::Integer) accumulator.mCalls;  				// computing total time here because getting the root timer's getCountHistory  				// doesn't work correctly on the first frame -				total_time = total_time + timer.mSelfTimeCounter * iclock_freq; +				total_time = total_time + accumulator.mSelfTimeCounter * iclock_freq;  			}  		} @@ -399,13 +413,17 @@ void BlockTimer::resetFrame()  	}  	// reset for next frame -	for (instance_iter it = beginInstances(), end_it = endInstances(); it != end_it; ++it) +	for (LLInstanceTracker<BlockTimer>::instance_iter it = LLInstanceTracker<BlockTimer>::beginInstances(), +			end_it = LLInstanceTracker<BlockTimer>::endInstances(); +		it != end_it; +		++it)  	{  		BlockTimer& timer = *it; -		timer.mSelfTimeCounter = 0; -		timer.mCalls = 0; -		timer.mLastCaller = NULL; -		timer.mMoveUpTree = false; +		TimerAccumulator& accumulator = timer.getPrimaryAccumulator(); +		accumulator.mSelfTimeCounter = 0; +		accumulator.mCalls = 0; +		accumulator.mLastCaller = NULL; +		accumulator.mMoveUpTree = false;  	}  } @@ -419,7 +437,7 @@ void BlockTimer::reset()  	U32 cur_time = getCPUClockCount32();  	// root defined by parent pointing to self -	CurTimerData* cur_data = &sCurTimerData; +	CurTimerData* cur_data = sCurTimerData.get();  	Time* cur_timer = cur_data->mCurTimer;  	while(cur_timer && cur_timer->mLastTimerData.mCurTimer != cur_timer)  	{ @@ -432,7 +450,10 @@ void BlockTimer::reset()  	// reset all history  	{ -		for (instance_iter it = beginInstances(), end_it = endInstances(); it != end_it; ++it) +		for (LLInstanceTracker<BlockTimer>::instance_iter it = LLInstanceTracker<BlockTimer>::beginInstances(),  +				end_it = LLInstanceTracker<BlockTimer>::endInstances();  +			it != end_it;  +			++it)  		{  			BlockTimer& timer = *it;  			if (&timer != &BlockTimer::getRootTimer())  @@ -453,13 +474,13 @@ void BlockTimer::reset()  U32 BlockTimer::getHistoricalCount(S32 history_index) const  { -	S32 history_idx = (getLastFrameIndex() + history_index) % BlockTimer::HISTORY_NUM; +	S32 history_idx = (getLastFrameIndex() + history_index) % HISTORY_NUM;  	return mCountHistory[history_idx];  }  U32 BlockTimer::getHistoricalCalls(S32 history_index ) const  { -	S32 history_idx = (getLastFrameIndex() + history_index) % BlockTimer::HISTORY_NUM; +	S32 history_idx = (getLastFrameIndex() + history_index) % HISTORY_NUM;  	return mCallHistory[history_idx];  } @@ -479,10 +500,10 @@ std::vector<BlockTimer*>& BlockTimer::getChildren()  }  //static -void Time::nextFrame() +void BlockTimer::nextFrame()  { -	countsPerSecond(); // good place to calculate clock frequency -	U64 frame_time = getCPUClockCount64(); +	BlockTimer::countsPerSecond(); // good place to calculate clock frequency +	U64 frame_time = BlockTimer::getCPUClockCount64();  	if ((frame_time - sLastFrameTime) >> 8 > 0xffffffff)  	{  		llinfos << "Slow frame, fast timers inaccurate" << llendl; @@ -505,7 +526,7 @@ void Time::dumpCurTimes()  	// accumulate timings, etc.  	BlockTimer::processTimes(); -	F64 clock_freq = (F64)countsPerSecond(); +	F64 clock_freq = (F64)BlockTimer::countsPerSecond();  	F64 iclock_freq = 1000.0 / clock_freq; // clock_ticks -> milliseconds  	// walk over timers in depth order and output timings @@ -533,13 +554,6 @@ void Time::dumpCurTimes()  	}  } -//static  -void Time::reset() -{ -	BlockTimer::reset(); -} - -  //static  void Time::writeLog(std::ostream& os)  { diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index f5e6d874a2..69a6773b12 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -28,60 +28,77 @@  #define LL_FASTTIMER_H  #include "llinstancetracker.h" +#include "lltrace.h"  #define FAST_TIMER_ON 1 +#define LL_FASTTIMER_USE_RDTSC 1  class LLMutex; -#include "lltrace.h" - -#define LL_FASTTIMER_USE_RDTSC 1 -  namespace LLTrace  { +struct CurTimerData +{ +	class Time*			mCurTimer; +	class BlockTimer*	mTimerData; +	U64					mChildTime; +};  class Time  {  public: +	friend class BlockTimer;  	typedef Time self_t;  	typedef class BlockTimer DeclareTimer; -public:  	Time(BlockTimer& timer);  	~Time();  public: -	static bool				sLog; -	static bool				sMetricLog; -	static std::string		sLogName; -	static bool 			sPauseHistory; -	static bool 			sResetHistory; - -	// 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(); -	// call this to reset timer hierarchy, averages, etc. -	static void reset(); +	static void writeLog(std::ostream& os); -	static U64 countsPerSecond(); -	static S32 getLastFrameIndex() { return sLastFrameIndex; } -	static S32 getCurFrameIndex() { return sCurFrameIndex; } +private: -	static void writeLog(std::ostream& os); +	U64				mStartTime; +	CurTimerData	mLastTimerData; +}; -	struct CurTimerData -	{ -		Time*				mCurTimer; -		BlockTimer*			mTimerData; -		U64					mChildTime; -	}; -	static LLThreadLocalPointer<CurTimerData>	sCurTimerData; +// stores a "named" timer instance to be reused via multiple Time stack instances +class BlockTimer  +:	public TraceType<TimerAccumulator>, +	public LLInstanceTracker<BlockTimer> +{ +public: +	BlockTimer(const char* name, bool open = false, BlockTimer* parent = &getRootTimer()); +	~BlockTimer(); -private: +	enum { HISTORY_NUM = 300 }; + +	BlockTimer* getParent() const { return mParent; } +	void setParent(BlockTimer* parent); +	S32 getDepth(); + +	typedef std::vector<BlockTimer*>::const_iterator child_const_iter; +	child_const_iter beginChildren(); +	child_const_iter endChildren(); +	std::vector<BlockTimer*>& getChildren(); + +	void setCollapsed(bool collapsed)	{ mCollapsed = collapsed; } +	bool getCollapsed() const			{ return mCollapsed; } + +	U32 getCountAverage() const { return mCountAverage; } +	U32 getCallAverage() const	{ return mCallAverage; } + +	U32 getHistoricalCount(S32 history_index = 0) const; +	U32 getHistoricalCalls(S32 history_index = 0) const; + +	static BlockTimer& getRootTimer(); +	static void pushLog(LLSD sd); +	friend class Time;  	////////////////////////////////////////////////////////////////////////////// @@ -106,14 +123,14 @@ private:  	//#undef _interlockedbittestandset  	//#undef _interlockedbittestandreset -	//inline U32 Time::getCPUClockCount32() +	//inline U32 BlockTimer::getCPUClockCount32()  	//{  	//	U64 time_stamp = __rdtsc();  	//	return (U32)(time_stamp >> 8);  	//}  	//  	//// return full timer value, *not* shifted by 8 bits -	//inline U64 Time::getCPUClockCount64() +	//inline U64 BlockTimer::getCPUClockCount64()  	//{  	//	return __rdtsc();  	//} @@ -220,64 +237,7 @@ private:  #endif -	static U64	sClockResolution; -	static S32	sCurFrameIndex; -	static S32	sLastFrameIndex; -	static U64	sLastFrameTime; - -	U64							mStartTime; -	Time::CurTimerData	mLastTimerData; -}; - -struct TimerAccumulator -{ -	void addSamples(const TimerAccumulator& other); -	void reset(const TimerAccumulator* other); - -	// -	// members -	// -	U64 						mSelfTimeCounter, -								mTotalTimeCounter; -	U32 						mCalls; -	BlockTimer*					mLastCaller;	// used to bootstrap tree construction -	U16							mActiveCount;	// number of timers with this ID active on stack -	bool						mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame -}; - -// stores a "named" timer instance to be reused via multiple Time stack instances -class BlockTimer  -:	public TraceType<TimerAccumulator>, -	public LLInstanceTracker<BlockTimer> -{ -public: -	BlockTimer(const char* name, bool open = false, BlockTimer* parent = &getRootTimer()); -	~BlockTimer(); - -	enum { HISTORY_NUM = 300 }; - -	BlockTimer* getParent() const { return mParent; } -	void setParent(BlockTimer* parent); -	S32 getDepth(); - -	typedef std::vector<BlockTimer*>::const_iterator child_const_iter; -	child_const_iter beginChildren(); -	child_const_iter endChildren(); -	std::vector<BlockTimer*>& getChildren(); - -	void setCollapsed(bool collapsed)	{ mCollapsed = collapsed; } -	bool getCollapsed() const			{ return mCollapsed; } - -	U32 getCountAverage() const { return mCountAverage; } -	U32 getCallAverage() const	{ return mCallAverage; } - -	U32 getHistoricalCount(S32 history_index = 0) const; -	U32 getHistoricalCalls(S32 history_index = 0) const; - -	static BlockTimer& getRootTimer(); - -private: -	friend class Time; +	static U64 countsPerSecond();  	// recursive call to gather total time from children  	static void accumulateTimings(); @@ -289,6 +249,12 @@ private:  	static void buildHierarchy();  	static void resetFrame();  	static void reset(); +	// call this once a frame to reset timers +	static void nextFrame(); +	static S32 getLastFrameIndex() { return sLastFrameIndex; } +	static S32 getCurFrameIndex() { return sCurFrameIndex; } + +  	// sum of recorded self time and tree time of all children timers (might not match actual recorded time of children if topology is incomplete  	U32 						mTreeTimeCounter;  @@ -304,12 +270,25 @@ private:  	std::vector<BlockTimer*>	mChildren;  	bool						mCollapsed;				// don't show children  	bool						mNeedsSorting;			// sort children whenever child added + +	// statics +	static std::string							sLogName; +	static bool									sMetricLog; +	static bool									sLog;	 +	static LLThreadLocalPointer<CurTimerData>	sCurTimerData; +	static U64									sClockResolution; +	static S32									sCurFrameIndex; +	static S32									sLastFrameIndex; +	static U64									sLastFrameTime; +	static bool 								sPauseHistory; +	static bool 								sResetHistory; +  };  LL_FORCE_INLINE Time::Time(BlockTimer& timer)  {  #if FAST_TIMER_ON -	mStartTime = getCPUClockCount64(); +	mStartTime = BlockTimer::getCPUClockCount64();  	TimerAccumulator& accumulator = timer.getPrimaryAccumulator();  	accumulator.mActiveCount++; @@ -317,7 +296,7 @@ LL_FORCE_INLINE Time::Time(BlockTimer& timer)  	// keep current parent as long as it is active when we are  	accumulator.mMoveUpTree |= (timer.mParent->getPrimaryAccumulator().mActiveCount == 0); -	CurTimerData* cur_timer_data = Time::sCurTimerData.get(); +	CurTimerData* cur_timer_data = BlockTimer::sCurTimerData.get();  	// store top of stack  	mLastTimerData = *cur_timer_data;  	// push new information @@ -330,8 +309,8 @@ LL_FORCE_INLINE Time::Time(BlockTimer& timer)  LL_FORCE_INLINE Time::~Time()  {  #if FAST_TIMER_ON -	U64 total_time = getCPUClockCount64() - mStartTime; -	CurTimerData* cur_timer_data = Time::sCurTimerData.get(); +	U64 total_time = BlockTimer::getCPUClockCount64() - mStartTime; +	CurTimerData* cur_timer_data = BlockTimer::sCurTimerData.get();  	TimerAccumulator& accumulator = cur_timer_data->mTimerData->getPrimaryAccumulator();  	accumulator.mSelfTimeCounter += total_time - cur_timer_data->mChildTime;  	accumulator.mTotalTimeCounter += total_time; @@ -344,7 +323,7 @@ LL_FORCE_INLINE Time::~Time()  	// we are only tracking self time, so subtract our total time delta from parents  	mLastTimerData.mChildTime += total_time; -	*sCurTimerData = mLastTimerData; +	*BlockTimer::sCurTimerData = mLastTimerData;  #endif  } diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index c51d042a3d..5917d7a420 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -28,7 +28,7 @@   */  #if LL_WINDOWS -#include <windows.h> +#include "llwin32headerslean.h"  #include <stdlib.h>                 // Windows errno  #else  #include <errno.h> diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index cd7c0c7c09..f019bd0c64 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -33,7 +33,7 @@  #include <ctype.h>  #ifdef WIN32 -#include <windows.h> +#include "llwin32headers.h"  #include <winnt.h>  #endif diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 32d4eec607..d72e10d2fa 100644 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -28,6 +28,7 @@  #include "linden_common.h"  #include "llinitparam.h" +#include "llformat.h"  namespace LLInitParam diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 3d4e4331c0..502f93cbb8 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -29,6 +29,7 @@  #define LL_LLPARAM_H  #include <vector> +#include <list>  #include <boost/function.hpp>  #include <boost/type_traits/is_convertible.hpp>  #include <boost/unordered_map.hpp> diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index afaf366668..7c4ab6cf98 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -32,7 +32,6 @@  //#endif  #if defined(LL_WINDOWS) -//# include <windows.h>  # include <psapi.h>  #elif defined(LL_DARWIN)  # include <sys/types.h> diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index a1b0a684c5..43d98be47b 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -31,6 +31,7 @@  #include "llsdserialize.h"  #include "lltreeiterators.h"  #include "llmetricperformancetester.h" +#include "llfasttimer.h"  //----------------------------------------------------------------------------------------------  // LLMetricPerformanceTesterBasic : static methods and testers management @@ -90,7 +91,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s  // Return TRUE if this metric is requested or if the general default "catch all" metric is requested  BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name)  { -	return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME))); +	return (LLTrace::BlockTimer::sMetricLog && ((LLTrace::BlockTimer::sLogName == name) || (LLTrace::BlockTimer::sLogName == DEFAULT_METRIC_NAME)));  }  /*static*/  @@ -193,8 +194,7 @@ void LLMetricPerformanceTesterBasic::preOutputTestResults(LLSD* sd)  void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd)  { -	LLMutexLock lock(LLFastTimer::sLogLock); -	LLFastTimer::sLogQueue.push((*sd)); +	LLTrace::BlockTimer::pushLog(*sd);  }  void LLMetricPerformanceTesterBasic::outputTestResults()  diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h index 319955ef93..9517e2db5e 100644 --- a/indra/llcommon/llmortician.h +++ b/indra/llcommon/llmortician.h @@ -28,6 +28,7 @@  #define LLMORTICIAN_H  #include "stdtypes.h" +#include <list>  class LL_COMMON_API LLMortician   { diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index d711ce2f74..2fe084afcd 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -38,8 +38,7 @@  #include <stdexcept>  #if LL_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include <windows.h>                // HANDLE (eye roll) +#include "llwin32headerslean.h"	// for HANDLE  #elif LL_LINUX  #if defined(Status)  #undef Status diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 87a5930c14..6fe53396ca 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -32,9 +32,7 @@  //#include <memory>  #if LL_WINDOWS -#	define WIN32_LEAN_AND_MEAN -#	include <winsock2.h> -#	include <windows.h> +#	include "llwin32headerslean.h"  #	define _interlockedbittestandset _renamed_interlockedbittestandset  #	define _interlockedbittestandreset _renamed_interlockedbittestandreset  #	include <intrin.h> diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 1181c2d433..7cfc265c62 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -30,6 +30,7 @@  #include "llinitparam.h"  #include "boost/function.hpp" +#include "llfasttimer.h"  struct LL_COMMON_API LLParamSDParserUtilities  { diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index ccd7ef91c2..e0e9056380 100644 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -32,7 +32,7 @@  #include <iostream>  #include <sstream> -#include "windows.h" +#include "llwin32headerslean.h"  #include "Dbghelp.h"  typedef USHORT NTAPI RtlCaptureStackBackTrace_Function( diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index fa0eb9f72c..9600928ad5 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -28,11 +28,10 @@  #include "llstring.h"  #include "llerror.h" +#include "llfasttimer.h"  #if LL_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headerslean.h"  #include <winnls.h> // for WideCharToMultiByte  #endif diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 119efc7957..9d81ac25dd 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -31,8 +31,9 @@  #include <cstdio>  #include <locale>  #include <iomanip> +#include <algorithm>  #include "llsd.h" -#include "llfasttimer.h" +#include "llformat.h"  #if LL_LINUX || LL_SOLARIS  #include <wctype.h> diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 6073bcd0a6..00b72ce1d8 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -42,6 +42,7 @@  #include "llprocessor.h"  #include "llerrorcontrol.h"  #include "llevents.h" +#include "llformat.h"  #include "lltimer.h"  #include "llsdserialize.h"  #include "llsdutil.h" @@ -58,9 +59,7 @@  using namespace llsd;  #if LL_WINDOWS -#	define WIN32_LEAN_AND_MEAN -#	include <winsock2.h> -#	include <windows.h> +#	include "llwin32headerslean.h"  #   include <psapi.h>               // GetPerformanceInfo() et al.  #elif LL_DARWIN  #	include <errno.h> diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 23cebf4336..26063beff0 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -31,11 +31,9 @@  #include "u64.h"  #if LL_WINDOWS -#	define WIN32_LEAN_AND_MEAN -#	include <winsock2.h> -#	include <windows.h> +#	include "llwin32headerslean.h"  #elif LL_LINUX || LL_SOLARIS || LL_DARWIN -#       include <errno.h> +#   include <errno.h>  #	include <sys/time.h>  #else   #	error "architecture not supported" diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index afb175c398..9346aa7a45 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -38,15 +38,15 @@ static MasterThreadRecorder* gMasterThreadRecorder = NULL;  void init()  {  	gMasterThreadRecorder = new MasterThreadRecorder(); -	Time::sCurTimerData = new Time::CurTimerData(); +	BlockTimer::sCurTimerData = new CurTimerData();  }  void cleanup()  {  	delete gMasterThreadRecorder;  	gMasterThreadRecorder = NULL; -	delete Time::sCurTimerData.get(); -	Time::sCurTimerData = NULL; +	delete BlockTimer::sCurTimerData.get(); +	BlockTimer::sCurTimerData = NULL;  }  MasterThreadRecorder& getMasterThreadRecorder() diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index fb9dca5e84..61fed6e7b8 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -235,8 +235,8 @@ namespace LLTrace  		MeasurementAccumulator()  		:	mSum(0), -			mMin(std::numeric_limits<T>::max()), -			mMax(std::numeric_limits<T>::min()), +			mMin((std::numeric_limits<T>::max)()), +			mMax((std::numeric_limits<T>::min)()),  			mMean(0),  			mVarianceSum(0),  			mNumSamples(0), @@ -380,6 +380,24 @@ namespace LLTrace  		U32	mNumSamples;  	}; +	class TimerAccumulator +	{ +	public: +		void addSamples(const TimerAccumulator& other); +		void reset(const TimerAccumulator* other); + +		// +		// members +		// +		U64 						mSelfTimeCounter, +									mTotalTimeCounter; +		U32 						mCalls; +		class BlockTimer*			mLastCaller;	// used to bootstrap tree construction +		U16							mActiveCount;	// number of timers with this ID active on stack +		bool						mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame +	}; + +  	template <typename T = F64>  	class Measurement  	:	public TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> > diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4dcadfdf29..efc54d240f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -273,7 +273,7 @@ namespace LLTrace  		template <typename T>  		typename T getPeriodMin(const TraceType<CountAccumulator<T> >& stat) const  		{ -			T min_val = std::numeric_limits<T>::max(); +			T min_val = (std::numeric_limits<T>::max)();  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); @@ -284,7 +284,7 @@ namespace LLTrace  		template <typename T>  		F64 getPeriodMinPerSec(const TraceType<CountAccumulator<T> >& stat) const  		{ -			F64 min_val = std::numeric_limits<F64>::max(); +			F64 min_val = (std::numeric_limits<F64>::max)();  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); @@ -295,7 +295,7 @@ namespace LLTrace  		template <typename T>  		T getPeriodMax(const TraceType<CountAccumulator<T> >& stat) const  		{ -			T max_val = std::numeric_limits<T>::min(); +			T max_val = (std::numeric_limits<T>::min)();  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); @@ -306,7 +306,7 @@ namespace LLTrace  		template <typename T>  		F64 getPeriodMaxPerSec(const TraceType<CountAccumulator<T> >& stat) const  		{ -			F64 max_val = std::numeric_limits<F64>::min(); +			F64 max_val = (std::numeric_limits<F64>::min)();  			for (S32 i = 0; i < mNumPeriods; i++)  			{  				max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 5a6ff14f97..0f111aab59 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -26,6 +26,7 @@  #include "linden_common.h"  #include "lltracethreadrecorder.h" +#include "llfasttimer.h"  namespace LLTrace  { diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 4ac2197c11..1fe492fdce 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -33,18 +33,12 @@  namespace LLUnits  { -template<typename T, typename IS_UNIT = void> +template<typename T>  struct HighestPrecisionType  {  	typedef T type_t;  }; -template<typename T> -struct HighestPrecisionType<T, typename T::is_unit_tag_t> -{ -	typedef typename HighestPrecisionType<typename T::storage_t>::type_t type_t; -}; -  template<> struct HighestPrecisionType<F32> { typedef F64 type_t; };  template<> struct HighestPrecisionType<S32> { typedef S64 type_t; };  template<> struct HighestPrecisionType<U32> { typedef S64 type_t; }; @@ -78,7 +72,6 @@ struct LLUnit  {  	typedef LLUnit<UNIT_TYPE, STORAGE_TYPE> self_t;  	typedef typename STORAGE_TYPE storage_t; -	typedef void is_unit_tag_t;  	LLUnit(storage_t value = storage_t())  	:	mValue(value) diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index db8c9c85ab..83ed987d30 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -27,9 +27,7 @@  // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.  #if LL_WINDOWS -#undef WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headers.h"  // ugh, this is ugly.  We need to straighten out our linking for this library  #pragma comment(lib, "IPHLPAPI.lib")  #include <iphlpapi.h> diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h new file mode 100644 index 0000000000..80fd2e1768 --- /dev/null +++ b/indra/llcommon/llwin32headers.h @@ -0,0 +1,38 @@ +/**  + * @file llwindows.h + * @brief sanitized include of windows header files + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWINDOWS_H +#define LL_LLWINDOWS_H + +#ifdef LL_WINDOWS +#define NOMINMAX +#undef WIN32_LEAN_AND_MEAN +#include <winsock2.h> +#include <windows.h> +#undef NOMINMAX +#endif + +#endif diff --git a/indra/llcommon/llwin32headerslean.h b/indra/llcommon/llwin32headerslean.h new file mode 100644 index 0000000000..ab6e9c09e2 --- /dev/null +++ b/indra/llcommon/llwin32headerslean.h @@ -0,0 +1,37 @@ +/**  + * @file llwindows.h + * @brief sanitized include of windows header files + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWINDOWS_H +#define LL_LLWINDOWS_H + +#ifdef LL_WINDOWS +#define NOMINMAX +#define WIN32_LEAN_AND_MEAN +#include <winsock2.h> +#include <windows.h> +#endif + +#endif diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h index eb2ecf71ba..47fcf688a2 100644 --- a/indra/llinventory/lleconomy.h +++ b/indra/llinventory/lleconomy.h @@ -27,6 +27,7 @@  #define LL_LLECONOMY_H  #include "llsingleton.h" +#include <list>  class LLMessageSystem;  class LLVector3; diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index fbf23bc3f0..43aa2ab799 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -28,6 +28,7 @@  #include "llinventory.h"  #include "lldbstrings.h" +#include "llfasttimer.h"  #include "llinventorydefines.h"  #include "llxorcipher.h"  #include "llsd.h" diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index e0ca056a5f..dbb8c4e28d 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -80,6 +80,7 @@  #include "llbuffer.h"  #include "llbufferstream.h" +#include "llfasttimer.h"  #include "llmemorystream.h"  #include "llsd.h"  #include "llsdserialize.h" diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 1236fc8b71..f9d37b2e39 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -33,6 +33,7 @@  #include "llapr.h"  #include "llbuffer.h"  #include "llbufferstream.h" +#include "llfasttimer.h"  #include "llhttpnode.h"  #include "lliopipe.h"  #include "lliosocket.h" diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index 0287026659..1383d37f41 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -32,6 +32,7 @@  #include "llapr.h"  #include "llbuffer.h" +#include "llfasttimer.h"  #include "llhost.h"  #include "llpumpio.h" diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index be0f7dfcc6..4e07963af8 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -39,6 +39,7 @@  #include "lliopipe.h"  #include "apr_pools.h" +#include "llwin32headerslean.h"  #include "apr_network_io.h"  #include "llchainio.h" diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index 8c50fd5069..9fd49d23d4 100644 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -28,6 +28,7 @@  #include "linden_common.h"  #include "llioutil.h" +#include "llfasttimer.h"  /**   * LLIOFlush diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 08b31e9c7a..dc27f2ca4a 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -29,12 +29,7 @@  #include "llmail.h"  // APR on Windows needs full windows headers -#ifdef LL_WINDOWS -#	undef WIN32_LEAN_AND_MEAN -#	include <winsock2.h> -#	include <windows.h> -#endif - +#include "llwin32headers.h"  #include <string>  #include <sstream> diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index 0623e99f0a..e3f09f34ee 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -34,6 +34,7 @@  #include "apr_poll.h"  #include "llapr.h" +#include "llfasttimer.h"  #include "llstl.h"  // These should not be enabled in production, but they can be diff --git a/indra/llmessage/llsdrpcclient.cpp b/indra/llmessage/llsdrpcclient.cpp index fcda0e81a3..05b27f582c 100644 --- a/indra/llmessage/llsdrpcclient.cpp +++ b/indra/llmessage/llsdrpcclient.cpp @@ -30,6 +30,7 @@  #include "llsdrpcclient.h"  #include "llbufferstream.h" +#include "llfasttimer.h"  #include "llfiltersd2xmlrpc.h"  #include "llpumpio.h"  #include "llsd.h" diff --git a/indra/llmessage/llsdrpcserver.cpp b/indra/llmessage/llsdrpcserver.cpp index f26ee52f71..2c233c1c0d 100644 --- a/indra/llmessage/llsdrpcserver.cpp +++ b/indra/llmessage/llsdrpcserver.cpp @@ -31,6 +31,7 @@  #include "llbuffer.h"  #include "llbufferstream.h" +#include "llfasttimer.h"  #include "llpumpio.h"  #include "llsdserialize.h"  #include "llstl.h" diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 5831c3c1c1..982f4804f0 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -33,6 +33,7 @@  #include <openssl/x509_vfy.h>  #include <openssl/ssl.h>  #include "llcurl.h" +#include "llfasttimer.h"  #include "llioutil.h"  #include "llproxy.h"  #include "llpumpio.h" diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 85aef5da00..6f8508ee8c 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -32,9 +32,7 @@  #include <stdexcept>  #if LL_WINDOWS -	#define WIN32_LEAN_AND_MEAN -	#include <winsock2.h> -	#include <windows.h> +#include "llwin32headerslean.h"  #else  	#include <sys/types.h>  	#include <sys/socket.h> diff --git a/indra/llplugin/llpluginprocesschild.h b/indra/llplugin/llpluginprocesschild.h index a9d6794e40..531422e792 100644 --- a/indra/llplugin/llpluginprocesschild.h +++ b/indra/llplugin/llpluginprocesschild.h @@ -29,6 +29,7 @@  #ifndef LL_LLPLUGINPROCESSCHILD_H  #define LL_LLPLUGINPROCESSCHILD_H +#include <queue>  #include "llpluginmessage.h"  #include "llpluginmessagepipe.h"  #include "llplugininstance.h" diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 990fc5cbae..24be7eb148 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -29,6 +29,8 @@  #ifndef LL_LLPLUGINPROCESSPARENT_H  #define LL_LLPLUGINPROCESSPARENT_H +#include <queue> +  #include "llapr.h"  #include "llprocess.h"  #include "llpluginmessage.h" diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp index aefa1ca144..c2cb236cba 100644 --- a/indra/llplugin/tests/llplugincookiestore_test.cpp +++ b/indra/llplugin/tests/llplugincookiestore_test.cpp @@ -27,6 +27,7 @@   */  #include "linden_common.h" +#include <list>  #include "../test/lltut.h"  #include "../llplugincookiestore.h" diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 4dc2fcd714..d2d929fbf9 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -29,6 +29,7 @@  #include "llfontgl.h"  // Linden library includes +#include "llfasttimer.h"  #include "llfontfreetype.h"  #include "llfontbitmapcache.h"  #include "llfontregistry.h" diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 605b424b35..c9ce0d5588 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -540,11 +540,7 @@ extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange;  // LL_WINDOWS  // windows gl headers depend on things like APIENTRY, so include windows. -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> -#undef min -#undef max +#include "llwin32headerslean.h"  //----------------------------------------------------------------------------  #include <GL/gl.h> diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5361d8e7be..751309af20 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -32,6 +32,7 @@  #include "llimagegl.h"  #include "llerror.h" +#include "llfasttimer.h"  #include "llimage.h"  #include "llmath.h" diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 11b2681e52..45baf641fb 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -26,7 +26,7 @@  #include "linden_common.h" -#include <boost/static_assert.hpp> +#include "llfasttimer.h"  #include "llsys.h"  #include "llvertexbuffer.h"  // #include "llrender.h" diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index a1e1f8a988..e3b17dcb4f 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -30,6 +30,7 @@  #include "llrect.h"  #include "llsd.h" +#include <list>  #include <boost/function.hpp>  //******************************************************* diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 17c9c09cb2..c366fd65db 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -100,10 +100,10 @@ private:  	BOOL mDisplayHistory;  	BOOL mDisplayMean;			// If true, display mean, if false, display current value -	LLTrace::TraceType<CountAccumulator<F64> >* mCountFloatp; -	LLTrace::TraceType<CountAccumulator<S64> >* mCountIntp; -	LLTrace::TraceType<MeasurementAccumulator<F64> >* mMeasurementFloatp; -	LLTrace::TraceType<MeasurementAccumulator<S64> >* mMeasurementIntp; +	LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp; +	LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp; +	LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* mMeasurementFloatp; +	LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* mMeasurementIntp;  	LLFrameTimer mUpdateTimer;  	LLUIString mLabel; diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 09b34c2358..57856ff6f2 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -57,10 +57,10 @@ public:  	struct StatParams : public LLInitParam::ChoiceBlock<StatParams>  	{ -		Alternative<LLTrace::TraceType<CountAccumulator<F64> >* >		count_stat_float; -		Alternative<LLTrace::TraceType<CountAccumulator<S64> >* >		count_stat_int; -		Alternative<LLTrace::TraceType<MeasurementAccumulator<F64> >* >	measurement_stat_float; -		Alternative<LLTrace::TraceType<MeasurementAccumulator<S64> >* >	measurement_stat_int; +		Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* >		count_stat_float; +		Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* >		count_stat_int; +		Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* >	measurement_stat_float; +		Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* >	measurement_stat_int;  	};  	struct Params : public LLInitParam::Block<Params, LLView::Params> @@ -105,8 +105,8 @@ public:  	/*virtual*/ void setValue(const LLSD& value);  private: -	LLTrace::count_common_float_t*	mNewStatFloatp; -	LLTrace::count_common_int_t*	mNewStatIntp; +	LLTrace::TraceType<LLTrace::CountAccumulator<F64> >*	mNewStatFloatp; +	LLTrace::TraceType<LLTrace::CountAccumulator<S64> >*	mNewStatIntp;  	BOOL mPerSec; diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index c4e073ccdb..23fc53ea88 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -26,6 +26,8 @@  #include "linden_common.h"  #include "lluistring.h" + +#include "llfasttimer.h"  #include "llsd.h"  #include "lltrans.h" diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 0c91390bc1..903f10ce10 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -29,7 +29,7 @@  #include "llxuiparser.h"  #include "llxmlnode.h" - +#include "llfasttimer.h"  #ifdef LL_STANDALONE  #include <expat.h>  #else diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp index 0424f2379e..3b83d1b9e3 100644 --- a/indra/llvfs/llpidlock.cpp +++ b/indra/llvfs/llpidlock.cpp @@ -36,7 +36,7 @@  #if LL_WINDOWS   //For windows platform. -#include <windows.h> +#include "llwin32headerslean.h"  namespace {  	inline DWORD getpid() { diff --git a/indra/llvfs/llvfile.cpp b/indra/llvfs/llvfile.cpp index 7f631ef0bb..d3f5673485 100644 --- a/indra/llvfs/llvfile.cpp +++ b/indra/llvfs/llvfile.cpp @@ -32,6 +32,7 @@  #include "llthread.h"  #include "llvfs.h"  #include "lltimer.h" +#include "llfasttimer.h"  const S32 LLVFile::READ			= 0x00000001;  const S32 LLVFile::WRITE		= 0x00000002; diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index c155c1b362..276074d4ca 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -28,6 +28,7 @@  #define LL_LLKEYBOARD_H  #include <map> +#include <boost/function.hpp>  #include "string_table.h"  #include "lltimer.h" diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index be3fe5deb0..b76d526c5a 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -28,10 +28,7 @@  #include "linden_common.h" -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> - +#include "llwin32headerslean.h"  #include "llkeyboardwin32.h"  #include "llwindowcallbacks.h" diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 4da87f4e06..f378203a88 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -31,6 +31,7 @@  #include "llcoord.h"  #include "llstring.h"  #include "llcursortypes.h" +#include "llinstancetracker.h"  #include "llsd.h"  class LLSplashScreen; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 43c0090993..6d887926fa 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -38,6 +38,7 @@  // Linden library includes  #include "llerror.h" +#include "llfasttimer.h"  #include "llgl.h"  #include "llstring.h"  #include "lldir.h" diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 54c9ac4d4d..169d264808 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -28,9 +28,7 @@  #define LL_LLWINDOWWIN32_H  // Limit Windows API to small and manageable set. -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headerslean.h"  #include "llwindow.h"  #include "llwindowcallbacks.h" diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ac659c409b..c6ed8d5071 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -679,7 +679,7 @@ bool LLAppViewer::init()  	// into the log files during normal startup until AFTER  	// we run the "program crashed last time" error handler below.  	// -	LLFastTimer::reset(); +	LLTrace::BlockTimer::reset();  	// initialize SSE options  	LLVector4a::initClass(); @@ -1222,7 +1222,7 @@ bool LLAppViewer::mainLoop()  	while (!LLApp::isExiting())  	{  		LLFastTimer _(FTM_FRAME); -		LLFastTimer::nextFrame();  +		LLTrace::BlockTimer::nextFrame();   		LLTrace::getMasterThreadRecorder().pullFromSlaveThreads();  		//clear call stack records @@ -1552,9 +1552,9 @@ bool LLAppViewer::cleanup()  	if (LLFastTimerView::sAnalyzePerformance)  	{  		llinfos << "Analyzing performance" << llendl; -		std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; -		std::string current_name  = LLFastTimer::sLogName + ".slp";  -		std::string report_name   = LLFastTimer::sLogName + "_report.csv"; +		std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; +		std::string current_name  = LLTrace::BlockTimer::sLogName + ".slp";  +		std::string report_name   = LLTrace::BlockTimer::sLogName + "_report.csv";  		LLFastTimerView::doAnalysis(  			gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), @@ -1900,9 +1900,9 @@ bool LLAppViewer::cleanup()  	{  		llinfos << "Analyzing performance" << llendl; -		std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; -		std::string current_name  = LLFastTimer::sLogName + ".slp";  -		std::string report_name   = LLFastTimer::sLogName + "_report.csv"; +		std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; +		std::string current_name  = LLTrace::BlockTimer::sLogName + ".slp";  +		std::string report_name   = LLTrace::BlockTimer::sLogName + "_report.csv";  		LLFastTimerView::doAnalysis(  			gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), @@ -2031,10 +2031,10 @@ bool LLAppViewer::initThreads()  													enable_threads && true,  													app_metrics_qa_mode);	 -	if (LLFastTimer::sLog || LLFastTimer::sMetricLog) +	if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog)  	{ -		LLFastTimer::sLogLock = new LLMutex(NULL); -		mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName); +		LLTrace::BlockTimer::sLogLock = new LLMutex(NULL); +		mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName);  		mFastTimerLogThread->start();  	} @@ -2445,13 +2445,13 @@ bool LLAppViewer::initConfiguration()  	if (clp.hasOption("logperformance"))  	{ -		LLFastTimer::sLog = TRUE; -		LLFastTimer::sLogName = std::string("performance");		 +		LLTrace::BlockTimer::sLog = true; +		LLTrace::BlockTimer::sLogName = std::string("performance");		  	}  	if (clp.hasOption("logmetrics"))   	{ - 		LLFastTimer::sMetricLog = TRUE ; + 		LLTrace::BlockTimer::sMetricLog = true ;  		// '--logmetrics' can be specified with a named test metric argument so the data gathering is done only on that test  		// In the absence of argument, every metric is gathered (makes for a rather slow run and hard to decipher report...)  		std::string test_name = clp.getOption("logmetrics")[0]; @@ -2459,11 +2459,11 @@ bool LLAppViewer::initConfiguration()  		if (test_name == "")  		{  			llwarns << "No '--logmetrics' argument given, will output all metrics to " << DEFAULT_METRIC_NAME << llendl; -			LLFastTimer::sLogName = DEFAULT_METRIC_NAME; +			LLTrace::BlockTimer::sLogName = DEFAULT_METRIC_NAME;  		}  		else  		{ -			LLFastTimer::sLogName = test_name; +			LLTrace::BlockTimer::sLogName = test_name;  		}   	} diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 0934028a8c..d0bb75225c 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -61,17 +61,17 @@ static const S32 LINE_GRAPH_HEIGHT = 240;  static S32 FTV_NUM_TIMERS;  const S32 FTV_MAX_DEPTH = 8; -std::vector<LLFastTimer::DeclareTimer*> ft_display_idx; // line of table entry for display purposes (for collapse) +std::vector<LLTrace::BlockTimer*> ft_display_idx; // line of table entry for display purposes (for collapse) -typedef LLTreeDFSIter<LLFastTimer::DeclareTimer, LLFastTimer::DeclareTimer::child_const_iter> timer_tree_iterator_t; +typedef LLTreeDFSIter<LLTrace::BlockTimer, LLTrace::BlockTimer::child_const_iter> timer_tree_iterator_t;  BOOL LLFastTimerView::sAnalyzePerformance = FALSE; -static timer_tree_iterator_t begin_timer_tree(LLFastTimer::DeclareTimer& id)  +static timer_tree_iterator_t begin_timer_tree(LLTrace::BlockTimer& id)   {   	return timer_tree_iterator_t(&id,  -							boost::bind(boost::mem_fn(&LLFastTimer::DeclareTimer::beginChildren), _1),  -							boost::bind(boost::mem_fn(&LLFastTimer::DeclareTimer::endChildren), _1)); +							boost::bind(boost::mem_fn(&LLTrace::BlockTimer::beginChildren), _1),  +							boost::bind(boost::mem_fn(&LLTrace::BlockTimer::endChildren), _1));  }  static timer_tree_iterator_t end_timer_tree()  @@ -92,18 +92,18 @@ LLFastTimerView::LLFastTimerView(const LLSD& key)  	mScrollIndex = 0;  	mHoverID = NULL;  	mHoverBarIndex = -1; -	FTV_NUM_TIMERS = LLFastTimer::DeclareTimer::instanceCount(); +	FTV_NUM_TIMERS = LLTrace::BlockTimer::instanceCount();  	mPrintStats = -1;	  }  void LLFastTimerView::onPause()  { -	LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; +	LLTrace::BlockTimer::sPauseHistory = !LLTrace::BlockTimer::sPauseHistory;  	// reset scroll to bottom when unpausing -	if (!LLFastTimer::sPauseHistory) +	if (!LLTrace::BlockTimer::sPauseHistory)  	{  		mScrollIndex = 0; -		LLFastTimer::sResetHistory = true; +		LLTrace::BlockTimer::sResetHistory = true;  		getChild<LLButton>("pause_btn")->setLabel(getString("pause"));  	}  	else @@ -139,13 +139,13 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)  	{  		S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight());  		bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); -		mPrintStats = LLFastTimer::DeclareTimer::HISTORY_NUM - mScrollIndex - bar_idx; +		mPrintStats = LLTrace::BlockTimer::HISTORY_NUM - mScrollIndex - bar_idx;  		return TRUE;  	}  	return LLFloater::handleRightMouseDown(x, y, mask);  } -LLFastTimer::DeclareTimer* LLFastTimerView::getLegendID(S32 y) +LLTrace::BlockTimer* LLFastTimerView::getLegendID(S32 y)  {  	S32 idx = (getRect().getHeight() - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 5; @@ -172,7 +172,7 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)  {  	if (x < mBarRect.mLeft)   	{ -		LLFastTimer::DeclareTimer* idp = getLegendID(y); +		LLTrace::BlockTimer* idp = getLegendID(y);  		if (idp)  		{  			idp->setCollapsed(!idp->getCollapsed()); @@ -208,16 +208,7 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)  		gFocusMgr.setMouseCapture(this);  		return TRUE;  	} -	//else -	//{ -	//	// pause/unpause -	//	LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; -	//	// reset scroll to bottom when unpausing -	//	if (!LLFastTimer::sPauseHistory) -	//	{ -	//		mScrollIndex = 0; -	//	} -	//} +  	return LLFloater::handleMouseDown(x, y, mask);  } @@ -235,14 +226,14 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  	if (hasMouseCapture())  	{  		F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); -		mScrollIndex = llround( lerp * (F32)(LLFastTimer::DeclareTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); -		mScrollIndex = llclamp(	mScrollIndex, 0, LLFastTimer::getLastFrameIndex()); +		mScrollIndex = llround( lerp * (F32)(LLTrace::BlockTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); +		mScrollIndex = llclamp(	mScrollIndex, 0, LLTrace::BlockTimer::getLastFrameIndex());  		return TRUE;  	}  	mHoverTimer = NULL;  	mHoverID = NULL; -	if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) +	if(LLTrace::BlockTimer::sPauseHistory && mBarRect.pointInRect(x, y))  	{  		mHoverBarIndex = llmin(LLFastTimer::getCurFrameIndex() - 1,   								MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight())); @@ -288,7 +279,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  	}  	else if (x < mBarRect.mLeft)   	{ -		LLFastTimer::DeclareTimer* timer_id = getLegendID(y); +		LLTrace::BlockTimer* timer_id = getLegendID(y);  		if (timer_id)  		{  			mHoverID = timer_id; @@ -299,7 +290,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)  } -static std::string get_tooltip(LLFastTimer::DeclareTimer& timer, S32 history_index = -1) +static std::string get_tooltip(LLTrace::BlockTimer& timer, S32 history_index = -1)  {  	F64 ms_multiplier = 1000.0 / (F64)LLFastTimer::countsPerSecond(); @@ -318,7 +309,7 @@ static std::string get_tooltip(LLFastTimer::DeclareTimer& timer, S32 history_ind  BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  { -	if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) +	if(LLTrace::BlockTimer::sPauseHistory && mBarRect.pointInRect(x, y))  	{  		// tooltips for timer bars  		if (mHoverTimer) @@ -326,7 +317,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  			LLRect screen_rect;  			localRectToScreen(mToolTipRect, &screen_rect); -			std::string tooltip = get_tooltip(*mHoverTimer, LLFastTimer::DeclareTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex); +			std::string tooltip = get_tooltip(*mHoverTimer, LLTrace::BlockTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex);  			LLToolTipMgr::instance().show(LLToolTip::Params()  				.message(tooltip) @@ -341,7 +332,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  		// tooltips for timer legend  		if (x < mBarRect.mLeft)   		{ -			LLFastTimer::DeclareTimer* idp = getLegendID(y); +			LLTrace::BlockTimer* idp = getLegendID(y);  			if (idp)  			{  				LLToolTipMgr::instance().show(get_tooltip(*idp)); @@ -356,16 +347,16 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)  BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks)  { -	LLFastTimer::sPauseHistory = TRUE; +	LLTrace::BlockTimer::sPauseHistory = TRUE;  	mScrollIndex = llclamp(	mScrollIndex + clicks,  							0, -							llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::DeclareTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); +							llmin(LLTrace::BlockTimer::getLastFrameIndex(), (S32)LLTrace::BlockTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY));  	return TRUE;  } -static LLFastTimer::DeclareTimer FTM_RENDER_TIMER("Timers", true); +static LLTrace::BlockTimer FTM_RENDER_TIMER("Timers", true); -static std::map<LLFastTimer::DeclareTimer*, LLColor4> sTimerColors; +static std::map<LLTrace::BlockTimer*, LLColor4> sTimerColors;  void LLFastTimerView::draw()  { @@ -429,7 +420,7 @@ void LLFastTimerView::draw()  		y -= (texth + 2);  	} -	S32 histmax = llmin(LLFastTimer::getLastFrameIndex()+1, MAX_VISIBLE_HISTORY); +	S32 histmax = llmin(LLTrace::BlockTimer::getLastFrameIndex()+1, MAX_VISIBLE_HISTORY);  	// Draw the legend  	xleft = margin; @@ -445,7 +436,7 @@ void LLFastTimerView::draw()  		it != timer_tree_iterator_t();  		++it)  	{ -		LLFastTimer::DeclareTimer* idp = (*it); +		LLTrace::BlockTimer* idp = (*it);  		const F32 HUE_INCREMENT = 0.23f;  		hue = fmodf(hue + HUE_INCREMENT, 1.f); @@ -465,12 +456,12 @@ void LLFastTimerView::draw()  		LLLocalClipRect clip(LLRect(margin, y, LEGEND_WIDTH, margin));  		S32 cur_line = 0;  		ft_display_idx.clear(); -		std::map<LLFastTimer::DeclareTimer*, S32> display_line; +		std::map<LLTrace::BlockTimer*, S32> display_line;  		for (timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());  			it != timer_tree_iterator_t();  			++it)  		{ -			LLFastTimer::DeclareTimer* idp = (*it); +			LLTrace::BlockTimer* idp = (*it);  			display_line[idp] = cur_line;  			ft_display_idx.push_back(idp);  			cur_line++; @@ -490,7 +481,7 @@ void LLFastTimerView::draw()  			S32 calls = 0;  			if (mHoverBarIndex > 0 && mHoverID)  			{ -				S32 hidx = LLFastTimer::DeclareTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex; +				S32 hidx = LLTrace::BlockTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex;  				U64 ticks = idp->getHistoricalCount(hidx);  				ms = (F32)((F64)ticks * iclock_freq);  				calls = (S32)idp->getHistoricalCalls(hidx); @@ -528,7 +519,7 @@ void LLFastTimerView::draw()  			x += dx;  			BOOL is_child_of_hover_item = (idp == mHoverID); -			LLFastTimer::DeclareTimer* next_parent = idp->getParent(); +			LLTrace::BlockTimer* next_parent = idp->getParent();  			while(!is_child_of_hover_item && next_parent)  			{  				is_child_of_hover_item = (mHoverID == next_parent); @@ -570,18 +561,18 @@ void LLFastTimerView::draw()  	barw = width - xleft - margin;  	// Draw the history bars -	if (LLFastTimer::getLastFrameIndex() >= 0) +	if (LLTrace::BlockTimer::getLastFrameIndex() >= 0)  	{	  		LLLocalClipRect clip(LLRect(xleft, ytop, getRect().getWidth() - margin, margin));  		U64 totalticks; -		if (!LLFastTimer::sPauseHistory) +		if (!LLTrace::BlockTimer::sPauseHistory)  		{  			U64 ticks = getFrameTimer().getHistoricalCount(mScrollIndex); -			if (LLFastTimer::getCurFrameIndex() >= 10) +			if (LLTrace::BlockTimer::getCurFrameIndex() >= 10)  			{ -				U64 framec = LLFastTimer::getCurFrameIndex(); +				U64 framec = LLTrace::BlockTimer::getCurFrameIndex();  				U64 avg = (U64)mAvgCountTotal;  				mAvgCountTotal = (avg*framec + ticks) / (framec + 1);  				if (ticks > mMaxCountTotal) @@ -592,14 +583,14 @@ void LLFastTimerView::draw()  			if (ticks < mAvgCountTotal/100 || ticks > mAvgCountTotal*100)  			{ -				LLFastTimer::sResetHistory = true; +				LLTrace::BlockTimer::sResetHistory = true;  			} -			if (LLFastTimer::getCurFrameIndex() < 10 || LLFastTimer::sResetHistory) +			if (LLTrace::BlockTimer::getCurFrameIndex() < 10 || LLTrace::BlockTimer::sResetHistory)  			{  				mAvgCountTotal = ticks;  				mMaxCountTotal = ticks; -				LLFastTimer::sResetHistory = false; +				LLTrace::BlockTimer::sResetHistory = false;  			}  		} @@ -706,7 +697,7 @@ void LLFastTimerView::draw()  			S32 tidx;  			if (j >= 0)  			{ -				tidx = LLFastTimer::DeclareTimer::HISTORY_NUM - j - 1 - mScrollIndex; +				tidx = LLTrace::BlockTimer::HISTORY_NUM - j - 1 - mScrollIndex;  			}  			else  			{ @@ -720,14 +711,14 @@ void LLFastTimerView::draw()  			std::vector<S32> deltax;  			xpos.push_back(xleft); -			LLFastTimer::DeclareTimer* prev_id = NULL; +			LLTrace::BlockTimer* prev_id = NULL;  			S32 i = 0;  			for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer());  				it != end_timer_tree();  				++it, ++i)  			{ -				LLFastTimer::DeclareTimer* idp = (*it); +				LLTrace::BlockTimer* idp = (*it);  				F32 frac = tidx == -1  					? (F32)idp->getCountAverage() / (F32)totalticks   					: (F32)idp->getHistoricalCount(tidx) / (F32)totalticks; @@ -754,7 +745,7 @@ void LLFastTimerView::draw()  				{  					U64 sublevelticks = 0; -					for (LLFastTimer::DeclareTimer::child_const_iter it = prev_id->beginChildren(); +					for (LLTrace::BlockTimer::child_const_iter it = prev_id->beginChildren();  						it != prev_id->endChildren();  						++it)  					{ @@ -796,7 +787,7 @@ void LLFastTimerView::draw()  					S32 scale_offset = 0;  					BOOL is_child_of_hover_item = (idp == mHoverID); -					LLFastTimer::DeclareTimer* next_parent = idp->getParent(); +					LLTrace::BlockTimer* next_parent = idp->getParent();  					while(!is_child_of_hover_item && next_parent)  					{  						is_child_of_hover_item = (mHoverID == next_parent); @@ -861,10 +852,10 @@ void LLFastTimerView::draw()  			//highlight visible range  			{ -				S32 first_frame = LLFastTimer::DeclareTimer::HISTORY_NUM - mScrollIndex; +				S32 first_frame = LLTrace::BlockTimer::HISTORY_NUM - mScrollIndex;  				S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; -				F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(LLFastTimer::DeclareTimer::HISTORY_NUM-1); +				F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(LLTrace::BlockTimer::HISTORY_NUM-1);  				F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame;  				F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; @@ -891,7 +882,7 @@ void LLFastTimerView::draw()  				it != end_timer_tree();  				++it)  			{ -				LLFastTimer::DeclareTimer* idp = (*it); +				LLTrace::BlockTimer* idp = (*it);  				//fatten highlighted timer  				if (mHoverID == idp) @@ -915,8 +906,8 @@ void LLFastTimerView::draw()  				gGL.color4f(col[0], col[1], col[2], alpha);				  				gGL.begin(LLRender::TRIANGLE_STRIP); -				for (U32 j = llmax(0, LLFastTimer::DeclareTimer::HISTORY_NUM - LLFastTimer::getLastFrameIndex()); -					j < LLFastTimer::DeclareTimer::HISTORY_NUM; +				for (U32 j = llmax(0, LLTrace::BlockTimer::HISTORY_NUM - LLTrace::BlockTimer::getLastFrameIndex()); +					j < LLTrace::BlockTimer::HISTORY_NUM;  					j++)  				{  					U64 ticks = idp->getHistoricalCount(j); @@ -937,7 +928,7 @@ void LLFastTimerView::draw()  						//normalize to highlighted timer  						cur_max = llmax(cur_max, ticks);  					} -					F32 x = mGraphRect.mLeft + ((F32) (mGraphRect.getWidth()))/(LLFastTimer::DeclareTimer::HISTORY_NUM-1)*j; +					F32 x = mGraphRect.mLeft + ((F32) (mGraphRect.getWidth()))/(LLTrace::BlockTimer::HISTORY_NUM-1)*j;  					F32 y = mGraphRect.mBottom + (F32) mGraphRect.getHeight()/max_ticks*ticks;  					gGL.vertex2f(x,y);  					gGL.vertex2f(x,mGraphRect.mBottom); @@ -992,7 +983,7 @@ void LLFastTimerView::draw()  			it != end_timer_tree();  			++it)  		{ -			LLFastTimer::DeclareTimer* idp = (*it); +			LLTrace::BlockTimer* idp = (*it);  			if (!first)  			{ @@ -1014,7 +1005,7 @@ void LLFastTimerView::draw()  			it != end_timer_tree();  			++it)  		{ -			LLFastTimer::DeclareTimer* idp = (*it); +			LLTrace::BlockTimer* idp = (*it);  			if (!first)  			{ @@ -1551,13 +1542,13 @@ void LLFastTimerView::outputAllMetrics()  //static  void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output)  { -	if(LLFastTimer::sLog) +	if(LLTrace::BlockTimer::sLog)  	{  		doAnalysisDefault(baseline, target, output) ;  		return ;  	} -	if(LLFastTimer::sMetricLog) +	if(LLTrace::BlockTimer::sMetricLog)  	{  		LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ;  		return ; @@ -1568,7 +1559,7 @@ void	LLFastTimerView::onClickCloseBtn()  	setVisible(false);  } -LLFastTimer::DeclareTimer& LLFastTimerView::getFrameTimer() +LLTrace::BlockTimer& LLFastTimerView::getFrameTimer()  {  	return FTM_FRAME;  } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 01a3501e4b..d7f7f27cd4 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -46,7 +46,7 @@ private:  	static LLSD analyzePerformanceLogDefault(std::istream& is) ;  	static void exportCharts(const std::string& base, const std::string& target);  	void onPause(); -	LLFastTimer::DeclareTimer& getFrameTimer(); +	LLTrace::BlockTimer& getFrameTimer();  public: @@ -59,7 +59,7 @@ public:  	virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);  	virtual void draw(); -	LLFastTimer::DeclareTimer* getLegendID(S32 y); +	LLTrace::BlockTimer* getLegendID(S32 y);  	F64 getTime(const std::string& name);  protected: @@ -85,8 +85,8 @@ private:  	U64 mMaxCountTotal;  	LLRect mBarRect;  	S32	mScrollIndex; -	LLFastTimer::DeclareTimer* mHoverID; -	LLFastTimer::DeclareTimer* mHoverTimer; +	LLTrace::BlockTimer* mHoverID; +	LLTrace::BlockTimer* mHoverTimer;  	LLRect					mToolTipRect;  	S32 mHoverBarIndex;  	LLFrameTimer mHighlightTimer; diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 3136358b83..6bba375f50 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -31,6 +31,7 @@  #include "llassetstorage.h"  #include "llinventorytype.h"  #include "llfilepicker.h" +#include <queue>  class LLTransactionID; | 
