diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llfasttimer.h | 5 | ||||
-rw-r--r-- | indra/llcommon/lltrace.h | 17 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 11 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.h | 3 |
4 files changed, 36 insertions, 0 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index e3d99a9e4b..b5b4a8d0b4 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -89,6 +89,11 @@ public: return static_cast<TraceType<TimeBlockAccumulator::CallCountAspect>&>(*(TraceType<TimeBlockAccumulator>*)this); } + TraceType<TimeBlockAccumulator::SelfTimeAspect>& selfTime() + { + return static_cast<TraceType<TimeBlockAccumulator::SelfTimeAspect>&>(*(TraceType<TimeBlockAccumulator>*)this); + } + static TimeBlock& getRootTimer(); static void pushLog(LLSD sd); static void setLogLock(LLMutex* mutex); diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 0cb6a84aec..d29d43a92c 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -412,6 +412,11 @@ namespace LLTrace typedef U32 value_t; }; + struct SelfTimeAspect + { + typedef LLUnit<LLUnits::Seconds, F64> value_t; + }; + TimeBlockAccumulator(); void addSamples(const TimeBlockAccumulator& other); void reset(const TimeBlockAccumulator* other); @@ -443,6 +448,18 @@ namespace LLTrace {} }; + template<> + class TraceType<TimeBlockAccumulator::SelfTimeAspect> + : public TraceType<TimeBlockAccumulator> + { + public: + typedef F32 mean_t; + + TraceType(const char* name, const char* description = "") + : TraceType<TimeBlockAccumulator>(name, description) + {} + }; + class TimeBlockTreeNode { public: diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index e9b3376dae..3ea511ff3c 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -145,9 +145,15 @@ void Recording::appendRecording( const Recording& other ) LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) const { + return (F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter / (F64)LLTrace::TimeBlock::countsPerSecond(); +} + +LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const +{ return (F64)(*mStackTimers)[stat.getIndex()].mSelfTimeCounter / (F64)LLTrace::TimeBlock::countsPerSecond(); } + U32 Recording::getSum(const TraceType<TimeBlockAccumulator::CallCountAspect>& stat) const { return (*mStackTimers)[stat.getIndex()].mCalls; @@ -155,6 +161,11 @@ U32 Recording::getSum(const TraceType<TimeBlockAccumulator::CallCountAspect>& st LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccumulator>& stat) const { + return (F64)(*mStackTimers)[stat.getIndex()].mTotalTimeCounter / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds); +} + +LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const +{ return (F64)(*mStackTimers)[stat.getIndex()].mSelfTimeCounter / ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds); } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f92281cea8..f4841214e8 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -120,8 +120,11 @@ namespace LLTrace // Timer accessors LLUnit<LLUnits::Seconds, F64> getSum(const TraceType<TimeBlockAccumulator>& stat) const; + LLUnit<LLUnits::Seconds, F64> getSum(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const; U32 getSum(const TraceType<TimeBlockAccumulator::CallCountAspect>& stat) const; + LLUnit<LLUnits::Seconds, F64> getPerSec(const TraceType<TimeBlockAccumulator>& stat) const; + LLUnit<LLUnits::Seconds, F64> getPerSec(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const; F32 getPerSec(const TraceType<TimeBlockAccumulator::CallCountAspect>& stat) const; // Count accessors |