diff options
Diffstat (limited to 'indra/llcommon/lltrace.cpp')
-rw-r--r-- | indra/llcommon/lltrace.cpp | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index d5911ece25..9cadd70dd8 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -28,6 +28,9 @@ #include "lltrace.h" #include "lltracerecording.h" #include "lltracethreadrecorder.h" +#include "llfasttimer.h" + +static bool sInitialized; namespace LLTrace { @@ -37,6 +40,12 @@ static MasterThreadRecorder* gMasterThreadRecorder = NULL; void init() { gMasterThreadRecorder = new MasterThreadRecorder(); + sInitialized = true; +} + +bool isInitialized() +{ + return sInitialized; } void cleanup() @@ -51,13 +60,51 @@ MasterThreadRecorder& getMasterThreadRecorder() return *gMasterThreadRecorder; } -LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder() +LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder_ptr() { static LLThreadLocalPointer<ThreadRecorder> s_thread_recorder; return s_thread_recorder; +} + +const LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder() +{ + return get_thread_recorder_ptr(); +} +void set_thread_recorder(ThreadRecorder* recorder) +{ + get_thread_recorder_ptr() = recorder; } -BlockTimer::Recorder::StackEntry BlockTimer::sCurRecorder; + +TimeBlockTreeNode::TimeBlockTreeNode() +: mBlock(NULL), + mParent(NULL), + mNeedsSorting(false) +{} + +void TimeBlockTreeNode::setParent( TimeBlock* parent ) +{ + llassert_always(parent != mBlock); + llassert_always(parent != NULL); + + TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(parent->getIndex()); + if (!parent_tree_node) return; + + if (mParent) + { + std::vector<TimeBlock*>& children = mParent->getChildren(); + std::vector<TimeBlock*>::iterator found_it = std::find(children.begin(), children.end(), mBlock); + if (found_it != children.end()) + { + children.erase(found_it); + } + } + + mParent = parent; + mBlock->getPrimaryAccumulator()->mParent = parent; + parent_tree_node->mChildren.push_back(mBlock); + parent_tree_node->mNeedsSorting = true; +} } |