From a6bb68b6e530df91d03abfc062c700ebc4e856aa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 13 Feb 2013 15:21:20 -0800 Subject: SH-3275 FIX interesting Update viewer metrics system to be more flexible fix for inaccurate optimization of full block time calculations --- indra/llcommon/llfasttimer.cpp | 6 +++--- indra/llcommon/llfasttimer.h | 6 +++--- indra/llcommon/llunit.h | 5 +++-- indra/newview/llfasttimerview.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index f8837a7085..5baf049c03 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -256,12 +256,12 @@ void TimeBlock::processTimes() while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer) { U64 cumulative_time_delta = cur_time - cur_timer->mStartTime; - accumulator->mTotalTimeCounter += cumulative_time_delta - (accumulator->mTotalTimeCounter - accumulator->mStartTotalTimeCounter); + accumulator->mTotalTimeCounter += cumulative_time_delta - (accumulator->mTotalTimeCounter - cur_timer->mBlockStartTotalTimeCounter); accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime; stack_record->mChildTime = 0; cur_timer->mStartTime = cur_time; - cur_timer->mStartTotalTimeCounter = accumulator->mTotalTimeCounter; + cur_timer->mBlockStartTotalTimeCounter = accumulator->mTotalTimeCounter; stack_record = &cur_timer->mParentTimerData; accumulator = stack_record->mTimeBlock->getPrimaryAccumulator(); @@ -376,7 +376,7 @@ void TimeBlock::dumpCurTimes() } out_str << timerp->getName() << " " - << std::setprecision(3) << total_time_ms.as().value() << " ms, " + << std::setprecision(3) << total_time_ms.as().value() << " ms, " << num_calls << " calls"; llinfos << out_str.str() << llendl; diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index ec1720d2df..32a0629a87 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -76,7 +76,7 @@ public: private: U64 mStartTime; - U64 mStartTotalTimeCounter; + U64 mBlockStartTotalTimeCounter; BlockTimerStackRecord mParentTimerData; }; @@ -282,7 +282,7 @@ LL_FORCE_INLINE BlockTimer::BlockTimer(TimeBlock& timer) BlockTimerStackRecord* cur_timer_data = ThreadTimerStack::getIfExists(); TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator(); accumulator->mActiveCount++; - mStartTotalTimeCounter = accumulator->mTotalTimeCounter; + mBlockStartTotalTimeCounter = accumulator->mTotalTimeCounter; // keep current parent as long as it is active when we are accumulator->mMoveUpTree |= (accumulator->mParent->getPrimaryAccumulator()->mActiveCount == 0); @@ -303,7 +303,7 @@ LL_FORCE_INLINE BlockTimer::~BlockTimer() TimeBlockAccumulator* accumulator = cur_timer_data->mTimeBlock->getPrimaryAccumulator(); accumulator->mCalls++; - accumulator->mTotalTimeCounter += total_time - (accumulator->mTotalTimeCounter - mStartTotalTimeCounter); + accumulator->mTotalTimeCounter += total_time - (accumulator->mTotalTimeCounter - mBlockStartTotalTimeCounter); accumulator->mSelfTimeCounter += total_time - cur_timer_data->mChildTime; accumulator->mActiveCount--; diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index c2a31b7604..823550db5d 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -106,11 +106,12 @@ struct LLUnit return mValue; } - template LLUnit as() + template LLUnit as() { - return LLUnit(*this); + return LLUnit(*this); } + void operator += (storage_t value) { mValue += value; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 1a1a4a8b44..3893b0e772 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1403,7 +1403,7 @@ void LLFastTimerView::updateTotalTime() break; } - mTotalTimeDisplay = LLUnit(llceil(mTotalTimeDisplay.as().value() / (20.f)) * 20.f); + mTotalTimeDisplay = LLUnit(llceil(mTotalTimeDisplay.as().value() / 20.f) * 20.f); } void LLFastTimerView::drawBars() -- cgit v1.2.3