diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/llcommon/llfasttimer.cpp | 51 | ||||
| -rwxr-xr-x | indra/llcommon/llfasttimer.h | 13 | ||||
| -rwxr-xr-x | indra/newview/llfasttimerview.cpp | 38 | 
3 files changed, 58 insertions, 44 deletions
| diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 361d800629..2db44adacf 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -73,37 +73,52 @@ U64         BlockTimerStatHandle::sClockResolution = 1000000; // Microsecond res  static LLMutex*			sLogLock = NULL;  static std::queue<LLSD> sLogQueue; +block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id)  +{  +	return block_timer_tree_df_iterator_t(&id,  +		boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1),  +		boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); +} -// FIXME: move these declarations to the relevant modules - -// helper functions -typedef LLTreeDFSPostIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> timer_tree_bottom_up_iterator_t; +block_timer_tree_df_iterator_t end_block_timer_tree_df()  +{  +	return block_timer_tree_df_iterator_t();  +} -static timer_tree_bottom_up_iterator_t begin_timer_tree_bottom_up(BlockTimerStatHandle& id)  +block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id)   {  -	return timer_tree_bottom_up_iterator_t(&id,  +	return block_timer_tree_df_post_iterator_t(&id,   							boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1),   							boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1));  } -static timer_tree_bottom_up_iterator_t end_timer_tree_bottom_up()  +block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post()   {  -	return timer_tree_bottom_up_iterator_t();  +	return block_timer_tree_df_post_iterator_t();   } -typedef LLTreeDFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> timer_tree_dfs_iterator_t; +block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id) +{ +	return block_timer_tree_bf_iterator_t(&id,  +		boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1),  +		boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); +} +block_timer_tree_bf_iterator_t end_block_timer_tree_bf() +{ +	return block_timer_tree_bf_iterator_t();  +} -static timer_tree_dfs_iterator_t begin_timer_tree(BlockTimerStatHandle& id)  +block_timer_tree_df_iterator_t begin_timer_tree(BlockTimerStatHandle& id)   {  -	return timer_tree_dfs_iterator_t(&id,  +	return block_timer_tree_df_iterator_t(&id,   		boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1),   							boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1));  } -static timer_tree_dfs_iterator_t end_timer_tree()  +block_timer_tree_df_iterator_t end_timer_tree()   {  -	return timer_tree_dfs_iterator_t();  +	return block_timer_tree_df_iterator_t();   } @@ -111,9 +126,9 @@ static timer_tree_dfs_iterator_t end_timer_tree()  struct SortTimerByName  {  	bool operator()(const BlockTimerStatHandle* i1, const BlockTimerStatHandle* i2) -        { +	{  		return i1->getName() < i2->getName(); -        } +    }  };  BlockTimerStatHandle& BlockTimerStatHandle::getRootTimeBlock() @@ -207,8 +222,8 @@ void BlockTimerStatHandle::bootstrapTimerTree()  // this preserves partial order derived from current frame's observations  void BlockTimerStatHandle::incrementalUpdateTimerTree()  { -	for(timer_tree_bottom_up_iterator_t it = begin_timer_tree_bottom_up(BlockTimerStatHandle::getRootTimeBlock()); -		it != end_timer_tree_bottom_up(); +	for(block_timer_tree_df_post_iterator_t it = begin_block_timer_tree_df_post(BlockTimerStatHandle::getRootTimeBlock()); +		it != end_block_timer_tree_df_post();  		++it)  	{  		BlockTimerStatHandle* timerp = *it; @@ -374,7 +389,7 @@ void BlockTimerStatHandle::dumpCurTimes()  	LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording();  	// walk over timers in depth order and output timings -	for(timer_tree_dfs_iterator_t it = begin_timer_tree(BlockTimerStatHandle::getRootTimeBlock()); +	for(block_timer_tree_df_iterator_t it = begin_timer_tree(BlockTimerStatHandle::getRootTimeBlock());  		it != end_timer_tree();  		++it)  	{ diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index faa622628b..4821d6c386 100755 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -29,6 +29,7 @@  #include "llinstancetracker.h"  #include "lltrace.h" +#include "lltreeiterators.h"  #define LL_FAST_TIMER_ON 1  #define LL_FASTTIMER_USE_RDTSC 1 @@ -277,6 +278,18 @@ public:  	static U64									sClockResolution;  }; +// iterators and helper functions for walking the call hierarchy of block timers in different ways +typedef LLTreeDFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_df_iterator_t; +typedef LLTreeDFSPostIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_df_post_iterator_t; +typedef LLTreeBFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_bf_iterator_t; + +block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id); +block_timer_tree_df_iterator_t end_block_timer_tree_df(); +block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id); +block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post(); +block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id); +block_timer_tree_bf_iterator_t end_block_timer_tree_bf(); +  LL_FORCE_INLINE BlockTimer::BlockTimer(BlockTimerStatHandle& timer)  {  #if LL_FAST_TIMER_ON diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 6153c43690..302cecb5b6 100755 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -66,22 +66,8 @@ static const S32 NUM_FRAMES_HISTORY = 200;  std::vector<BlockTimerStatHandle*> ft_display_idx; // line of table entry for display purposes (for collapse) -typedef LLTreeDFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> timer_tree_iterator_t; -  BOOL LLFastTimerView::sAnalyzePerformance = FALSE; -static timer_tree_iterator_t begin_timer_tree(BlockTimerStatHandle& id)  -{  -	return timer_tree_iterator_t(&id,  -							boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1),  -							boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); -} - -static timer_tree_iterator_t end_timer_tree()  -{  -	return timer_tree_iterator_t();  -} -  S32 get_depth(const BlockTimerStatHandle* blockp)  {  	S32 depth = 0; @@ -186,8 +172,8 @@ BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y)  BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)  { -	for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -		it != end_timer_tree(); +	for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +		it != LLTrace::end_block_timer_tree_df();  		++it)  	{  		(*it)->getTreeNode().mCollapsed = false; @@ -962,8 +948,8 @@ void LLFastTimerView::printLineStats()  	{  		std::string legend_stat;  		bool first = true; -		for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -			it != end_timer_tree(); +		for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +			it != LLTrace::end_block_timer_tree_df();  			++it)  		{  			BlockTimerStatHandle* idp = (*it); @@ -984,8 +970,8 @@ void LLFastTimerView::printLineStats()  		std::string timer_stat;  		first = true; -		for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -			it != end_timer_tree(); +		for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +			it != LLTrace::end_block_timer_tree_df();  			++it)  		{  			BlockTimerStatHandle* idp = (*it); @@ -1062,8 +1048,8 @@ void LLFastTimerView::drawLineGraph()  	F32Seconds cur_max(0);  	U32 cur_max_calls = 0; -	for(timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -		it != end_timer_tree(); +	for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +		it != LLTrace::end_block_timer_tree_df();  		++it)  	{  		BlockTimerStatHandle* idp = (*it); @@ -1209,8 +1195,8 @@ void LLFastTimerView::drawLegend()  		S32 cur_line = 0;  		ft_display_idx.clear();  		std::map<BlockTimerStatHandle*, S32> display_line; -		for (timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -			it != timer_tree_iterator_t(); +		for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +			it != block_timer_tree_df_iterator_t();  			++it)  		{  			BlockTimerStatHandle* idp = (*it); @@ -1308,8 +1294,8 @@ void LLFastTimerView::generateUniqueColors()  		F32 hue = 0.f; -		for (timer_tree_iterator_t it = begin_timer_tree(FTM_FRAME); -			it != timer_tree_iterator_t(); +		for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); +			it != block_timer_tree_df_iterator_t();  			++it)  		{  			BlockTimerStatHandle* idp = (*it); | 
