Skip to content
Snippets Groups Projects
Commit 4dce574a authored by Richard Linden's avatar Richard Linden
Browse files

SH-3405 WIP convert existing stats to lltrace system

added update() method to trace recorders to allow mid-collection snapshots
parent 3960fdf9
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,12 @@ void Recording::reset() ...@@ -63,6 +63,12 @@ void Recording::reset()
mSamplingTimer.reset(); mSamplingTimer.reset();
} }
void Recording::update()
{
mElapsedSeconds = 0.0;
mSamplingTimer.reset();
}
void Recording::resume() void Recording::resume()
{ {
if (!mIsStarted) if (!mIsStarted)
......
...@@ -61,6 +61,7 @@ namespace LLTrace ...@@ -61,6 +61,7 @@ namespace LLTrace
void mergeDeltas(const Recording& baseline, const Recording& target); void mergeDeltas(const Recording& baseline, const Recording& target);
void reset(); void reset();
void update();
bool isStarted() { return mIsStarted; } bool isStarted() { return mIsStarted; }
......
...@@ -68,10 +68,7 @@ void ThreadRecorder::activate( Recording* recording ) ...@@ -68,10 +68,7 @@ void ThreadRecorder::activate( Recording* recording )
mPrimaryRecording = &mActiveRecordings.front().mBaseline; mPrimaryRecording = &mActiveRecordings.front().mBaseline;
} }
//TODO: consider merging results down the list to one past the buffered item. std::list<ThreadRecorder::ActiveRecording>::iterator ThreadRecorder::update( Recording* recording )
// this would require 2 buffers per sampler, to separate current total from running total
void ThreadRecorder::deactivate( Recording* recording )
{ {
for (std::list<ActiveRecording>::iterator it = mActiveRecordings.begin(), end_it = mActiveRecordings.end(); for (std::list<ActiveRecording>::iterator it = mActiveRecordings.begin(), end_it = mActiveRecordings.end();
it != end_it; it != end_it;
...@@ -92,10 +89,20 @@ void ThreadRecorder::deactivate( Recording* recording ) ...@@ -92,10 +89,20 @@ void ThreadRecorder::deactivate( Recording* recording )
next_it->mBaseline.makePrimary(); next_it->mBaseline.makePrimary();
mPrimaryRecording = &next_it->mBaseline; mPrimaryRecording = &next_it->mBaseline;
} }
mActiveRecordings.erase(it); return it;
break;
} }
} }
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 ) ThreadRecorder::ActiveRecording::ActiveRecording( Recording* source, Recording* target )
......
...@@ -37,6 +37,8 @@ namespace LLTrace ...@@ -37,6 +37,8 @@ namespace LLTrace
{ {
class LL_COMMON_API ThreadRecorder class LL_COMMON_API ThreadRecorder
{ {
protected:
struct ActiveRecording;
public: public:
ThreadRecorder(); ThreadRecorder();
ThreadRecorder(const ThreadRecorder& other); ThreadRecorder(const ThreadRecorder& other);
...@@ -44,6 +46,7 @@ namespace LLTrace ...@@ -44,6 +46,7 @@ namespace LLTrace
virtual ~ThreadRecorder(); virtual ~ThreadRecorder();
void activate(Recording* recording); void activate(Recording* recording);
std::list<struct ActiveRecording>::iterator update(Recording* recording);
void deactivate(Recording* recording); void deactivate(Recording* recording);
virtual void pushToMaster() = 0; virtual void pushToMaster() = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment