diff options
| author | Merov Linden <merov@lindenlab.com> | 2010-11-08 17:16:31 -0800 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2010-11-08 17:16:31 -0800 | 
| commit | b5df1d2abcef04ee5f491a7414189f4e82faaa1e (patch) | |
| tree | 1e8d59da3e0473f300d99bd683cd1486de3b31e2 /indra/llcommon | |
| parent | 85509457c6dc6a0f3e56fa3d24ae872e1878c04f (diff) | |
STORM-105 : takes Vadim's comments into account, clean up use of static globals and magic strings, enforce naming conventions
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 23 | ||||
| -rw-r--r-- | indra/llcommon/llmetricperformancetester.h | 9 | 
2 files changed, 25 insertions, 7 deletions
| diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 2110192fbc..5fa3a5ea07 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -67,6 +67,7 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t  /*static*/   LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name)   { +	// Check for the requested metric name  	name_tester_map_t::iterator found_it = sTesterMap.find(name) ;  	if (found_it != sTesterMap.end())  	{ @@ -74,6 +75,14 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s  	}  	return NULL ;  } + +/*static*/  +// 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))); +} +  //----------------------------------------------------------------------------------------------  // LLMetricPerformanceTesterBasic : Tester instance methods @@ -126,13 +135,13 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD*  {  	resetCurrentCount() ; -	std::string currentLabel = getCurrentLabelName(); -	BOOL in_base = (*base).has(currentLabel) ; -	BOOL in_current = (*current).has(currentLabel) ; +	std::string current_label = getCurrentLabelName(); +	BOOL in_base = (*base).has(current_label) ; +	BOOL in_current = (*current).has(current_label) ;  	while(in_base || in_current)  	{ -		LLSD::String label = currentLabel ;		 +		LLSD::String label = current_label ;		  		if(in_base && in_current)  		{				 @@ -157,9 +166,9 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD*  		}  		incrementCurrentCount(); -		currentLabel = getCurrentLabelName(); -		in_base = (*base).has(currentLabel) ; -		in_current = (*current).has(currentLabel) ; +		current_label = getCurrentLabelName(); +		in_base = (*base).has(current_label) ; +		in_current = (*current).has(current_label) ;  	}  } diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 6fd1d41daa..925010ac96 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -27,6 +27,8 @@  #ifndef LL_METRICPERFORMANCETESTER_H   #define LL_METRICPERFORMANCETESTER_H  +const std::string DEFAULT_METRIC_NAME("metric"); +  /**   * @class LLMetricPerformanceTesterBasic   * @brief Performance Metric Base Class @@ -131,6 +133,13 @@ public:  	 * @param[in] name - Name of the tester instance queried.  	 */  	static LLMetricPerformanceTesterBasic* getTester(std::string name) ; +	 +	/** +	 * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged +	 * @param[in] name - Name of the tester queried. +	 */ +	static BOOL isMetricLogRequested(std::string name); +	  	/**  	 * @return Returns TRUE if there's a tester defined, FALSE otherwise.  	 */ | 
