From 6c7825107f6ebb3dd8697a52aeb5d29a93060dc4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Dec 2012 19:10:02 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system added copy constructor to periodic recording to allow snapshot generation in fast timer view fixed build errors --- indra/llcommon/lltrace.h | 4 ++-- indra/llcommon/lltracerecording.cpp | 14 ++++++++++++++ indra/llcommon/lltracerecording.h | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 9e275da647..a6b1b227c9 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -213,10 +213,10 @@ namespace LLTrace : public LLInstanceTracker, std::string> { public: - TraceType(const char* name, const char* description = "") + TraceType(const char* name, const char* description = NULL) : LLInstanceTracker(name), mName(name), - mDescription(description) + mDescription(description ? description : "") { mAccumulatorIndex = AccumulatorBuffer::getDefaultBuffer().reserveSlot(); } diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 0d4d07faf6..7ed7e57570 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -305,6 +305,20 @@ PeriodicRecording::PeriodicRecording( S32 num_periods, EStopWatchState state) initTo(state); } +PeriodicRecording::PeriodicRecording(PeriodicRecording& other) +: mNumPeriods(other.mNumPeriods), + mCurPeriod(other.mCurPeriod), + mTotalValid(other.mTotalValid), + mTotalRecording(other.mTotalRecording) +{ + mRecordingPeriods = new Recording[mNumPeriods]; + for (S32 i = 0; i < mNumPeriods; i++) + { + mRecordingPeriods[i] = other.mRecordingPeriods[i]; + } +} + + PeriodicRecording::~PeriodicRecording() { delete[] mRecordingPeriods; diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index efed3f662e..a3af215dd3 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -234,6 +234,7 @@ namespace LLTrace { public: PeriodicRecording(S32 num_periods, EStopWatchState state = STOPPED); + PeriodicRecording(PeriodicRecording& recording); ~PeriodicRecording(); void nextPeriod(); @@ -261,11 +262,13 @@ namespace LLTrace Recording& getPrevRecordingPeriod(S32 offset) { + offset = llclamp(offset, 0, mNumPeriods - 1); return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; } const Recording& getPrevRecordingPeriod(S32 offset) const { + offset = llclamp(offset, 0, mNumPeriods - 1); return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; } -- cgit v1.2.3