diff options
Diffstat (limited to 'indra/llcommon/llfasttimer.cpp')
-rwxr-xr-x | indra/llcommon/llfasttimer.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index d46e257af7..3d28cd15b0 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -98,44 +98,44 @@ block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post() } block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id) -{ +{ return block_timer_tree_bf_iterator_t(&id, boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); } block_timer_tree_bf_iterator_t end_block_timer_tree_bf() -{ + { return block_timer_tree_bf_iterator_t(); -} + } block_timer_tree_df_iterator_t begin_timer_tree(BlockTimerStatHandle& id) -{ + { return block_timer_tree_df_iterator_t(&id, boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); -} + } block_timer_tree_df_iterator_t end_timer_tree() -{ + { return block_timer_tree_df_iterator_t(); } // sort child timers by name struct SortTimerByName -{ - bool operator()(const BlockTimerStatHandle* i1, const BlockTimerStatHandle* i2) { + bool operator()(const BlockTimerStatHandle* i1, const BlockTimerStatHandle* i2) + { return i1->getName() < i2->getName(); - } + } }; static BlockTimerStatHandle sRootTimer("root", NULL); BlockTimerStatHandle& BlockTimer::getRootTimeBlock() { return sRootTimer; -} + } void BlockTimer::pushLog(LLSD log) { @@ -203,17 +203,17 @@ void BlockTimer::bootstrapTimerTree() // bootstrap tree construction by attaching to last timer to be on stack // when this timer was called if (timer.getParent() == &BlockTimer::getRootTimeBlock()) - { +{ TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); if (accumulator.mLastCaller) - { + { 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; - } + } } } @@ -231,37 +231,37 @@ void BlockTimer::incrementalUpdateTimerTree() // sort timers by time last called, so call graph makes sense TimeBlockTreeNode& tree_node = timerp->getTreeNode(); if (tree_node.mNeedsSorting) - { +{ std::sort(tree_node.mChildren.begin(), tree_node.mChildren.end(), SortTimerByName()); - } +} // skip root timer if (timerp != &BlockTimer::getRootTimeBlock()) - { +{ TimeBlockAccumulator& accumulator = timerp->getCurrentAccumulator(); if (accumulator.mMoveUpTree) - { +{ // since ancestors have already been visited, re-parenting won't affect tree traversal - //step up tree, bringing our descendants with us - LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() << - " to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL; - timerp->setParent(timerp->getParent()->getParent()); + //step up tree, bringing our descendants with us + LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() << + " to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL; + timerp->setParent(timerp->getParent()->getParent()); accumulator.mParent = timerp->getParent(); accumulator.mMoveUpTree = false; - // don't bubble up any ancestors until descendants are done bubbling up + // don't bubble up any ancestors until descendants are done bubbling up // as ancestors may call this timer only on certain paths, so we want to resolve // child-most block locations before their parents - it.skipAncestors(); - } + it.skipAncestors(); } } + } } void BlockTimer::updateTimes() -{ + { // walk up stack of active timers and accumulate current time while leaving timing structures active BlockTimerStackRecord* stack_record = LLThreadLocalSingletonPointer<BlockTimerStackRecord>::getInstance(); if (!stack_record) return; @@ -272,7 +272,7 @@ void BlockTimer::updateTimes() while(cur_timer && cur_timer->mParentTimerData.mActiveTimer != cur_timer) // root defined by parent pointing to self - { + { U64 cumulative_time_delta = cur_time - cur_timer->mStartTime; cur_timer->mStartTime = cur_time; @@ -321,19 +321,19 @@ void BlockTimer::processTimes() } std::vector<BlockTimerStatHandle*>::iterator BlockTimerStatHandle::beginChildren() -{ + { return getTreeNode().mChildren.begin(); -} + } std::vector<BlockTimerStatHandle*>::iterator BlockTimerStatHandle::endChildren() -{ + { return getTreeNode().mChildren.end(); } std::vector<BlockTimerStatHandle*>& BlockTimerStatHandle::getChildren() { return getTreeNode().mChildren; -} + } bool BlockTimerStatHandle::hasChildren() { @@ -376,7 +376,7 @@ void BlockTimer::logStats() // doesn't work correctly on the first frame total_time += frame_recording.getLastRecording().getSum(timer); } -} + } sd["Total"]["Time"] = (LLSD::Real) total_time.value(); sd["Total"]["Calls"] = (LLSD::Integer) 1; @@ -385,7 +385,7 @@ void BlockTimer::logStats() LLMutexLock lock(sLogLock); sLogQueue.push(sd); } -} + } } @@ -420,10 +420,10 @@ void BlockTimer::dumpCurTimes() << num_calls << " calls"; LL_INFOS() << out_str.str() << LL_ENDL; - } +} } -//static +//static void BlockTimer::writeLog(std::ostream& os) { while (!sLogQueue.empty()) @@ -472,7 +472,7 @@ void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other ) mTotalTimeCounter = 0; if (other) - { +{ mLastCaller = other->mLastCaller; mActiveCount = other->mActiveCount; mMoveUpTree = other->mMoveUpTree; |