summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltracethreadrecorder.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-01-03 00:30:54 -0800
committerRichard Linden <none@none>2013-01-03 00:30:54 -0800
commitcda2cdda511eb2f7a58e284db2c852fd4a3808ae (patch)
tree0dcca3e19c051c827df5c167894f927b2692fe9c /indra/llcommon/lltracethreadrecorder.cpp
parent3fd640a6e3dea7a3551c239323d782fb082e1dbd (diff)
SH-3406 WIP convert fast timers to lltrace system
made fast timer stack thread local added LLThreadLocalSingleton made LLThreadLocalPointer obey pointer rules for const added LLThreadLocalSingletonPointer for fast thread local pointers
Diffstat (limited to 'indra/llcommon/lltracethreadrecorder.cpp')
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 156b0ef26b..9fb789c62d 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -39,18 +39,17 @@ namespace LLTrace
ThreadRecorder::ThreadRecorder()
{
//NB: the ordering of initialization in this function is very fragile due to a large number of implicit dependencies
- get_thread_recorder() = this;
+ set_thread_recorder(this);
+ TimeBlock& root_time_block = TimeBlock::getRootTimeBlock();
- mRootTimerData = new CurTimerData();
- mRootTimerData->mTimerData = &TimeBlock::getRootTimer();
- TimeBlock::sCurTimerData = mRootTimerData;
+ ThreadTimerStack* timer_stack = ThreadTimerStack::getInstance();
+ timer_stack->mTimeBlock = &root_time_block;
+ timer_stack->mActiveTimer = NULL;
mNumTimeBlockTreeNodes = AccumulatorBuffer<TimeBlockAccumulator>::getDefaultBuffer()->size();
mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes];
- mFullRecording.start();
-
- TimeBlock& root_timer = TimeBlock::getRootTimer();
+ mThreadRecording.start();
// initialize time block parent pointers
for (LLInstanceTracker<TimeBlock>::instance_iter it = LLInstanceTracker<TimeBlock>::beginInstances(), end_it = LLInstanceTracker<TimeBlock>::endInstances();
@@ -60,15 +59,15 @@ ThreadRecorder::ThreadRecorder()
TimeBlock& time_block = *it;
TimeBlockTreeNode& tree_node = mTimeBlockTreeNodes[it->getIndex()];
tree_node.mBlock = &time_block;
- tree_node.mParent = &root_timer;
+ tree_node.mParent = &root_time_block;
- it->getPrimaryAccumulator()->mParent = &root_timer;
+ it->getPrimaryAccumulator()->mParent = &root_time_block;
}
- mRootTimer = new BlockTimer(root_timer);
- mRootTimerData->mCurTimer = mRootTimer;
+ mRootTimer = new BlockTimer(root_time_block);
+ timer_stack->mActiveTimer = mRootTimer;
- TimeBlock::getRootTimer().getPrimaryAccumulator()->mActiveCount = 1;
+ TimeBlock::getRootTimeBlock().getPrimaryAccumulator()->mActiveCount = 1;
}
ThreadRecorder::~ThreadRecorder()
@@ -79,9 +78,7 @@ ThreadRecorder::~ThreadRecorder()
{
mActiveRecordings.front().mTargetRecording->stop();
}
- get_thread_recorder() = NULL;
- TimeBlock::sCurTimerData = NULL;
- delete mRootTimerData;
+ set_thread_recorder(NULL);
delete[] mTimeBlockTreeNodes;
}
@@ -196,12 +193,12 @@ SlaveThreadRecorder::~SlaveThreadRecorder()
void SlaveThreadRecorder::pushToMaster()
{
- mFullRecording.stop();
+ mThreadRecording.stop();
{
LLMutexLock(getMasterThreadRecorder().getSlaveListMutex());
- mSharedData.appendFrom(mFullRecording);
+ mSharedData.appendFrom(mThreadRecording);
}
- mFullRecording.start();
+ mThreadRecording.start();
}
void SlaveThreadRecorder::SharedData::appendFrom( const Recording& source )