diff options
author | Merov Linden <merov@lindenlab.com> | 2010-11-05 18:40:08 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-11-05 18:40:08 -0700 |
commit | 85509457c6dc6a0f3e56fa3d24ae872e1878c04f (patch) | |
tree | 25965d736b6f3052c4bb1fbffc7f725edf97561b /indra/llcommon/llmetricperformancetester.cpp | |
parent | a680d4fc1c30828fac63b1b9c6caee497c8f992a (diff) |
STORM-105 : Take Vadim code review into account, code clean up
Diffstat (limited to 'indra/llcommon/llmetricperformancetester.cpp')
-rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index bd548f199a..2110192fbc 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -52,7 +52,7 @@ void LLMetricPerformanceTesterBasic::cleanClass() /*static*/ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) { - llassert_always(tester != NULL); + llassert_always(tester != NULL); std::string name = tester->getTesterName() ; if (getTester(name)) { @@ -80,7 +80,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) : - mName(name), + mName(name), mCount(0) { if (mName == std::string()) @@ -110,7 +110,7 @@ void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) void LLMetricPerformanceTesterBasic::outputTestResults() { LLSD sd; - + preOutputTestResults(&sd) ; outputTestRecord(&sd) ; postOutputTestResults(&sd) ; @@ -124,43 +124,43 @@ void LLMetricPerformanceTesterBasic::addMetric(std::string str) /*virtual*/ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - resetCurrentCount() ; - - std::string currentLabel = getCurrentLabelName(); - BOOL in_base = (*base).has(currentLabel) ; - BOOL in_current = (*current).has(currentLabel) ; - - while(in_base || in_current) - { - LLSD::String label = currentLabel ; - - if(in_base && in_current) - { - *os << llformat("%s\n", label.c_str()) ; - - for(U32 index = 0 ; index < mMetricStrings.size() ; index++) - { - switch((*current)[label][ mMetricStrings[index] ].type()) - { - case LLSD::TypeInteger: - compareTestResults(os, mMetricStrings[index], - (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; - break ; - case LLSD::TypeReal: - compareTestResults(os, mMetricStrings[index], - (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; - break; - default: - llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; - } - } - } - - incrementCurrentCount(); - currentLabel = getCurrentLabelName(); - in_base = (*base).has(currentLabel) ; - in_current = (*current).has(currentLabel) ; - } + resetCurrentCount() ; + + std::string currentLabel = getCurrentLabelName(); + BOOL in_base = (*base).has(currentLabel) ; + BOOL in_current = (*current).has(currentLabel) ; + + while(in_base || in_current) + { + LLSD::String label = currentLabel ; + + if(in_base && in_current) + { + *os << llformat("%s\n", label.c_str()) ; + + for(U32 index = 0 ; index < mMetricStrings.size() ; index++) + { + switch((*current)[label][ mMetricStrings[index] ].type()) + { + case LLSD::TypeInteger: + compareTestResults(os, mMetricStrings[index], + (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; + break ; + case LLSD::TypeReal: + compareTestResults(os, mMetricStrings[index], + (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; + break; + default: + llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + } + } + } + + incrementCurrentCount(); + currentLabel = getCurrentLabelName(); + in_base = (*base).has(currentLabel) ; + in_current = (*current).has(currentLabel) ; + } } /*virtual*/ @@ -182,12 +182,12 @@ void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std:: //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : - LLMetricPerformanceTesterBasic(name), - mBaseSessionp(NULL), - mCurrentSessionp(NULL) + LLMetricPerformanceTesterBasic(name), + mBaseSessionp(NULL), + mCurrentSessionp(NULL) { } - + LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() { if (mBaseSessionp) @@ -205,33 +205,33 @@ LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() /*virtual*/ void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - // Load the base session - resetCurrentCount() ; - mBaseSessionp = loadTestSession(base) ; - - // Load the current session - resetCurrentCount() ; - mCurrentSessionp = loadTestSession(current) ; - - if (!mBaseSessionp || !mCurrentSessionp) - { - llerrs << "Error loading test sessions." << llendl ; - } - - // Compare - compareTestSessions(os) ; - - // Release memory - if (mBaseSessionp) - { - delete mBaseSessionp ; - mBaseSessionp = NULL ; - } - if (mCurrentSessionp) - { - delete mCurrentSessionp ; - mCurrentSessionp = NULL ; - } + // Load the base session + resetCurrentCount() ; + mBaseSessionp = loadTestSession(base) ; + + // Load the current session + resetCurrentCount() ; + mCurrentSessionp = loadTestSession(current) ; + + if (!mBaseSessionp || !mCurrentSessionp) + { + llerrs << "Error loading test sessions." << llendl ; + } + + // Compare + compareTestSessions(os) ; + + // Release memory + if (mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if (mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } } |