summaryrefslogtreecommitdiff
path: root/indra/llcommon/lltracerecording.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/lltracerecording.cpp')
-rw-r--r--indra/llcommon/lltracerecording.cpp166
1 files changed, 88 insertions, 78 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 3df06c5172..ef0a633c9c 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -34,13 +34,13 @@
namespace LLTrace
{
+
///////////////////////////////////////////////////////////////////////
-// Recording
+// RecordingBuffers
///////////////////////////////////////////////////////////////////////
-Recording::Recording()
-: mElapsedSeconds(0),
- mCountsFloat(new AccumulatorBuffer<CountAccumulator<F64> >()),
+RecordingBuffers::RecordingBuffers()
+: mCountsFloat(new AccumulatorBuffer<CountAccumulator<F64> >()),
mMeasurementsFloat(new AccumulatorBuffer<MeasurementAccumulator<F64> >()),
mCounts(new AccumulatorBuffer<CountAccumulator<S64> >()),
mMeasurements(new AccumulatorBuffer<MeasurementAccumulator<S64> >()),
@@ -48,71 +48,7 @@ Recording::Recording()
mMemStats(new AccumulatorBuffer<MemStatAccumulator>())
{}
-Recording::Recording( const Recording& other )
-{
- llassert(other.mCountsFloat.notNull());
- mSamplingTimer = other.mSamplingTimer;
- mElapsedSeconds = other.mElapsedSeconds;
- mCountsFloat = other.mCountsFloat;
- mMeasurementsFloat = other.mMeasurementsFloat;
- mCounts = other.mCounts;
- mMeasurements = other.mMeasurements;
- mStackTimers = other.mStackTimers;
- mMemStats = other.mMemStats;
-
- LLStopWatchControlsMixin<Recording>::setPlayState(other.getPlayState());
-}
-
-
-Recording::~Recording()
-{
- stop();
- llassert(isStopped());
-}
-
-void Recording::update()
-{
- if (isStarted())
- {
- LLTrace::get_thread_recorder()->update(this);
- mSamplingTimer.reset();
- }
-}
-
-void Recording::handleReset()
-{
- mCountsFloat.write()->reset();
- mMeasurementsFloat.write()->reset();
- mCounts.write()->reset();
- mMeasurements.write()->reset();
- mStackTimers.write()->reset();
- mMemStats.write()->reset();
-
- mElapsedSeconds = 0.0;
- mSamplingTimer.reset();
-}
-
-void Recording::handleStart()
-{
- mSamplingTimer.reset();
- LLTrace::get_thread_recorder()->activate(this);
-}
-
-void Recording::handleStop()
-{
- mElapsedSeconds += mSamplingTimer.getElapsedTimeF64();
- LLTrace::TimeBlock::processTimes();
- LLTrace::get_thread_recorder()->deactivate(this);
-}
-
-void Recording::handleSplitTo(Recording& other)
-{
- stop();
- other.restart();
- handOffTo(other);
-}
-
-void Recording::handOffTo(Recording& other)
+void RecordingBuffers::handOffTo(RecordingBuffers& other)
{
other.mCountsFloat.write()->reset(mCountsFloat);
other.mMeasurementsFloat.write()->reset(mMeasurementsFloat);
@@ -122,7 +58,7 @@ void Recording::handOffTo(Recording& other)
other.mMemStats.write()->reset(mMemStats);
}
-void Recording::makePrimary()
+void RecordingBuffers::makePrimary()
{
mCountsFloat.write()->makePrimary();
mMeasurementsFloat.write()->makePrimary();
@@ -144,12 +80,12 @@ void Recording::makePrimary()
}
}
-bool Recording::isPrimary() const
+bool RecordingBuffers::isPrimary() const
{
return mCounts->isPrimary();
}
-void Recording::makeUnique()
+void RecordingBuffers::makeUnique()
{
mCountsFloat.makeUnique();
mMeasurementsFloat.makeUnique();
@@ -159,19 +95,17 @@ void Recording::makeUnique()
mMemStats.makeUnique();
}
-void Recording::appendRecording( const Recording& other )
+void RecordingBuffers::appendBuffers( const RecordingBuffers& other )
{
mCountsFloat.write()->addSamples(*other.mCountsFloat);
mMeasurementsFloat.write()->addSamples(*other.mMeasurementsFloat);
mCounts.write()->addSamples(*other.mCounts);
mMeasurements.write()->addSamples(*other.mMeasurements);
mMemStats.write()->addSamples(*other.mMemStats);
-
mStackTimers.write()->addSamples(*other.mStackTimers);
- mElapsedSeconds += other.mElapsedSeconds;
}
-void Recording::mergeRecording( const Recording& other)
+void RecordingBuffers::mergeBuffers( const RecordingBuffers& other)
{
mCountsFloat.write()->addSamples(*other.mCountsFloat);
mMeasurementsFloat.write()->addSamples(*other.mMeasurementsFloat);
@@ -180,6 +114,84 @@ void Recording::mergeRecording( const Recording& other)
mMemStats.write()->addSamples(*other.mMemStats);
}
+void RecordingBuffers::resetBuffers(RecordingBuffers* other)
+{
+ mCountsFloat.write()->reset(other ? other->mCountsFloat : NULL);
+ mMeasurementsFloat.write()->reset(other ? other->mMeasurementsFloat : NULL);
+ mCounts.write()->reset(other ? other->mCounts : NULL);
+ mMeasurements.write()->reset(other ? other->mMeasurements : NULL);
+ mStackTimers.write()->reset(other ? other->mStackTimers : NULL);
+ mMemStats.write()->reset(other ? other->mMemStats : NULL);
+}
+
+///////////////////////////////////////////////////////////////////////
+// Recording
+///////////////////////////////////////////////////////////////////////
+
+Recording::Recording()
+: mElapsedSeconds(0)
+{}
+
+Recording::Recording( const Recording& other )
+{
+ LLStopWatchControlsMixin<Recording>::setPlayState(other.getPlayState());
+}
+
+
+Recording::~Recording()
+{
+ stop();
+ llassert(isStopped());
+}
+
+void Recording::update()
+{
+ if (isStarted())
+ {
+ LLTrace::get_thread_recorder()->update(this);
+ mSamplingTimer.reset();
+ }
+}
+
+void Recording::handleReset()
+{
+ resetBuffers();
+
+ mElapsedSeconds = 0.0;
+ mSamplingTimer.reset();
+}
+
+void Recording::handleStart()
+{
+ mSamplingTimer.reset();
+ LLTrace::get_thread_recorder()->activate(this);
+}
+
+void Recording::handleStop()
+{
+ mElapsedSeconds += mSamplingTimer.getElapsedTimeF64();
+ LLTrace::TimeBlock::processTimes();
+ LLTrace::get_thread_recorder()->deactivate(this);
+}
+
+void Recording::handleSplitTo(Recording& other)
+{
+ stop();
+ other.restart();
+ handOffTo(other);
+}
+
+void Recording::appendRecording( const Recording& other )
+{
+ appendBuffers(other);
+ mElapsedSeconds += other.mElapsedSeconds;
+}
+
+void Recording::mergeRecording( const Recording& other)
+{
+ mergeBuffers(other);
+}
+
LLUnit<LLUnits::Seconds, F64> Recording::getSum(const TraceType<TimeBlockAccumulator>& stat) const
{
const TimeBlockAccumulator& accumulator = (*mStackTimers)[stat.getIndex()];
@@ -356,8 +368,6 @@ U32 Recording::getSampleCount( const TraceType<MeasurementAccumulator<S64> >& st
return (*mMeasurements)[stat.getIndex()].getSampleCount();
}
-
-
///////////////////////////////////////////////////////////////////////
// PeriodicRecording
///////////////////////////////////////////////////////////////////////