diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llfasttimer.cpp | 26 | ||||
-rw-r--r-- | indra/llcommon/llfasttimer.h | 15 | ||||
-rw-r--r-- | indra/llcommon/lltrace.h | 3 | ||||
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 10 |
4 files changed, 21 insertions, 33 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index b4a422816e..ea4e1a89a2 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -198,12 +198,10 @@ void TimeBlock::processTimes() { TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator(); - if (accumulator->mLastAccumulator) + if (accumulator->mLastCaller) { - TimeBlock* parent = accumulator->mLastAccumulator->mBlock; - llassert(parent); - timer.setParent(parent); - accumulator->mParent = parent; + timer.setParent(accumulator->mLastCaller); + accumulator->mParent = accumulator->mLastCaller; } // no need to push up tree on first use, flag can be set spuriously accumulator->mMoveUpTree = false; @@ -252,10 +250,8 @@ void TimeBlock::processTimes() // walk up stack of active timers and accumulate current time while leaving timing structures active BlockTimerStackRecord* stack_record = ThreadTimerStack::getInstance(); BlockTimer* cur_timer = stack_record->mActiveTimer; - TimeBlockAccumulator* accumulator = stack_record->mAccumulator; - - llassert(accumulator); - + TimeBlockAccumulator* accumulator = stack_record->mTimeBlock->getPrimaryAccumulator(); + // root defined by parent pointing to self while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer) { @@ -268,7 +264,7 @@ void TimeBlock::processTimes() cur_timer->mStartTime = cur_time; stack_record = &cur_timer->mParentTimerData; - accumulator = stack_record->mAccumulator; + accumulator = stack_record->mTimeBlock->getPrimaryAccumulator(); cur_timer = stack_record->mActiveTimer; stack_record->mChildTime += cumulative_time_delta; @@ -284,7 +280,7 @@ void TimeBlock::processTimes() TimeBlock& timer = *it; TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator(); - accumulator->mLastAccumulator = NULL; + accumulator->mLastCaller = NULL; accumulator->mMoveUpTree = false; } @@ -422,11 +418,10 @@ TimeBlockAccumulator::TimeBlockAccumulator() : mChildTimeCounter(0), mTotalTimeCounter(0), mCalls(0), - mLastAccumulator(NULL), + mLastCaller(NULL), mActiveCount(0), mMoveUpTree(false), - mParent(NULL), - mBlock(NULL) + mParent(NULL) {} void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other ) @@ -434,11 +429,10 @@ void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other ) mChildTimeCounter += other.mChildTimeCounter; mTotalTimeCounter += other.mTotalTimeCounter; mCalls += other.mCalls; - mLastAccumulator = other.mLastAccumulator; + mLastCaller = other.mLastCaller; mActiveCount = other.mActiveCount; mMoveUpTree = other.mMoveUpTree; mParent = other.mParent; - mBlock = other.mBlock; } void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other ) diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 06de8ea6ee..726db70fbe 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -40,9 +40,9 @@ namespace LLTrace struct BlockTimerStackRecord { - class BlockTimer* mActiveTimer; - class TimeBlockAccumulator* mAccumulator; - U64 mChildTime; + class BlockTimer* mActiveTimer; + class TimeBlock* mTimeBlock; + U64 mChildTime; }; class ThreadTimerStack @@ -73,7 +73,7 @@ public: private: - U64 mStartTime; + U64 mStartTime; BlockTimerStackRecord mParentTimerData; }; @@ -280,14 +280,13 @@ LL_FORCE_INLINE BlockTimer::BlockTimer(TimeBlock& timer) TimeBlockAccumulator* accumulator = timer.getPrimaryAccumulator(); accumulator->mActiveCount++; // keep current parent as long as it is active when we are - llassert(accumulator->mParent); accumulator->mMoveUpTree |= (accumulator->mParent->getPrimaryAccumulator()->mActiveCount == 0); // store top of stack mParentTimerData = *cur_timer_data; // push new information cur_timer_data->mActiveTimer = this; - cur_timer_data->mAccumulator = accumulator; + cur_timer_data->mTimeBlock = &timer; cur_timer_data->mChildTime = 0; #endif } @@ -297,7 +296,7 @@ LL_FORCE_INLINE BlockTimer::~BlockTimer() #if FAST_TIMER_ON U64 total_time = TimeBlock::getCPUClockCount64() - mStartTime; BlockTimerStackRecord* cur_timer_data = ThreadTimerStack::getIfExists(); - TimeBlockAccumulator* accumulator = cur_timer_data->mAccumulator; + TimeBlockAccumulator* accumulator = cur_timer_data->mTimeBlock->getPrimaryAccumulator(); accumulator->mCalls++; accumulator->mChildTimeCounter += cur_timer_data->mChildTime; @@ -306,7 +305,7 @@ LL_FORCE_INLINE BlockTimer::~BlockTimer() // store last caller to bootstrap tree creation // do this in the destructor in case of recursion to get topmost caller - accumulator->mLastAccumulator = mParentTimerData.mAccumulator; + accumulator->mLastCaller = mParentTimerData.mTimeBlock; // we are only tracking self time, so subtract our total time delta from parents mParentTimerData.mChildTime += total_time; diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 1d3c376a58..0f927bad53 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -449,9 +449,8 @@ namespace LLTrace U64 mChildTimeCounter, mTotalTimeCounter; U32 mCalls; - class TimeBlock* mBlock; // block associated with this accumulator class TimeBlock* mParent; // last acknowledged parent of this time block - TimeBlockAccumulator* mLastAccumulator; // used to bootstrap tree construction + class TimeBlock* mLastCaller; // used to bootstrap tree construction U16 mActiveCount; // number of timers with this ID active on stack bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 7c5995a104..7b493a651e 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -43,16 +43,14 @@ ThreadRecorder::ThreadRecorder() TimeBlock& root_time_block = TimeBlock::getRootTimeBlock(); ThreadTimerStack* timer_stack = ThreadTimerStack::getInstance(); + timer_stack->mTimeBlock = &root_time_block; + timer_stack->mActiveTimer = NULL; mNumTimeBlockTreeNodes = AccumulatorBuffer<TimeBlockAccumulator>::getDefaultBuffer()->size(); mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes]; mThreadRecording.start(); - timer_stack->mAccumulator = root_time_block.getPrimaryAccumulator(); - timer_stack->mActiveTimer = NULL; - - // initialize time block parent pointers for (LLInstanceTracker<TimeBlock>::instance_iter it = LLInstanceTracker<TimeBlock>::beginInstances(), end_it = LLInstanceTracker<TimeBlock>::endInstances(); it != end_it; @@ -63,9 +61,7 @@ ThreadRecorder::ThreadRecorder() tree_node.mBlock = &time_block; tree_node.mParent = &root_time_block; - TimeBlockAccumulator* accumulator = it->getPrimaryAccumulator(); - accumulator->mParent = &root_time_block; - accumulator->mBlock = &time_block; + it->getPrimaryAccumulator()->mParent = &root_time_block; } mRootTimer = new BlockTimer(root_time_block); |