SH-3405 WIP convert existing stats to lltrace system

added update() method to trace recorders to allow mid-collection snapshots
master
Richard Linden 2012-10-05 10:51:38 -07:00
parent 3960fdf9e0
commit 4dce574a8d
4 changed files with 23 additions and 6 deletions

View File

@ -63,6 +63,12 @@ void Recording::reset()
mSamplingTimer.reset();
}
void Recording::update()
{
mElapsedSeconds = 0.0;
mSamplingTimer.reset();
}
void Recording::resume()
{
if (!mIsStarted)

View File

@ -61,6 +61,7 @@ namespace LLTrace
void mergeDeltas(const Recording& baseline, const Recording& target);
void reset();
void update();
bool isStarted() { return mIsStarted; }

View File

@ -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 )

View File

@ -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;