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/newview | |
parent | a680d4fc1c30828fac63b1b9c6caee497c8f992a (diff) |
STORM-105 : Take Vadim code review into account, code clean up
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 4 | ||||
-rw-r--r-- | indra/newview/llfasttimerview.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llfasttimerview.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 40 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 1 |
6 files changed, 48 insertions, 41 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6db9807861..5b69fd80af 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -510,10 +510,10 @@ class LLFastTimerLogThread : public LLThread public: std::string mFile; - LLFastTimerLogThread(std::string& testName) : LLThread("fast timer log") + LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log") { - std::string fileName = testName + std::string(".slp"); - mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, fileName); + std::string file_name = test_name + std::string(".slp"); + mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name); } void run() @@ -1303,7 +1303,7 @@ bool LLAppViewer::cleanup() { // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); - + // remove any old breakpad minidump files from the log directory if (! isError()) { @@ -1641,7 +1641,7 @@ bool LLAppViewer::cleanup() std::string baselineName = LLFastTimer::sLogName + "_baseline.slp"; std::string currentName = LLFastTimer::sLogName + ".slp"; std::string reportName = LLFastTimer::sLogName + "_report.csv"; - + LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baselineName), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, currentName), @@ -2113,16 +2113,16 @@ bool LLAppViewer::initConfiguration() LLFastTimer::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 testName = clp.getOption("logmetrics")[0]; - llinfos << "'--logmetrics' argument : " << testName << llendl; - if (testName == "") - { - llwarns << "No '--logmetrics' argument given, will output all metrics." << llendl; + std::string test_name = clp.getOption("logmetrics")[0]; + llinfos << "'--logmetrics' argument : " << test_name << llendl; + if (test_name == "") + { + llwarns << "No '--logmetrics' argument given, will output all metrics." << llendl; LLFastTimer::sLogName = std::string("metric"); - } - else - { - LLFastTimer::sLogName = testName; + } + else + { + LLFastTimer::sLogName = test_name; } } @@ -2164,7 +2164,7 @@ bool LLAppViewer::initConfiguration() { LLFastTimerView::sAnalyzePerformance = TRUE; } - + if (clp.hasOption("replaysession")) { LLAgentPilot::sReplaySession = TRUE; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 3bdc6325c1..a14ab4362f 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -167,7 +167,7 @@ public: // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); virtual bool getMasterSystemAudioMute(); - + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. @@ -253,7 +253,7 @@ private: // For performance and metric gathering LLThread* mFastTimerLogThread; - + // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 5b6a25a041..92a3b9b2f5 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1184,12 +1184,12 @@ void LLFastTimerView::outputAllMetrics() { if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) { - for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); - iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); - tester->outputTestResults(); - } + for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); + iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) + { + LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); + tester->outputTestResults(); + } } } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 1d844454c8..1a54a53f09 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -37,7 +37,7 @@ public: static BOOL sAnalyzePerformance; - static void outputAllMetrics(); + static void outputAllMetrics(); static void doAnalysis(std::string baseline, std::string target, std::string output); private: diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index aba52cda4f..2b27f308df 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -288,6 +288,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s return gTextureList.getImageFromUrl(url, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } +//static +bool LLViewerTextureManager::perfStatsEnabled() +{ + return (sTesterp != NULL); +} + LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) { return gTextureList.getImageFromHost(image_id, host) ; @@ -342,14 +348,14 @@ void LLViewerTextureManager::init() LLViewerTexture::initClass() ; - if (LLFastTimer::sMetricLog && !LLViewerTextureManager::sTesterp && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) + if (LLFastTimer::sMetricLog && !perfStatsEnabled() && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) { - LLViewerTextureManager::sTesterp = new LLTexturePipelineTester() ; - if (!LLViewerTextureManager::sTesterp->isValid()) - { - delete LLViewerTextureManager::sTesterp; - LLViewerTextureManager::sTesterp = NULL; - } + sTesterp = new LLTexturePipelineTester() ; + if (!sTesterp->isValid()) + { + delete sTesterp; + sTesterp = NULL; + } } } @@ -414,7 +420,7 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity { sCurrentTime = gFrameTimeSeconds ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->update() ; } @@ -609,7 +615,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) //check if there is cached raw image and switch to it if possible switchToCachedImage() ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->updateGrayTextureBinding() ; } @@ -1072,7 +1078,7 @@ BOOL LLViewerTexture::isLargeImage() //virtual void LLViewerTexture::updateBindStatsForTester() { - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->updateTextureBindingStats(this) ; } @@ -1855,7 +1861,7 @@ bool LLViewerFetchedTexture::updateFetch() // We may have data ready regardless of whether or not we are finished (e.g. waiting on write) if (mRawImage.notNull()) { - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { mIsFetched = TRUE ; LLViewerTextureManager::sTesterp->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ; @@ -3082,7 +3088,7 @@ void LLViewerLODTexture::scaleDown() { switchToCachedImage() ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->setStablizingTime() ; } @@ -3621,7 +3627,7 @@ LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWi LLTexturePipelineTester::~LLTexturePipelineTester() { - LLViewerTextureManager::sTesterp = NULL ; + LLViewerTextureManager::sTesterp = NULL; } void LLTexturePipelineTester::update() @@ -3687,7 +3693,7 @@ void LLTexturePipelineTester::reset() //virtual void LLTexturePipelineTester::outputTestRecord(LLSD *sd) { - std::string currentLabel = getCurrentLabelName(); + std::string currentLabel = getCurrentLabelName(); (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ; (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ; (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ; @@ -3874,7 +3880,7 @@ LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::lo sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; //load a session - std::string currentLabel = getCurrentLabelName(); + std::string currentLabel = getCurrentLabelName(); BOOL in_log = (*log).has(currentLabel) ; while (in_log) { @@ -3945,9 +3951,9 @@ LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::lo sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; } - // Next label + // Next label incrementCurrentCount() ; - currentLabel = getCurrentLabelName(); + currentLabel = getCurrentLabelName(); in_log = (*log).has(currentLabel) ; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index b5636bbdc7..88d449e061 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -676,6 +676,7 @@ private: public: //texture pipeline tester static LLTexturePipelineTester* sTesterp ; + static bool perfStatsEnabled(); //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture. static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ; |