diff options
Diffstat (limited to 'indra/newview/llviewerstats.cpp')
-rw-r--r--[-rwxr-xr-x] | indra/newview/llviewerstats.cpp | 100 |
1 files changed, 70 insertions, 30 deletions
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index a9256ed5ea..b73411080a 100755..100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -41,6 +41,7 @@ #include "lltexturefetch.h" #include "llviewerobjectlist.h" #include "llviewertexturelist.h" +#include "lltexlayer.h" #include "lltexlayerparams.h" #include "llsurface.h" #include "llvlmanager.h" @@ -54,7 +55,6 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llvoavatarself.h" -#include "llviewertexlayer.h" #include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" #include "llfeaturemanager.h" @@ -417,7 +417,7 @@ F32 gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f; U32 gTotalWorldBytes = 0, gTotalObjectBytes = 0, gTotalTextureBytes = 0, gSimPingCount = 0; U32 gObjectBits = 0; F32 gAvgSimPing = 0.f; -U32 gTotalTextureBytesPerBoostLevel[LLGLTexture::MAX_GL_IMAGE_CATEGORY] = {0}; +U32 gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0}; extern U32 gVisCompared; extern U32 gVisTested; @@ -734,29 +734,69 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } -LLViewerStats::PhaseMap::PhaseMap() -{ -} - -LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) +LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); if (iter == mPhaseMap.end()) { - LLTimer timer; + LLFrameTimer timer; mPhaseMap[phase_name] = timer; } - LLTimer& timer = mPhaseMap[phase_name]; + LLFrameTimer& timer = mPhaseMap[phase_name]; return timer; } void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name) { - LLTimer& timer = getPhaseTimer(phase_name); + LLFrameTimer& timer = getPhaseTimer(phase_name); lldebugs << "startPhase " << phase_name << llendl; - timer.start(); + timer.unpause(); } +void LLViewerStats::PhaseMap::stopAllPhases() +{ + for (phase_map_t::iterator iter = mPhaseMap.begin(); + iter != mPhaseMap.end(); ++iter) + { + const std::string& phase_name = iter->first; + if (iter->second.getStarted()) + { + // Going from started to paused state - record stats. + recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); + } + lldebugs << "stopPhase (all) " << phase_name << llendl; + iter->second.pause(); + } +} + +void LLViewerStats::PhaseMap::clearPhases() +{ + lldebugs << "clearPhases" << llendl; + + mPhaseMap.clear(); +} + +LLSD LLViewerStats::PhaseMap::dumpPhases() +{ + LLSD result; + for (phase_map_t::iterator iter = mPhaseMap.begin(); iter != mPhaseMap.end(); ++iter) + { + const std::string& phase_name = iter->first; + result[phase_name]["completed"] = LLSD::Integer(!(iter->second.getStarted())); + result[phase_name]["elapsed"] = iter->second.getElapsedTimeF32(); + } + return result; +} + +// static initializer +//static +LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats; + +LLViewerStats::PhaseMap::PhaseMap() +{ +} + + void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); @@ -769,6 +809,25 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) } } } +// static +LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) +{ + phase_stats_t::iterator it = sStats.find(phase_name); + if (it == sStats.end()) + { + LLViewerStats::StatsAccumulator new_stats; + sStats[phase_name] = new_stats; + } + return sStats[phase_name]; +} + +// static +void LLViewerStats::PhaseMap::recordPhaseStat(const std::string& phase_name, F32 value) +{ + LLViewerStats::StatsAccumulator& stats = getPhaseStats(phase_name); + stats.push(value); +} + bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed) { @@ -784,22 +843,3 @@ bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& return false; } } - -void LLViewerStats::PhaseMap::clearPhases() -{ - lldebugs << "clearPhases" << llendl; - - mPhaseMap.clear(); -} - -LLSD LLViewerStats::PhaseMap::dumpPhases() -{ - LLSD result; - for (phase_map_t::iterator iter = mPhaseMap.begin(); iter != mPhaseMap.end(); ++iter) - { - const std::string& phase_name = iter->first; - result[phase_name]["completed"] = LLSD::Integer(!(iter->second.getStarted())); - result[phase_name]["elapsed"] = iter->second.getElapsedTimeF32(); - } - return result; -} |