summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerstats.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llviewerstats.cpp73
1 files changed, 21 insertions, 52 deletions
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 1627870262..65cae9b338 100644..100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -733,23 +733,27 @@ void send_stats()
LLHTTPClient::post(url, body, new ViewerStatsResponder());
}
-LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name)
+LLViewerStats::PhaseMap::PhaseMap()
+{
+}
+
+LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name)
{
phase_map_t::iterator iter = mPhaseMap.find(phase_name);
if (iter == mPhaseMap.end())
{
- LLFrameTimer timer;
+ LLTimer timer;
mPhaseMap[phase_name] = timer;
}
- LLFrameTimer& timer = mPhaseMap[phase_name];
+ LLTimer& timer = mPhaseMap[phase_name];
return timer;
}
void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name)
{
- LLFrameTimer& timer = getPhaseTimer(phase_name);
+ LLTimer& timer = getPhaseTimer(phase_name);
lldebugs << "startPhase " << phase_name << llendl;
- timer.unpause();
+ timer.start();
}
void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name)
@@ -760,33 +764,26 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name)
if (iter->second.getStarted())
{
// Going from started to paused state - record stats.
- recordPhaseStat(phase_name,iter->second.getElapsedTimeF32());
+ iter->second.stop();
}
- lldebugs << "stopPhase " << phase_name << llendl;
- iter->second.pause();
- }
- else
- {
- lldebugs << "stopPhase " << phase_name << " is not started, no-op" << llendl;
}
}
-void LLViewerStats::PhaseMap::stopAllPhases()
+bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed)
{
- for (phase_map_t::iterator iter = mPhaseMap.begin();
- iter != mPhaseMap.end(); ++iter)
+ phase_map_t::iterator iter = mPhaseMap.find(phase_name);
+ if (iter != mPhaseMap.end())
{
- 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();
+ elapsed = iter->second.getElapsedTimeF32();
+ completed = !iter->second.getStarted();
+ return true;
+ }
+ else
+ {
+ return false;
}
}
-
+
void LLViewerStats::PhaseMap::clearPhases()
{
lldebugs << "clearPhases" << llendl;
@@ -805,31 +802,3 @@ LLSD LLViewerStats::PhaseMap::dumpPhases()
}
return result;
}
-
-// static initializer
-//static
-LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats;
-
-LLViewerStats::PhaseMap::PhaseMap()
-{
-}
-
-// 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);
-}
-