summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltrace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/lltrace.cpp')
-rw-r--r--indra/llcommon/lltrace.cpp71
1 files changed, 70 insertions, 1 deletions
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index 8cedcafd10..24a2b33a5f 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -72,7 +72,7 @@ void Sampler::resume()
getThreadTrace()->activate(this);
}
-class ThreadTraceData* Sampler::getThreadTrace()
+class ThreadTrace* Sampler::getThreadTrace()
{
return LLThread::getTraceData();
}
@@ -81,6 +81,64 @@ class ThreadTraceData* Sampler::getThreadTrace()
// MasterThreadTrace
///////////////////////////////////////////////////////////////////////
+ThreadTrace::ThreadTrace()
+{
+ mPrimarySampler.makePrimary();
+}
+
+ThreadTrace::ThreadTrace( const ThreadTrace& other ) : mPrimarySampler(other.mPrimarySampler)
+{
+ mPrimarySampler.makePrimary();
+}
+
+void ThreadTrace::activate( Sampler* sampler )
+{
+ flushPrimary();
+ mActiveSamplers.push_back(sampler);
+}
+
+void ThreadTrace::deactivate( Sampler* sampler )
+{
+ sampler->mergeFrom(mPrimarySampler);
+
+ // TODO: replace with intrusive list
+ std::list<Sampler*>::iterator found_it = std::find(mActiveSamplers.begin(), mActiveSamplers.end(), sampler);
+ if (found_it != mActiveSamplers.end())
+ {
+ mActiveSamplers.erase(found_it);
+ }
+}
+
+void ThreadTrace::flushPrimary()
+{
+ for (std::list<Sampler*>::iterator it = mActiveSamplers.begin(), end_it = mActiveSamplers.end();
+ it != end_it;
+ ++it)
+ {
+ (*it)->mergeFrom(mPrimarySampler);
+ }
+ mPrimarySampler.reset();
+}
+
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////
+// SlaveThreadTrace
+///////////////////////////////////////////////////////////////////////
+
+void SlaveThreadTrace::pushToMaster()
+{
+ mSharedData.copyFrom(mPrimarySampler);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+// MasterThreadTrace
+///////////////////////////////////////////////////////////////////////
+
void MasterThreadTrace::pullFromSlaveThreads()
{
LLMutexLock lock(&mSlaveListMutex);
@@ -116,5 +174,16 @@ void MasterThreadTrace::removeSlaveThread( class SlaveThreadTrace* child )
}
}
+void MasterThreadTrace::pushToMaster()
+{
+
+}
+
+MasterThreadTrace::MasterThreadTrace()
+{
+ LLThread::setTraceData(this);
+}
+
+
}