diff options
author | Richard Linden <none@none> | 2013-03-11 01:09:48 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-03-11 01:09:48 -0700 |
commit | b9c78533ae701fe6af5263e902f8df93c558e493 (patch) | |
tree | 36959e93cf7d32749b199edb0fb94bcb9ea9464e | |
parent | 24a1ceb25de2b9573eb369a6e0d1811fe594aabb (diff) |
separated RecordingBuffers from Recording to make active recording stack more safe (part 2)
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 26 | ||||
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.h | 6 |
2 files changed, 12 insertions, 20 deletions
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index d540a60308..9bef040cf7 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -118,7 +118,7 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::update( Record if (next_it != mActiveRecordings.end()) { // ...push our gathered data down to it - (*next_it)->mPartialRecording.appendRecording((*it)->mPartialRecording); + (*next_it)->mPartialRecording.appendBuffers((*it)->mPartialRecording); } // copy accumulated measurements into result buffer and clear accumulator (mPartialRecording) @@ -171,16 +171,8 @@ ThreadRecorder::ActiveRecording::ActiveRecording( Recording* target ) void ThreadRecorder::ActiveRecording::moveBaselineToTarget() { - mTargetRecording->mMeasurementsFloat.write()->addSamples(*mPartialRecording.mMeasurementsFloat); - mTargetRecording->mCountsFloat.write()->addSamples(*mPartialRecording.mCountsFloat); - mTargetRecording->mMeasurements.write()->addSamples(*mPartialRecording.mMeasurements); - mTargetRecording->mCounts.write()->addSamples(*mPartialRecording.mCounts); - mTargetRecording->mStackTimers.write()->addSamples(*mPartialRecording.mStackTimers); - mPartialRecording.mMeasurementsFloat.write()->reset(); - mPartialRecording.mCountsFloat.write()->reset(); - mPartialRecording.mMeasurements.write()->reset(); - mPartialRecording.mCounts.write()->reset(); - mPartialRecording.mStackTimers.write()->reset(); + mTargetRecording->appendBuffers(mPartialRecording); + mPartialRecording.resetBuffers(); } @@ -220,16 +212,16 @@ void SlaveThreadRecorder::SharedData::appendTo( Recording& sink ) sink.appendRecording(mRecording); } -void SlaveThreadRecorder::SharedData::mergeFrom( const Recording& source ) +void SlaveThreadRecorder::SharedData::mergeFrom( const RecordingBuffers& source ) { LLMutexLock lock(&mRecordingMutex); - mRecording.mergeRecording(source); + mRecording.mergeBuffers(source); } -void SlaveThreadRecorder::SharedData::mergeTo( Recording& sink ) +void SlaveThreadRecorder::SharedData::mergeTo( RecordingBuffers& sink ) { LLMutexLock lock(&mRecordingMutex); - sink.mergeRecording(mRecording); + sink.mergeBuffers(mRecording); } void SlaveThreadRecorder::SharedData::reset() @@ -251,13 +243,13 @@ void MasterThreadRecorder::pullFromSlaveThreads() LLMutexLock lock(&mSlaveListMutex); - Recording& target_recording = mActiveRecordings.front()->mPartialRecording; + RecordingBuffers& target_recording_buffers = mActiveRecordings.front()->mPartialRecording; for (slave_thread_recorder_list_t::iterator it = mSlaveThreadRecorders.begin(), end_it = mSlaveThreadRecorders.end(); it != end_it; ++it) { // ignore block timing info for now - (*it)->mSharedData.mergeTo(target_recording); + (*it)->mSharedData.mergeTo(target_recording_buffers); (*it)->mSharedData.reset(); } } diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index ee2e04236a..3e24303d92 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -59,7 +59,7 @@ namespace LLTrace ActiveRecording(Recording* target); Recording* mTargetRecording; - Recording mPartialRecording; + RecordingBuffers mPartialRecording; void moveBaselineToTarget(); }; @@ -111,8 +111,8 @@ namespace LLTrace public: void appendFrom(const Recording& source); void appendTo(Recording& sink); - void mergeFrom(const Recording& source); - void mergeTo(Recording& sink); + void mergeFrom(const RecordingBuffers& source); + void mergeTo(RecordingBuffers& sink); void reset(); private: LLMutex mRecordingMutex; |