summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-12-02 23:00:36 -0800
committerRichard Linden <none@none>2012-12-02 23:00:36 -0800
commit13e4edf1cd664864afa585bc83bbe99d4f743326 (patch)
tree52d6b16185099b58bcf7d284d753d938ecced027 /indra
parent4f9a5d0554c16a81625574a7a4ad6d5070e649e3 (diff)
SH-3406 WIP convert fast timers to lltrace system
started moving fast timer historical stats over to LLTrace periodic recording
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llfasttimer.cpp6
-rw-r--r--indra/llcommon/lltracerecording.cpp11
-rw-r--r--indra/llcommon/lltracerecording.h22
-rw-r--r--indra/newview/llfasttimerview.cpp6
4 files changed, 31 insertions, 14 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 19676cc0c6..e33cb76eff 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -133,12 +133,12 @@ void BlockTimer::setLogLock(LLMutex* lock)
//static
#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
-U64 BlockTimer::countsPerSecond() // counts per second for the *32-bit* timer
+U64 BlockTimer::countsPerSecond() // counts per second for the *64-bit* timer
{
- return sClockResolution >> 8;
+ return sClockResolution;
}
#else // windows or x86-mac or x86-linux or x86-solaris
-U64 BlockTimer::countsPerSecond() // counts per second for the *32-bit* timer
+U64 BlockTimer::countsPerSecond() // counts per second for the *64-bit* timer
{
#if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS
//getCPUFrequency returns MHz and sCPUClockFrequency wants to be in Hz
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index e31e36cb27..ff3ae1e553 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -26,6 +26,7 @@
#include "linden_common.h"
#include "lltrace.h"
+#include "llfasttimer.h"
#include "lltracerecording.h"
#include "lltracethreadrecorder.h"
#include "llthread.h"
@@ -142,6 +143,16 @@ void Recording::appendRecording( const Recording& other )
mElapsedSeconds += other.mElapsedSeconds;
}
+LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimerAccumulator>& stat) const
+{
+ return (F64)(*mStackTimers)[stat.getIndex()].mSelfTimeCounter / (F64)LLTrace::BlockTimer::countsPerSecond();
+}
+
+LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimerAccumulator>& stat) const
+{
+ return (F64)(*mStackTimers)[stat.getIndex()].mSelfTimeCounter / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds);
+}
+
F64 Recording::getSum( const TraceType<CountAccumulator<F64> >& stat ) const
{
return (*mCountsFloat)[stat.getIndex()].getSum();
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index e5a21a2d38..0adea2663b 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -118,6 +118,10 @@ namespace LLTrace
void update();
+ // Timer accessors
+ LLUnit<LLUnits::Seconds, F64> getSum(const TraceType<TimerAccumulator>& stat) const;
+ LLUnit<LLUnits::Seconds, F64> getPerSec(const TraceType<TimerAccumulator>& stat) const;
+
// Count accessors
F64 getSum(const TraceType<CountAccumulator<F64> >& stat) const;
S64 getSum(const TraceType<CountAccumulator<S64> >& stat) const;
@@ -273,18 +277,18 @@ namespace LLTrace
Recording& getTotalRecording();
template <typename T>
- typename T getPeriodMin(const TraceType<CountAccumulator<T> >& stat) const
+ typename T::value_t getPeriodMin(const TraceType<T>& stat) const
{
- T min_val = (std::numeric_limits<T>::max)();
+ typename T::value_t min_val = (std::numeric_limits<typename T::value_t>::max)();
for (S32 i = 0; i < mNumPeriods; i++)
{
min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat));
}
- return (T)min_val;
+ return min_val;
}
template <typename T>
- F64 getPeriodMinPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ F64 getPeriodMinPerSec(const TraceType<T>& stat) const
{
F64 min_val = (std::numeric_limits<F64>::max)();
for (S32 i = 0; i < mNumPeriods; i++)
@@ -295,9 +299,9 @@ namespace LLTrace
}
template <typename T>
- T getPeriodMax(const TraceType<CountAccumulator<T> >& stat) const
+ typename T::value_t getPeriodMax(const TraceType<T>& stat) const
{
- T max_val = (std::numeric_limits<T>::min)();
+ typename T::value_t max_val = (std::numeric_limits<typename T::value_t>::min)();
for (S32 i = 0; i < mNumPeriods; i++)
{
max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat));
@@ -306,7 +310,7 @@ namespace LLTrace
}
template <typename T>
- F64 getPeriodMaxPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ F64 getPeriodMaxPerSec(const TraceType<T>& stat) const
{
F64 max_val = (std::numeric_limits<F64>::min)();
for (S32 i = 0; i < mNumPeriods; i++)
@@ -317,7 +321,7 @@ namespace LLTrace
}
template <typename T>
- F64 getPeriodMean(const TraceType<CountAccumulator<T> >& stat) const
+ F64 getPeriodMean(const TraceType<T>& stat) const
{
F64 mean = 0.0;
F64 count = 0;
@@ -334,7 +338,7 @@ namespace LLTrace
}
template <typename T>
- F64 getPeriodMeanPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ F64 getPeriodMeanPerSec(const TraceType<T>& stat) const
{
F64 mean = 0.0;
F64 count = 0;
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 7a5c9dba46..6aca8f4426 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -294,15 +294,17 @@ static std::string get_tooltip(LLTrace::BlockTimer& timer, S32 history_index = -
{
F64 ms_multiplier = 1000.0 / (F64)LLTrace::BlockTimer::countsPerSecond();
+ LLTrace::PeriodicRecording& frame_stats = LLTrace::get_frame_recording();
+
std::string tooltip;
if (history_index < 0)
{
// by default, show average number of call
- tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(timer.getCountAverage() * ms_multiplier), (S32)timer.getCallAverage());
+ tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(frame_stats.getPeriodMean(timer) * ms_multiplier), (S32)timer.getCallAverage());
}
else
{
- tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(timer.getHistoricalCount(history_index) * ms_multiplier), (S32)timer.getHistoricalCalls(history_index));
+ tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)(frame_stats.getPrevRecordingPeriod(history_index).getSum(timer) * ms_multiplier), (S32)timer.getHistoricalCalls(history_index));
}
return tooltip;
}