summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/llfasttimer.cpp30
-rw-r--r--indra/llcommon/llfasttimer.h11
-rw-r--r--indra/llcommon/lltrace.h5
-rw-r--r--indra/llcommon/lltracerecording.cpp8
4 files changed, 21 insertions, 33 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 0ea91d7e51..f8837a7085 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -256,16 +256,12 @@ void TimeBlock::processTimes()
while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer)
{
U64 cumulative_time_delta = cur_time - cur_timer->mStartTime;
- U64 child_time = stack_record->mChildTime
- - (accumulator->mSelfTimeCounter - cur_timer->mStartSelfTimeCounter)
- - (accumulator->mChildTimeCounter - cur_timer->mStartChildTimeCounter);
- accumulator->mChildTimeCounter += child_time;
- accumulator->mSelfTimeCounter += cumulative_time_delta - child_time;
+ accumulator->mTotalTimeCounter += cumulative_time_delta - (accumulator->mTotalTimeCounter - accumulator->mStartTotalTimeCounter);
+ accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime;
stack_record->mChildTime = 0;
cur_timer->mStartTime = cur_time;
- cur_timer->mStartSelfTimeCounter = accumulator->mSelfTimeCounter;
- cur_timer->mStartChildTimeCounter = accumulator->mChildTimeCounter;
+ cur_timer->mStartTotalTimeCounter = accumulator->mTotalTimeCounter;
stack_record = &cur_timer->mParentTimerData;
accumulator = stack_record->mTimeBlock->getPrimaryAccumulator();
@@ -404,10 +400,9 @@ void TimeBlock::writeLog(std::ostream& os)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TimeBlockAccumulator::TimeBlockAccumulator()
-: mChildTimeCounter(0),
+: mTotalTimeCounter(0),
mSelfTimeCounter(0),
- mStartChildTimeCounter(0),
- mStartSelfTimeCounter(0),
+ mStartTotalTimeCounter(0),
mCalls(0),
mLastCaller(NULL),
mActiveCount(0),
@@ -417,8 +412,8 @@ TimeBlockAccumulator::TimeBlockAccumulator()
void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )
{
- mChildTimeCounter += other.mChildTimeCounter - other.mStartChildTimeCounter;
- mSelfTimeCounter += other.mSelfTimeCounter - other.mStartSelfTimeCounter;
+ mTotalTimeCounter += other.mTotalTimeCounter - other.mStartTotalTimeCounter;
+ mSelfTimeCounter += other.mSelfTimeCounter;
mCalls += other.mCalls;
mLastCaller = other.mLastCaller;
mActiveCount = other.mActiveCount;
@@ -429,12 +424,12 @@ void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )
void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other )
{
mCalls = 0;
+ mSelfTimeCounter = 0;
+
if (other)
{
- mStartSelfTimeCounter = other->mSelfTimeCounter;
- mSelfTimeCounter = mStartSelfTimeCounter;
- mStartChildTimeCounter = other->mChildTimeCounter;
- mChildTimeCounter = mStartChildTimeCounter;
+ mStartTotalTimeCounter = other->mTotalTimeCounter;
+ mTotalTimeCounter = mStartTotalTimeCounter;
mLastCaller = other->mLastCaller;
mActiveCount = other->mActiveCount;
@@ -443,8 +438,7 @@ void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other )
}
else
{
- mStartSelfTimeCounter = mSelfTimeCounter;
- mStartChildTimeCounter = mChildTimeCounter;
+ mStartTotalTimeCounter = mTotalTimeCounter;
}
}
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 28e54a37de..ec1720d2df 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -76,8 +76,7 @@ public:
private:
U64 mStartTime;
- U64 mStartSelfTimeCounter;
- U64 mStartChildTimeCounter;
+ U64 mStartTotalTimeCounter;
BlockTimerStackRecord mParentTimerData;
};
@@ -283,8 +282,7 @@ LL_FORCE_INLINE BlockTimer::BlockTimer(TimeBlock& timer)
BlockTimerStackRecord* cur_timer_data = ThreadTimerStack::getIfExists();
TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator();
accumulator->mActiveCount++;
- mStartSelfTimeCounter = accumulator->mSelfTimeCounter;
- mStartChildTimeCounter = accumulator->mChildTimeCounter;
+ mStartTotalTimeCounter = accumulator->mTotalTimeCounter;
// keep current parent as long as it is active when we are
accumulator->mMoveUpTree |= (accumulator->mParent->getPrimaryAccumulator()->mActiveCount == 0);
@@ -304,11 +302,8 @@ LL_FORCE_INLINE BlockTimer::~BlockTimer()
BlockTimerStackRecord* cur_timer_data = ThreadTimerStack::getIfExists();
TimeBlockAccumulator* accumulator = cur_timer_data->mTimeBlock->getPrimaryAccumulator();
- U64 child_time = cur_timer_data->mChildTime
- - (accumulator->mSelfTimeCounter - mStartSelfTimeCounter)
- - (accumulator->mChildTimeCounter - mStartChildTimeCounter);
accumulator->mCalls++;
- accumulator->mChildTimeCounter += child_time;
+ accumulator->mTotalTimeCounter += total_time - (accumulator->mTotalTimeCounter - mStartTotalTimeCounter);
accumulator->mSelfTimeCounter += total_time - cur_timer_data->mChildTime;
accumulator->mActiveCount--;
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 8c3259eea9..5d57327a14 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -444,9 +444,8 @@ namespace LLTrace
//
// members
//
- U64 mStartChildTimeCounter,
- mStartSelfTimeCounter,
- mChildTimeCounter,
+ U64 mStartTotalTimeCounter,
+ mTotalTimeCounter,
mSelfTimeCounter;
U32 mCalls;
class TimeBlock* mParent; // last acknowledged parent of this time block
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 2af9041863..ab8dbce2ce 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -183,14 +183,14 @@ void Recording::mergeRecording( const Recording& other)
LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) const
{
const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()];
- return (F64)(accumulator.mSelfTimeCounter - accumulator.mStartSelfTimeCounter + accumulator.mChildTimeCounter - accumulator.mStartChildTimeCounter)
+ return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter)
/ (F64)LLTrace::TimeBlock::countsPerSecond();
}
LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator::SelfTimeAspect>& stat) const
{
const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()];
- return (F64)(accumulator.mSelfTimeCounter - accumulator.mStartSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond();
+ return (F64)(accumulator.mSelfTimeCounter) / (F64)LLTrace::TimeBlock::countsPerSecond();
}
@@ -203,7 +203,7 @@ LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccu
{
const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()];
- return (F64)(accumulator.mSelfTimeCounter - accumulator.mStartSelfTimeCounter + accumulator.mChildTimeCounter - accumulator.mStartChildTimeCounter)
+ return (F64)(accumulator.mTotalTimeCounter - accumulator.mStartTotalTimeCounter)
/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds);
}
@@ -211,7 +211,7 @@ LLUnit<LLUnits::Seconds, F64> Recording::getPerSec(const TraceType<TimeBlockAccu
{
const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()];
- return (F64)(accumulator.mSelfTimeCounter - accumulator.mStartSelfTimeCounter)
+ return (F64)(accumulator.mSelfTimeCounter)
/ ((F64)LLTrace::TimeBlock::countsPerSecond() * mElapsedSeconds);
}