diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 0ea91d7e51ca16dcf4afdc97660e0b672bab4c71..f8837a70858a759826b754c2e4b73aa090a090d9 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 28e54a37defca82ace21ffc067e239295f14372d..ec1720d2dfc8f222f9a55dde6b6d4ef20918a16d 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -76,8 +76,7 @@ class BlockTimer 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 8c3259eea94bbde3d59ba6cf847a676fc333e3b7..5d57327a14d21ce5a776aecaa7bccb13bc3bb9a3 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 2af90418637d4d72ba4918321d3790e66ee82e01..ab8dbce2cedf1f2ce2193f0558cfe2cc4c5f9e38 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); }