summaryrefslogtreecommitdiff
path: root/indra/llcommon/llfasttimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/llfasttimer.cpp')
-rw-r--r--indra/llcommon/llfasttimer.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 4387218f5a..0ea91d7e51 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -256,12 +256,16 @@ void TimeBlock::processTimes()
while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer)
{
U64 cumulative_time_delta = cur_time - cur_timer->mStartTime;
-
- accumulator->mChildTimeCounter += stack_record->mChildTime - (accumulator->mSelfTimeCounter - cur_timer->mStartSelfTimeCount);
- accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime;
+ 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;
stack_record->mChildTime = 0;
cur_timer->mStartTime = cur_time;
+ cur_timer->mStartSelfTimeCounter = accumulator->mSelfTimeCounter;
+ cur_timer->mStartChildTimeCounter = accumulator->mChildTimeCounter;
stack_record = &cur_timer->mParentTimerData;
accumulator = stack_record->mTimeBlock->getPrimaryAccumulator();
@@ -402,6 +406,8 @@ void TimeBlock::writeLog(std::ostream& os)
TimeBlockAccumulator::TimeBlockAccumulator()
: mChildTimeCounter(0),
mSelfTimeCounter(0),
+ mStartChildTimeCounter(0),
+ mStartSelfTimeCounter(0),
mCalls(0),
mLastCaller(NULL),
mActiveCount(0),
@@ -411,8 +417,8 @@ TimeBlockAccumulator::TimeBlockAccumulator()
void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )
{
- mChildTimeCounter += other.mChildTimeCounter;
- mSelfTimeCounter += other.mSelfTimeCounter;
+ mChildTimeCounter += other.mChildTimeCounter - other.mStartChildTimeCounter;
+ mSelfTimeCounter += other.mSelfTimeCounter - other.mStartSelfTimeCounter;
mCalls += other.mCalls;
mLastCaller = other.mLastCaller;
mActiveCount = other.mActiveCount;
@@ -422,16 +428,24 @@ void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other )
void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other )
{
- mSelfTimeCounter = 0;
- mChildTimeCounter = 0;
mCalls = 0;
if (other)
{
+ mStartSelfTimeCounter = other->mSelfTimeCounter;
+ mSelfTimeCounter = mStartSelfTimeCounter;
+ mStartChildTimeCounter = other->mChildTimeCounter;
+ mChildTimeCounter = mStartChildTimeCounter;
+
mLastCaller = other->mLastCaller;
mActiveCount = other->mActiveCount;
mMoveUpTree = other->mMoveUpTree;
mParent = other->mParent;
}
+ else
+ {
+ mStartSelfTimeCounter = mSelfTimeCounter;
+ mStartChildTimeCounter = mChildTimeCounter;
+ }
}
LLUnit<LLUnits::Seconds, F64> BlockTimer::getElapsedTime()