diff options
| author | Richard Linden <none@none> | 2012-08-30 16:48:05 -0700 | 
|---|---|---|
| committer | Richard Linden <none@none> | 2012-08-30 16:48:05 -0700 | 
| commit | f5ce2c2940e1f3c72df8886d95b70ef53554f642 (patch) | |
| tree | a76fcf61a1dc3d1f06ef38bddc9ed782211b2aba | |
| parent | d1481a599fa8bd65f505e0bd9dec33370a3c68c8 (diff) | |
| parent | 64201b21b3d02f98969981723ef5426cdbfc16be (diff) | |
Automated merge with https://bitbucket.org/lindenlab/viewer-cat
| -rw-r--r-- | indra/llcommon/llfasttimer.cpp | 69 | ||||
| -rw-r--r-- | indra/llcommon/llfasttimer.h | 11 | ||||
| -rw-r--r-- | indra/newview/llfasttimerview.cpp | 4 | 
3 files changed, 32 insertions, 52 deletions
| diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 670c90351e..700ad65bf9 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -113,10 +113,9 @@ public:  	/*virtual */ void initSingleton()  	{  		mTimerRoot = new LLFastTimer::NamedTimer("root"); -		mRootFrameState.setNamedTimer(mTimerRoot); -		mTimerRoot->setFrameState(&mRootFrameState); +		mRootFrameState = &mTimerRoot->getFrameState();  		mTimerRoot->mParent = mTimerRoot; -		mRootFrameState.mParent = &mRootFrameState; +		mRootFrameState->mParent = mRootFrameState;  	}  	~NamedTimerFactory() @@ -126,10 +125,15 @@ public:  		delete mTimerRoot;  	} -	LLFastTimer::NamedTimer& createNamedTimer(const std::string& name, LLFastTimer::FrameState* state) +	LLFastTimer::NamedTimer& createNamedTimer(const std::string& name)  	{ +		timer_map_t::iterator found_it = mTimers.find(name); +		if (found_it != mTimers.end()) +		{ +			return *found_it->second; +		} +  		LLFastTimer::NamedTimer* timer = new LLFastTimer::NamedTimer(name); -		timer->setFrameState(state);  		timer->setParent(mTimerRoot);  		mTimers.insert(std::make_pair(name, timer)); @@ -148,7 +152,7 @@ public:  	LLFastTimer::NamedTimer* getRootTimer() { return mTimerRoot; } -	typedef std::multimap<std::string, LLFastTimer::NamedTimer*> timer_map_t; +	typedef std::map<std::string, LLFastTimer::NamedTimer*> timer_map_t;  	timer_map_t::iterator beginTimers() { return mTimers.begin(); }  	timer_map_t::iterator endTimers() { return mTimers.end(); }  	S32 timerCount() { return mTimers.size(); } @@ -157,18 +161,20 @@ private:  	timer_map_t mTimers;  	LLFastTimer::NamedTimer*		mTimerRoot; -	LLFastTimer::FrameState			mRootFrameState; +	LLFastTimer::FrameState*	mRootFrameState;  };  LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name, bool open ) -:	mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +:	mTimer(NamedTimerFactory::instance().createNamedTimer(name))  { +	mFrameState = &mTimer.getFrameState();  	mTimer.setCollapsed(!open);  }  LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name) -:	mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +:	mTimer(NamedTimerFactory::instance().createNamedTimer(name))  { +	mFrameState = &mTimer.getFrameState();  }  //static @@ -218,13 +224,13 @@ LLFastTimer::NamedTimer::NamedTimer(const std::string& name)  	mTotalTimeCounter(0),  	mCountAverage(0),  	mCallAverage(0), -	mNeedsSorting(false), -	mFrameState(NULL) +	mNeedsSorting(false)  {  	mCountHistory = new U32[HISTORY_NUM];  	memset(mCountHistory, 0, sizeof(U32) * HISTORY_NUM);  	mCallHistory = new U32[HISTORY_NUM];  	memset(mCallHistory, 0, sizeof(U32) * HISTORY_NUM); +	mFrameState.setNamedTimer(this);  }  LLFastTimer::NamedTimer::~NamedTimer() @@ -284,7 +290,7 @@ S32 LLFastTimer::NamedTimer::getDepth()  {  	S32 depth = 0;  	NamedTimer* timerp = mParent; -	while(timerp) +	while(timerp && timerp->mParent != timerp)  	{  		depth++;  		timerp = timerp->mParent; @@ -539,9 +545,14 @@ U32 LLFastTimer::NamedTimer::getHistoricalCalls(S32 history_index ) const  	return mCallHistory[history_idx];  } -LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() const +const LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() const  { -	return *mFrameState; +	return mFrameState; +} + +LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() +{ +	return mFrameState;  }  std::vector<LLFastTimer::NamedTimer*>::const_iterator LLFastTimer::NamedTimer::beginChildren() @@ -639,36 +650,6 @@ const LLFastTimer::NamedTimer* LLFastTimer::getTimerByName(const std::string& na  	return NamedTimerFactory::instance().getTimerByName(name);  } -//static -bool LLFastTimer::checkForDuplicates(std::string& duplicates) -{ -	typedef NamedTimerFactory::timer_map_t::iterator timer_iterator; - -	bool duplicateFound = false; -	NamedTimerFactory& namedFactory = NamedTimerFactory::instance(); - -	if (namedFactory.timerCount() > 1) -	{ -		timer_iterator endPosition = namedFactory.endTimers(); -		timer_iterator ti = namedFactory.beginTimers(); -		std::string prevKey = ti->first; - -		for (ti++; ti != endPosition; ti++) -		{ -			const std::string& curKey = ti->first; -			if (0 == curKey.compare(prevKey)) -			{ -				if (duplicateFound) duplicates += ", "; -				duplicates += curKey; -				duplicateFound = true; -			} -			prevKey = curKey; -		} -	} - -	return duplicateFound; -} -  LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state)  :	mFrameState(state)  { diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index b0d3ea5d60..07af0f1d4d 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -91,8 +91,8 @@ public:  		U32 getHistoricalCount(S32 history_index = 0) const;  		U32 getHistoricalCalls(S32 history_index = 0) const; -		void setFrameState(FrameState* state) { mFrameState = state; state->setNamedTimer(this); } -		FrameState& getFrameState() const; +		const FrameState& getFrameState() const; +		FrameState& getFrameState();  	private:  		friend class LLFastTimer; @@ -116,7 +116,7 @@ public:  		//  		// members  		// -		FrameState*		mFrameState; +		FrameState		mFrameState;  		std::string	mName; @@ -147,7 +147,7 @@ public:  		NamedTimer& getNamedTimer() { return mTimer; }  	private: -		FrameState		mFrameState; +		FrameState*		mFrameState;  		NamedTimer&		mTimer;  	}; @@ -155,7 +155,7 @@ public:  	LLFastTimer(LLFastTimer::FrameState* state);  	LL_FORCE_INLINE LLFastTimer(LLFastTimer::DeclareTimer& timer) -	:	mFrameState(&timer.mFrameState) +	:	mFrameState(timer.mFrameState)  	{  #if FAST_TIMER_ON  		LLFastTimer::FrameState* frame_state = mFrameState; @@ -224,7 +224,6 @@ public:  	static void writeLog(std::ostream& os);  	static const NamedTimer* getTimerByName(const std::string& name); -	static bool checkForDuplicates(std::string& duplicates);  	struct CurTimerData  	{ diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 59bf70f488..fd92f8ac18 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -511,7 +511,7 @@ void LLFastTimerView::draw()  			x += dx;  			BOOL is_child_of_hover_item = (idp == mHoverID);  			LLFastTimer::NamedTimer* next_parent = idp->getParent(); -			while(!is_child_of_hover_item && next_parent) +			while(!is_child_of_hover_item && next_parent && next_parent != next_parent->getParent())  			{  				is_child_of_hover_item = (mHoverID == next_parent);  				next_parent = next_parent->getParent(); @@ -778,7 +778,7 @@ void LLFastTimerView::draw()  					BOOL is_child_of_hover_item = (idp == mHoverID);  					LLFastTimer::NamedTimer* next_parent = idp->getParent(); -					while(!is_child_of_hover_item && next_parent) +					while(!is_child_of_hover_item && next_parent && next_parent != next_parent->getParent())  					{  						is_child_of_hover_item = (mHoverID == next_parent);  						next_parent = next_parent->getParent(); | 
