diff options
| -rw-r--r-- | indra/llcommon/lltracerecording.cpp | 22 | ||||
| -rw-r--r-- | indra/llcommon/lltracerecording.h | 8 | ||||
| -rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 19 | ||||
| -rw-r--r-- | indra/llcommon/lltracethreadrecorder.h | 3 | 
4 files changed, 37 insertions, 15 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 7cd6280f03..93d2136e7f 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -56,18 +56,28 @@ void Recording::handleReset()  	mSamplingTimer.reset();  } -void Recording::handleStart() +void Recording::update()  { -	mSamplingTimer.reset(); -	LLTrace::get_thread_recorder()->activate(this); +	if (mIsStarted) +	{ +		LLTrace::get_thread_recorder()->update(this); +		mElapsedSeconds = 0.0; +		mSamplingTimer.reset(); +	}  } -void Recording::handleStop() +void Recording::handleStart()  { -	mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); -	LLTrace::get_thread_recorder()->deactivate(this); +		mSamplingTimer.reset(); +		LLTrace::get_thread_recorder()->activate(this);  } +void Recording::handleStop() +	{ +		mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); +		LLTrace::get_thread_recorder()->deactivate(this); +	} +  void Recording::handleSplitTo(Recording& other)  {  	stop(); diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 080007ba00..6e5f118cf6 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -197,7 +197,9 @@ namespace LLTrace  		void mergeSamples(const Recording& other);  		void mergeDeltas(const Recording& baseline, const Recording& target); - +		void reset(); +		void update(); +		  		// Rate accessors  		F32 getSum(const Rate<F32, void>& stat);  		F32 getPerSec(const Rate<F32, void>& stat); @@ -243,7 +245,7 @@ namespace LLTrace  		F64				mElapsedSeconds;  	}; -	class LL_COMMON_API PeriodicRecording  +	class LL_COMMON_API PeriodicRecording  	:	public LLVCRControlsMixin<PeriodicRecording>  	{  	public: @@ -252,7 +254,7 @@ namespace LLTrace  			mCurPeriod(0),  			mTotalValid(false),  			mRecordingPeriods(new Recording[num_periods]) -		{ +	{  			llassert(mNumPeriods > 0);  		} diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 9115a52fd1..b2c6fe3b80 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -68,10 +68,7 @@ void ThreadRecorder::activate( Recording* recording )  	mPrimaryRecording = &mActiveRecordings.front().mBaseline;  } -//TODO: consider merging results down the list to one past the buffered item. -// this would require 2 buffers per sampler, to separate current total from running total - -void ThreadRecorder::deactivate( Recording* recording ) +std::list<ThreadRecorder::ActiveRecording>::iterator ThreadRecorder::update( Recording* recording )  {  	for (std::list<ActiveRecording>::iterator it = mActiveRecordings.begin(), end_it = mActiveRecordings.end();  		it != end_it; @@ -92,10 +89,20 @@ void ThreadRecorder::deactivate( Recording* recording )  				next_it->mBaseline.makePrimary();  				mPrimaryRecording = &next_it->mBaseline;  			} -			mActiveRecordings.erase(it); -			break; +			return it;  		}  	} + +	return mActiveRecordings.end(); +} + +void ThreadRecorder::deactivate( Recording* recording ) +{ +	std::list<ActiveRecording>::iterator it = update(recording); +	if (it != mActiveRecordings.end()) +	{ +		mActiveRecordings.erase(it); +	}  }  ThreadRecorder::ActiveRecording::ActiveRecording( Recording* source, Recording* target )  diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index 40441d0447..42230087c0 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -37,6 +37,8 @@ namespace LLTrace  {  	class LL_COMMON_API ThreadRecorder  	{ +	protected: +		struct ActiveRecording;  	public:  		ThreadRecorder();  		ThreadRecorder(const ThreadRecorder& other); @@ -44,6 +46,7 @@ namespace LLTrace  		virtual ~ThreadRecorder();  		void activate(Recording* recording); +		std::list<struct ActiveRecording>::iterator update(Recording* recording);  		void deactivate(Recording* recording);  		virtual void pushToMaster() = 0;  | 
