diff options
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-x | indra/llcommon/llerror.cpp | 92 | ||||
-rwxr-xr-x | indra/llcommon/llerror.h | 2 | ||||
-rwxr-xr-x | indra/llcommon/llfasttimer.cpp | 72 | ||||
-rwxr-xr-x | indra/llcommon/llstl.h | 1 |
4 files changed, 84 insertions, 83 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 96dbaa572a..a7963174ad 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -145,7 +145,7 @@ namespace { { mWantsTime = timestamp; } - + virtual void recordMessage(LLError::ELevel level, const std::string& message) { @@ -418,21 +418,21 @@ namespace LLError bool mPrintLocation; LLError::ELevel mDefaultLevel; - + LevelMap mFunctionLevelMap; LevelMap mClassLevelMap; LevelMap mFileLevelMap; LevelMap mTagLevelMap; std::map<std::string, unsigned int> mUniqueLogMessages; - + LLError::FatalFunction mCrashFunction; LLError::TimeFunction mTimeFunction; - + Recorders mRecorders; Recorder* mFileRecorder; Recorder* mFixedBufferRecorder; std::string mFileRecorderFileName; - + int mShouldLogCallCounter; static Settings& get(); @@ -450,12 +450,12 @@ namespace LLError mFileRecorder(NULL), mFixedBufferRecorder(NULL), mShouldLogCallCounter(0) - {} + { } ~Settings() { - for_each(mRecorders.begin(), mRecorders.end(), - DeletePointer()); + for_each(mRecorders.begin(), mRecorders.end(), DeletePointer()); + mRecorders.clear(); } static Settings*& getPtr(); @@ -806,7 +806,7 @@ namespace LLError {} Recorder::~Recorder() - {} + { } bool Recorder::wantsTime() { @@ -923,7 +923,7 @@ namespace ++i) { LLError::Recorder* r = *i; - + std::ostringstream message_stream; if (show_location && (r->wantsLocation() || level == LLError::LEVEL_ERROR || s.mPrintLocation)) @@ -937,10 +937,10 @@ namespace } if (show_level && r->wantsLevel()) - { + { message_stream << site.mLevelString << " "; - } - + } + if (show_tags && r->wantsTags()) { message_stream << site.mTagString << " "; @@ -969,7 +969,7 @@ namespace { return stop_checking = false; } - level = i->second; + level = i->second; return stop_checking = true; } @@ -998,7 +998,7 @@ namespace { } return found_level; } - + class LogLock { public: @@ -1064,7 +1064,7 @@ namespace LLError Settings& s = Settings::get(); s.mShouldLogCallCounter++; - + const std::string& class_name = className(site.mClassInfo); std::string function_name = functionName(site.mFunction); #if LL_LINUX @@ -1128,7 +1128,7 @@ namespace LLError else { strncpy(message, out->str().c_str(), 127); - message[127] = '\0'; + message[127] = '\0' ; } Globals& g = Globals::get(); @@ -1143,7 +1143,7 @@ namespace LLError { delete out; } - return; + return ; } void Log::flush(std::ostringstream* out, const CallSite& site) @@ -1175,7 +1175,7 @@ namespace LLError } std::ostringstream message_stream; - + if (site.mPrintOnce) { std::map<std::string, unsigned int>::iterator messageIter = s.mUniqueLogMessages.find(message); @@ -1237,7 +1237,7 @@ namespace LLError { std::string::size_type i = 0; std::string::size_type len = s.length(); - for (; i < len; i++ ) + for ( ; i < len; i++ ) { if (s[i] == old) { @@ -1308,8 +1308,8 @@ namespace LLError namespace LLError { - char** LLCallStacks::sBuffer = NULL; - S32 LLCallStacks::sIndex = 0; + char** LLCallStacks::sBuffer = NULL ; + S32 LLCallStacks::sIndex = 0 ; #define SINGLE_THREADED 1 @@ -1385,34 +1385,34 @@ namespace LLError if(!sBuffer) { - sBuffer = new char*[512]; - sBuffer[0] = new char[512 * 128]; - for(S32 i = 1; i < 512; i++) + sBuffer = new char*[512] ; + sBuffer[0] = new char[512 * 128] ; + for(S32 i = 1 ; i < 512 ; i++) { - sBuffer[i] = sBuffer[i-1] + 128; + sBuffer[i] = sBuffer[i-1] + 128 ; } - sIndex = 0; + sIndex = 0 ; } if(sIndex > 511) { - clear(); + clear() ; } - strcpy(sBuffer[sIndex], function); - sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line); - sIndex++; + strcpy(sBuffer[sIndex], function) ; + sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ; + sIndex++ ; - return; + return ; } //static std::ostringstream* LLCallStacks::insert(const char* function, const int line) { std::ostringstream* _out = LLError::Log::out(); - *_out << function << " line " << line << " "; + *_out << function << " line " << line << " " ; - return _out; + return _out ; } //static @@ -1426,21 +1426,21 @@ namespace LLError if(!sBuffer) { - sBuffer = new char*[512]; - sBuffer[0] = new char[512 * 128]; - for(S32 i = 1; i < 512; i++) + sBuffer = new char*[512] ; + sBuffer[0] = new char[512 * 128] ; + for(S32 i = 1 ; i < 512 ; i++) { - sBuffer[i] = sBuffer[i-1] + 128; + sBuffer[i] = sBuffer[i-1] + 128 ; } - sIndex = 0; + sIndex = 0 ; } if(sIndex > 511) { - clear(); + clear() ; } - LLError::Log::flush(_out, sBuffer[sIndex++]); + LLError::Log::flush(_out, sBuffer[sIndex++]) ; } //static @@ -1457,7 +1457,7 @@ namespace LLError LL_INFOS() << " ************* PRINT OUT LL CALL STACKS ************* " << LL_ENDL; while(sIndex > 0) { - sIndex--; + sIndex-- ; LL_INFOS() << sBuffer[sIndex] << LL_ENDL; } LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL; @@ -1465,16 +1465,16 @@ namespace LLError if(sBuffer) { - delete[] sBuffer[0]; - delete[] sBuffer; - sBuffer = NULL; + delete[] sBuffer[0] ; + delete[] sBuffer ; + sBuffer = NULL ; } } //static void LLCallStacks::clear() { - sIndex = 0; + sIndex = 0 ; } } diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 2ee44130fc..bc80e64423 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -306,7 +306,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; // this macro uses a one-shot do statement to avoid parsing errors when writing control flow statements // without braces: -// if (condition) LL_INFOS() << "True" << LLENDL; else LL_INFOS()() << "False" << LLENDL +// if (condition) LL_INFOS() << "True" << LL_ENDL; else LL_INFOS()() << "False" << LL_ENDL #define lllog(level, once, ...) \ do { \ 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; diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 143e71f40c..02f10fa2ba 100755 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -98,6 +98,7 @@ struct DeletePointerArray // The general form is: // // std::for_each(somemap.begin(), somemap.end(), DeletePairedPointer()); +// somemap.clear(); // Don't leave dangling pointers around struct DeletePairedPointer { |