From dbe9742703cf14db85ec3d16c540efc68dce95a6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 2 Oct 2012 15:37:16 -0700 Subject: SH-3404 create sampler class renamed LLTrace::ThreadTrace to LLTrace::ThreadRecorder renamed LLTrace::Sampler to LLTrace::Recording --- indra/llcommon/lltracerecording.h | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 indra/llcommon/lltracerecording.h (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h new file mode 100644 index 0000000000..83dc503ea6 --- /dev/null +++ b/indra/llcommon/lltracerecording.h @@ -0,0 +1,100 @@ +/** + * @file lltracerecording.h + * @brief Sampling object for collecting runtime statistics originating from lltrace. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACERECORDING_H +#define LL_LLTRACERECORDING_H + +#include "stdtypes.h" +#include "llpreprocessor.h" + +#include "llpointer.h" +#include "lltimer.h" + +namespace LLTrace +{ + template class Rate; + template class Measurement; + template class AccumulatorBuffer; + template class RateAccumulator; + template class MeasurementAccumulator; + class TimerAccumulator; + + class LL_COMMON_API Recording + { + public: + Recording(); + + ~Recording(); + + void makePrimary(); + bool isPrimary(); + + void start(); + void stop(); + void resume(); + + void mergeSamples(const Recording& other); + void initDeltas(const Recording& other); + void mergeDeltas(const Recording& other); + + void reset(); + + bool isStarted() { return mIsStarted; } + + F32 getSum(Rate& stat); + F32 getPerSec(Rate& stat); + + F32 getSum(Measurement& stat); + F32 getMin(Measurement& stat); + F32 getMax(Measurement& stat); + F32 getMean(Measurement& stat); + F32 getStandardDeviation(Measurement& stat); + + F64 getSampleTime() { return mElapsedSeconds; } + + private: + friend class ThreadRecorder; + // returns data for current thread + class ThreadRecorder* getThreadRecorder(); + + LLCopyOnWritePointer > > mRatesStart; + LLCopyOnWritePointer > > mRates; + LLCopyOnWritePointer > > mMeasurements; + LLCopyOnWritePointer > mStackTimersStart; + LLCopyOnWritePointer > mStackTimers; + + bool mIsStarted; + LLTimer mSamplingTimer; + F64 mElapsedSeconds; + }; + + class LL_COMMON_API PeriodicRecording + { + + }; +} + +#endif // LL_LLTRACERECORDING_H -- cgit v1.2.3 From 7196619b4a0823a332e10b7f98464a1649e0dfd2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 2 Oct 2012 17:14:12 -0700 Subject: SH-3275 WIP Update viewer metrics system to be more flexible implemented minimal merging logic made recordings ligher weight by moving live tracking data into threadrecorder --- indra/llcommon/lltracerecording.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 83dc503ea6..0a54e4cedf 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -57,8 +57,7 @@ namespace LLTrace void resume(); void mergeSamples(const Recording& other); - void initDeltas(const Recording& other); - void mergeDeltas(const Recording& other); + void mergeDeltas(const Recording& baseline, const Recording& target); void reset(); @@ -80,10 +79,8 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLCopyOnWritePointer > > mRatesStart; LLCopyOnWritePointer > > mRates; LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimersStart; LLCopyOnWritePointer > mStackTimers; bool mIsStarted; -- cgit v1.2.3 From 8f5e83789254d19a1a31737b0d7515cd7e967b26 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 3 Oct 2012 19:32:59 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system SH-3403 FIX implement unit conversion LLUnit implements unit tracking and conversion added support for LLUnit to LLTrace duplicated most llstats into LLTrace equivalents --- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 0a54e4cedf..4d5793014f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -35,8 +35,8 @@ namespace LLTrace { - template class Rate; - template class Measurement; + template class Rate; + template class Measurement; template class AccumulatorBuffer; template class RateAccumulator; template class MeasurementAccumulator; @@ -63,14 +63,14 @@ namespace LLTrace bool isStarted() { return mIsStarted; } - F32 getSum(Rate& stat); - F32 getPerSec(Rate& stat); + F32 getSum(Rate& stat); + F32 getPerSec(Rate& stat); - F32 getSum(Measurement& stat); - F32 getMin(Measurement& stat); - F32 getMax(Measurement& stat); - F32 getMean(Measurement& stat); - F32 getStandardDeviation(Measurement& stat); + F32 getSum(Measurement& stat); + F32 getMin(Measurement& stat); + F32 getMax(Measurement& stat); + F32 getMean(Measurement& stat); + F32 getStandardDeviation(Measurement& stat); F64 getSampleTime() { return mElapsedSeconds; } -- cgit v1.2.3 From 3960fdf9e01619ddfd7903bcdd8d894f432752d0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 4 Oct 2012 23:11:57 -0700 Subject: SH-3275 WIP Update viewer metrics system to be more flexible moved threadrecorder classes into separate file added Count trace type, which tracks value increases and decreases and can report churn as well as overall growth rate --- indra/llcommon/lltracerecording.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4d5793014f..f9bc6b61b2 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -37,6 +37,7 @@ namespace LLTrace { template class Rate; template class Measurement; + template class Count; template class AccumulatorBuffer; template class RateAccumulator; template class MeasurementAccumulator; @@ -63,14 +64,27 @@ namespace LLTrace bool isStarted() { return mIsStarted; } - F32 getSum(Rate& stat); - F32 getPerSec(Rate& stat); - - F32 getSum(Measurement& stat); - F32 getMin(Measurement& stat); - F32 getMax(Measurement& stat); - F32 getMean(Measurement& stat); - F32 getStandardDeviation(Measurement& stat); + // Rate accessors + F32 getSum(const Rate& stat); + F32 getPerSec(const Rate& stat); + + // Measurement accessors + F32 getSum(const Measurement& stat); + F32 getPerSec(const Measurement& stat); + F32 getMin(const Measurement& stat); + F32 getMax(const Measurement& stat); + F32 getMean(const Measurement& stat); + F32 getStandardDeviation(const Measurement& stat); + + // Count accessors + F32 getSum(const Count& stat); + F32 getPerSec(const Count& stat); + F32 getIncrease(const Count& stat); + F32 getIncreasePerSec(const Count& stat); + F32 getDecrease(const Count& stat); + F32 getDecreasePerSec(const Count& stat); + F32 getChurn(const Count& stat); + F32 getChurnPerSec(const Count& stat); F64 getSampleTime() { return mElapsedSeconds; } -- cgit v1.2.3 From 4dce574a8d604a501ec3c12eef3f5d03ee188473 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 5 Oct 2012 10:51:38 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system added update() method to trace recorders to allow mid-collection snapshots --- indra/llcommon/lltracerecording.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f9bc6b61b2..4d53cd9600 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -61,6 +61,7 @@ namespace LLTrace void mergeDeltas(const Recording& baseline, const Recording& target); void reset(); + void update(); bool isStarted() { return mIsStarted; } -- cgit v1.2.3 From aff9654c1115b4a74fc3ee8f9ca2c2ffa07f8d73 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Oct 2012 18:02:47 -0700 Subject: SH-3275 WIP Update viewer metrics system to be more flexible added PeriodicRecorder class for frame by frame stats accumulation --- indra/llcommon/lltracerecording.h | 247 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 237 insertions(+), 10 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f9bc6b61b2..080007ba00 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -33,6 +33,147 @@ #include "llpointer.h" #include "lltimer.h" +template +class LL_COMMON_API LLVCRControlsMixinInterface +{ +public: + virtual ~LLVCRControlsMixinInterface() {} + // trigger data accumulation (without reset) + virtual void handleStart() = 0; + // stop data accumulation, should put object in queryable state + virtual void handleStop() = 0; + // clear accumulated values, can be called while started + virtual void handleReset() = 0; + // atomically stop this object while starting the other + // no data can be missed in between stop and start + virtual void handleSplitTo(DERIVED& other) = 0; +}; + +template +class LL_COMMON_API LLVCRControlsMixin +: private LLVCRControlsMixinInterface +{ +public: + enum EPlayState + { + STOPPED, + PAUSED, + STARTED + }; + + void start() + { + switch (mPlayState) + { + case STOPPED: + handleReset(); + handleStart(); + break; + case PAUSED: + handleStart(); + break; + case STARTED: + handleReset(); + break; + } + mPlayState = STARTED; + } + + void stop() + { + switch (mPlayState) + { + case STOPPED: + break; + case PAUSED: + handleStop(); + break; + case STARTED: + break; + } + mPlayState = STOPPED; + } + + void pause() + { + switch (mPlayState) + { + case STOPPED: + break; + case PAUSED: + break; + case STARTED: + handleStop(); + break; + } + mPlayState = PAUSED; + } + + void resume() + { + switch (mPlayState) + { + case STOPPED: + handleStart(); + break; + case PAUSED: + handleStart(); + break; + case STARTED: + break; + } + mPlayState = STARTED; + } + + void restart() + { + switch (mPlayState) + { + case STOPPED: + handleReset(); + handleStart(); + break; + case PAUSED: + handleReset(); + handleStart(); + break; + case STARTED: + handleReset(); + break; + } + mPlayState = STARTED; + } + + void reset() + { + handleReset(); + } + + void splitTo(DERIVED& other) + { + onSplitTo(other); + } + + void splitFrom(DERIVED& other) + { + other.onSplitTo(*this); + } + + bool isStarted() { return mPlayState == STARTED; } + bool isPaused() { return mPlayState == PAUSED; } + bool isStopped() { return mPlayState == STOPPED; } + EPlayState getPlayState() { return mPlayState; } + +protected: + + LLVCRControlsMixin() + : mPlayState(STOPPED) + {} + +private: + EPlayState mPlayState; +}; + namespace LLTrace { template class Rate; @@ -43,7 +184,7 @@ namespace LLTrace template class MeasurementAccumulator; class TimerAccumulator; - class LL_COMMON_API Recording + class LL_COMMON_API Recording : public LLVCRControlsMixin { public: Recording(); @@ -53,16 +194,9 @@ namespace LLTrace void makePrimary(); bool isPrimary(); - void start(); - void stop(); - void resume(); - void mergeSamples(const Recording& other); void mergeDeltas(const Recording& baseline, const Recording& target); - void reset(); - - bool isStarted() { return mIsStarted; } // Rate accessors F32 getSum(const Rate& stat); @@ -89,6 +223,14 @@ namespace LLTrace F64 getSampleTime() { return mElapsedSeconds; } private: + friend class PeriodicRecording; + // implementation for LLVCRControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(Recording& other); + + friend class ThreadRecorder; // returns data for current thread class ThreadRecorder* getThreadRecorder(); @@ -97,14 +239,99 @@ namespace LLTrace LLCopyOnWritePointer > > mMeasurements; LLCopyOnWritePointer > mStackTimers; - bool mIsStarted; LLTimer mSamplingTimer; F64 mElapsedSeconds; }; - class LL_COMMON_API PeriodicRecording + class LL_COMMON_API PeriodicRecording + : public LLVCRControlsMixin { + public: + PeriodicRecording(S32 num_periods) + : mNumPeriods(num_periods), + mCurPeriod(0), + mTotalValid(false), + mRecordingPeriods(new Recording[num_periods]) + { + llassert(mNumPeriods > 0); + } + + ~PeriodicRecording() + { + delete[] mRecordingPeriods; + } + + void nextPeriod() + { + EPlayState play_state = getPlayState(); + getCurRecordingPeriod().stop(); + mCurPeriod = (mCurPeriod + 1) % mNumPeriods; + switch(play_state) + { + case STOPPED: + break; + case PAUSED: + getCurRecordingPeriod().pause(); + break; + case STARTED: + getCurRecordingPeriod().start(); + break; + } + // new period, need to recalculate total + mTotalValid = false; + } + + Recording& getCurRecordingPeriod() + { + return mRecordingPeriods[mCurPeriod]; + } + + const Recording& getCurRecordingPeriod() const + { + return mRecordingPeriods[mCurPeriod]; + } + + Recording& getTotalRecording() + { + if (!mTotalValid) + { + mTotalRecording.reset(); + for (S32 i = (mCurPeriod + 1) % mNumPeriods; i < mCurPeriod; i++) + { + mTotalRecording.mergeSamples(mRecordingPeriods[i]); + } + } + mTotalValid = true; + return mTotalRecording; + } + + private: + // implementation for LLVCRControlsMixin + /*virtual*/ void handleStart() + { + getCurRecordingPeriod().handleStart(); + } + + /*virtual*/ void handleStop() + { + getCurRecordingPeriod().handleStop(); + } + + /*virtual*/ void handleReset() + { + getCurRecordingPeriod().handleReset(); + } + + /*virtual*/ void handleSplitTo(PeriodicRecording& other) + { + getCurRecordingPeriod().handleSplitTo(other.getCurRecordingPeriod()); + } + Recording* mRecordingPeriods; + Recording mTotalRecording; + bool mTotalValid; + S32 mNumPeriods, + mCurPeriod; }; } -- cgit v1.2.3 From 8bb0a6ef737cb40c8f64f37fe64ecc7f6a87ae18 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Oct 2012 18:07:31 -0700 Subject: post merge cleanup --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 6e5f118cf6..092dc7ff2c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -254,7 +254,7 @@ namespace LLTrace mCurPeriod(0), mTotalValid(false), mRecordingPeriods(new Recording[num_periods]) - { + { llassert(mNumPeriods > 0); } -- cgit v1.2.3 From 05510799e5a69eafcc919e72d25cf5b89c9274cf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Oct 2012 22:18:07 -0700 Subject: SH-3275 WIP Update viewer metrics system to be more flexible renamed mergeSamples to mergeRecording --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 092dc7ff2c..4399a65cfb 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -194,7 +194,7 @@ namespace LLTrace void makePrimary(); bool isPrimary(); - void mergeSamples(const Recording& other); + void mergeRecording(const Recording& other); void mergeDeltas(const Recording& baseline, const Recording& target); void reset(); @@ -300,7 +300,7 @@ namespace LLTrace mTotalRecording.reset(); for (S32 i = (mCurPeriod + 1) % mNumPeriods; i < mCurPeriod; i++) { - mTotalRecording.mergeSamples(mRecordingPeriods[i]); + mTotalRecording.mergeRecording(mRecordingPeriods[i]); } } mTotalValid = true; -- cgit v1.2.3 From 74ac0182ec8f7a0f6d0ea89f5814f0998ab90b62 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 10 Oct 2012 19:25:56 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system fixed units conversion so that trace getters return convertable units removed circular dependencies from lltrace* converted more stats to lltrace --- indra/llcommon/lltracerecording.h | 145 ++++++++++++++++++++++++++++++-------- 1 file changed, 114 insertions(+), 31 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4d53cd9600..d0c2e754f5 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -32,16 +32,17 @@ #include "llpointer.h" #include "lltimer.h" +#include "lltrace.h" namespace LLTrace { - template class Rate; - template class Measurement; - template class Count; - template class AccumulatorBuffer; - template class RateAccumulator; - template class MeasurementAccumulator; - class TimerAccumulator; + //template class Rate; + //template class Measurement; + //template class Count; + //template class AccumulatorBuffer; + //template class RateAccumulator; + //template class MeasurementAccumulator; + //class TimerAccumulator; class LL_COMMON_API Recording { @@ -51,43 +52,125 @@ namespace LLTrace ~Recording(); void makePrimary(); - bool isPrimary(); + bool isPrimary() const; void start(); void stop(); void resume(); - - void mergeSamples(const Recording& other); - void mergeDeltas(const Recording& baseline, const Recording& target); - void reset(); void update(); + bool isStarted() const { return mIsStarted; } - bool isStarted() { return mIsStarted; } + void addSamples(const Recording& other); + void addDeltas(const Recording& baseline, const Recording& target); // Rate accessors - F32 getSum(const Rate& stat); - F32 getPerSec(const Rate& stat); + template + typename Rate::base_unit_t getSum(const Rate& stat) const + { + return (typename Rate::base_unit_t)stat.getAccumulator(mRates).getSum(); + } + + template + typename Rate::base_unit_t getPerSec(const Rate& stat) const + { + return (typename Rate::base_unit_t)stat.getAccumulator(mRates).getSum() / mElapsedSeconds; + } // Measurement accessors - F32 getSum(const Measurement& stat); - F32 getPerSec(const Measurement& stat); - F32 getMin(const Measurement& stat); - F32 getMax(const Measurement& stat); - F32 getMean(const Measurement& stat); - F32 getStandardDeviation(const Measurement& stat); + template + typename Measurement::base_unit_t getSum(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getSum(); + + } + + template + typename Measurement::base_unit_t getPerSec(const Measurement& stat) const + { + return (typename Rate::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; + } + + template + typename Measurement::base_unit_t getMin(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMin(); + } + + template + typename Measurement::base_unit_t getMax(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMax(); + } + + template + typename Measurement::base_unit_t getMean(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMean(); + } + + template + typename Measurement::base_unit_t getStandardDeviation(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getStandardDeviation(); + } + + template + typename Measurement::base_unit_t getLastValue(const Measurement& stat) const + { + return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getLastValue(); + } // Count accessors - F32 getSum(const Count& stat); - F32 getPerSec(const Count& stat); - F32 getIncrease(const Count& stat); - F32 getIncreasePerSec(const Count& stat); - F32 getDecrease(const Count& stat); - F32 getDecreasePerSec(const Count& stat); - F32 getChurn(const Count& stat); - F32 getChurnPerSec(const Count& stat); - - F64 getSampleTime() { return mElapsedSeconds; } + template + typename Count::base_unit_t getSum(const Count& stat) const + { + return getSum(stat.mTotal); + } + + template + typename Count::base_unit_t getPerSec(const Count& stat) const + { + return getPerSec(stat.mTotal); + } + + template + typename Count::base_unit_t getIncrease(const Count& stat) const + { + return getPerSec(stat.mTotal); + } + + template + typename Count::base_unit_t getIncreasePerSec(const Count& stat) const + { + return getPerSec(stat.mIncrease); + } + + template + typename Count::base_unit_t getDecrease(const Count& stat) const + { + return getPerSec(stat.mDecrease); + } + + template + typename Count::base_unit_t getDecreasePerSec(const Count& stat) const + { + return getPerSec(stat.mDecrease); + } + + template + typename Count::base_unit_t getChurn(const Count& stat) const + { + return getIncrease(stat) + getDecrease(stat); + } + + template + typename Count::base_unit_t getChurnPerSec(const Count& stat) const + { + return getIncreasePerSec(stat) + getDecreasePerSec(stat); + } + + F64 getSampleTime() const { return mElapsedSeconds; } private: friend class ThreadRecorder; -- cgit v1.2.3 From 0f58ca02cdec62711eadb82ba28fcff08faef2ee Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Oct 2012 00:20:19 -0700 Subject: SH-3275 WIP Update viewer metrics system to be more flexible cleaned up accumulator merging logic introduced frame recording to LLTrace directly instead of going through LLViewerStats moved consumer code over to frame recording instead of whatever the current active recording was --- indra/llcommon/lltracerecording.h | 251 ++++++++++---------------------------- 1 file changed, 67 insertions(+), 184 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 0a1a02fa02..924a7bffd5 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -34,27 +34,11 @@ #include "lltimer.h" #include "lltrace.h" -template -class LL_COMMON_API LLVCRControlsMixinInterface +class LL_COMMON_API LLVCRControlsMixinCommon { public: - virtual ~LLVCRControlsMixinInterface() {} - // trigger data accumulation (without reset) - virtual void handleStart() = 0; - // stop data accumulation, should put object in queryable state - virtual void handleStop() = 0; - // clear accumulated values, can be called while started - virtual void handleReset() = 0; - // atomically stop this object while starting the other - // no data can be missed in between stop and start - virtual void handleSplitTo(DERIVED& other) = 0; -}; + virtual ~LLVCRControlsMixinCommon() {} -template -class LL_COMMON_API LLVCRControlsMixin -: private LLVCRControlsMixinInterface -{ -public: enum EPlayState { STOPPED, @@ -62,94 +46,39 @@ public: STARTED }; - void start() - { - switch (mPlayState) - { - case STOPPED: - handleReset(); - handleStart(); - break; - case PAUSED: - handleStart(); - break; - case STARTED: - handleReset(); - break; - } - mPlayState = STARTED; - } + void start(); + void stop(); + void pause(); + void resume(); + void restart(); + void reset(); - void stop() - { - switch (mPlayState) - { - case STOPPED: - break; - case PAUSED: - handleStop(); - break; - case STARTED: - break; - } - mPlayState = STOPPED; - } - - void pause() - { - switch (mPlayState) - { - case STOPPED: - break; - case PAUSED: - break; - case STARTED: - handleStop(); - break; - } - mPlayState = PAUSED; - } + bool isStarted() { return mPlayState == STARTED; } + bool isPaused() { return mPlayState == PAUSED; } + bool isStopped() { return mPlayState == STOPPED; } + EPlayState getPlayState() { return mPlayState; } - void resume() - { - switch (mPlayState) - { - case STOPPED: - handleStart(); - break; - case PAUSED: - handleStart(); - break; - case STARTED: - break; - } - mPlayState = STARTED; - } +protected: + LLVCRControlsMixinCommon() + : mPlayState(STOPPED) + {} - void restart() - { - switch (mPlayState) - { - case STOPPED: - handleReset(); - handleStart(); - break; - case PAUSED: - handleReset(); - handleStart(); - break; - case STARTED: - handleReset(); - break; - } - mPlayState = STARTED; - } +private: + // trigger data accumulation (without reset) + virtual void handleStart() = 0; + // stop data accumulation, should put object in queryable state + virtual void handleStop() = 0; + // clear accumulated values, can be called while started + virtual void handleReset() = 0; - void reset() - { - handleReset(); - } + EPlayState mPlayState; +}; +template +class LLVCRControlsMixin +: public LLVCRControlsMixinCommon +{ +public: void splitTo(DERIVED& other) { onSplitTo(other); @@ -159,32 +88,15 @@ public: { other.onSplitTo(*this); } - - bool isStarted() { return mPlayState == STARTED; } - bool isPaused() { return mPlayState == PAUSED; } - bool isStopped() { return mPlayState == STOPPED; } - EPlayState getPlayState() { return mPlayState; } - -protected: - - LLVCRControlsMixin() - : mPlayState(STOPPED) - {} - private: - EPlayState mPlayState; + // atomically stop this object while starting the other + // no data can be missed in between stop and start + virtual void handleSplitTo(DERIVED& other) = 0; + }; namespace LLTrace { - //template class Rate; - //template class Measurement; - //template class Count; - //template class AccumulatorBuffer; - //template class RateAccumulator; - //template class MeasurementAccumulator; - //class TimerAccumulator; - class LL_COMMON_API Recording : public LLVCRControlsMixin { public: @@ -196,7 +108,6 @@ namespace LLTrace bool isPrimary() const; void mergeRecording(const Recording& other); - void mergeRecordingDelta(const Recording& baseline, const Recording& target); void update(); @@ -308,15 +219,13 @@ namespace LLTrace F64 getSampleTime() const { return mElapsedSeconds; } - private: - friend class PeriodicRecording; // implementation for LLVCRControlsMixin /*virtual*/ void handleStart(); /*virtual*/ void handleStop(); /*virtual*/ void handleReset(); /*virtual*/ void handleSplitTo(Recording& other); - + private: friend class ThreadRecorder; // returns data for current thread class ThreadRecorder* getThreadRecorder(); @@ -333,38 +242,19 @@ namespace LLTrace : public LLVCRControlsMixin { public: - PeriodicRecording(S32 num_periods) - : mNumPeriods(num_periods), - mCurPeriod(0), - mTotalValid(false), - mRecordingPeriods(new Recording[num_periods]) - { - llassert(mNumPeriods > 0); - } + PeriodicRecording(S32 num_periods); + ~PeriodicRecording(); + + void nextPeriod(); - ~PeriodicRecording() + Recording& getLastRecordingPeriod() { - delete[] mRecordingPeriods; + return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; } - void nextPeriod() + const Recording& getLastRecordingPeriod() const { - EPlayState play_state = getPlayState(); - getCurRecordingPeriod().stop(); - mCurPeriod = (mCurPeriod + 1) % mNumPeriods; - switch(play_state) - { - case STOPPED: - break; - case PAUSED: - getCurRecordingPeriod().pause(); - break; - case STARTED: - getCurRecordingPeriod().start(); - break; - } - // new period, need to recalculate total - mTotalValid = false; + return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; } Recording& getCurRecordingPeriod() @@ -377,41 +267,16 @@ namespace LLTrace return mRecordingPeriods[mCurPeriod]; } - Recording& getTotalRecording() - { - if (!mTotalValid) - { - mTotalRecording.reset(); - for (S32 i = (mCurPeriod + 1) % mNumPeriods; i < mCurPeriod; i++) - { - mTotalRecording.mergeRecording(mRecordingPeriods[i]); - } - } - mTotalValid = true; - return mTotalRecording; - } + Recording& getTotalRecording(); private: - // implementation for LLVCRControlsMixin - /*virtual*/ void handleStart() - { - getCurRecordingPeriod().handleStart(); - } - - /*virtual*/ void handleStop() - { - getCurRecordingPeriod().handleStop(); - } - /*virtual*/ void handleReset() - { - getCurRecordingPeriod().handleReset(); - } + // implementation for LLVCRControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); - /*virtual*/ void handleSplitTo(PeriodicRecording& other) - { - getCurRecordingPeriod().handleSplitTo(other.getCurRecordingPeriod()); - } + /*virtual*/ void handleSplitTo(PeriodicRecording& other); Recording* mRecordingPeriods; Recording mTotalRecording; @@ -419,6 +284,24 @@ namespace LLTrace S32 mNumPeriods, mCurPeriod; }; + + PeriodicRecording& get_frame_recording(); + + class ExtendableRecording + : public LLVCRControlsMixin + { + void extend(); + + private: + // implementation for LLVCRControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendableRecording& other); + + Recording mAcceptedRecording; + Recording mPotentialRecording; + }; } #endif // LL_LLTRACERECORDING_H -- cgit v1.2.3 From 041dfccd1ea5b59c1b3c4e37e9a5495cad342c8f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Oct 2012 20:17:52 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system default to double precision now fixed unit conversion logic for LLUnit renamed LLTrace::Rate to LLTrace::Count and got rid of the old count as it was confusing some const correctness changes --- indra/llcommon/lltracerecording.h | 69 ++++++--------------------------------- 1 file changed, 10 insertions(+), 59 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 924a7bffd5..d9ac8c327a 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -111,17 +111,17 @@ namespace LLTrace void update(); - // Rate accessors + // Count accessors template - typename Rate::base_unit_t getSum(const Rate& stat) const + typename Count::base_unit_t getSum(const Count& stat) const { - return (typename Rate::base_unit_t)stat.getAccumulator(mRates).getSum(); + return (typename Count::base_unit_t)stat.getAccumulator(mCounts).getSum(); } template - typename Rate::base_unit_t getPerSec(const Rate& stat) const + typename Count::base_unit_t getPerSec(const Count& stat) const { - return (typename Rate::base_unit_t)stat.getAccumulator(mRates).getSum() / mElapsedSeconds; + return (typename Count::base_unit_t)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; } // Measurement accessors @@ -135,7 +135,7 @@ namespace LLTrace template typename Measurement::base_unit_t getPerSec(const Measurement& stat) const { - return (typename Rate::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; + return (typename Count::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; } template @@ -151,7 +151,7 @@ namespace LLTrace } template - typename Measurement::base_unit_t getMean(const Measurement& stat) const + typename Measurement::base_unit_t getMean(Measurement& stat) const { return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMean(); } @@ -168,56 +168,7 @@ namespace LLTrace return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getLastValue(); } - // Count accessors - template - typename Count::base_unit_t getSum(const Count& stat) const - { - return getSum(stat.mTotal); - } - - template - typename Count::base_unit_t getPerSec(const Count& stat) const - { - return getPerSec(stat.mTotal); - } - - template - typename Count::base_unit_t getIncrease(const Count& stat) const - { - return getPerSec(stat.mTotal); - } - - template - typename Count::base_unit_t getIncreasePerSec(const Count& stat) const - { - return getPerSec(stat.mIncrease); - } - - template - typename Count::base_unit_t getDecrease(const Count& stat) const - { - return getPerSec(stat.mDecrease); - } - - template - typename Count::base_unit_t getDecreasePerSec(const Count& stat) const - { - return getPerSec(stat.mDecrease); - } - - template - typename Count::base_unit_t getChurn(const Count& stat) const - { - return getIncrease(stat) + getDecrease(stat); - } - - template - typename Count::base_unit_t getChurnPerSec(const Count& stat) const - { - return getIncreasePerSec(stat) + getDecreasePerSec(stat); - } - - F64 getSampleTime() const { return mElapsedSeconds; } + F64 getDuration() const { return mElapsedSeconds; } // implementation for LLVCRControlsMixin /*virtual*/ void handleStart(); @@ -230,8 +181,8 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLCopyOnWritePointer > > mRates; - LLCopyOnWritePointer > > mMeasurements; + LLCopyOnWritePointer > > mCounts; + LLCopyOnWritePointer > > mMeasurements; LLCopyOnWritePointer > mStackTimers; LLTimer mSamplingTimer; -- cgit v1.2.3 From 8d2f7a526545a10cd3669bf837a0b6f02cf5fe71 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Oct 2012 19:43:35 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system converted all remaining LLViewerStats to lltrace --- indra/llcommon/lltracerecording.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index d9ac8c327a..bd4b944e5a 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -168,6 +168,12 @@ namespace LLTrace return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getLastValue(); } + template + U32 getSampleCount(const Measurement& stat) const + { + return stat.getAccumulator(mMeasurements).getSampleCount(); + } + F64 getDuration() const { return mElapsedSeconds; } // implementation for LLVCRControlsMixin @@ -208,7 +214,7 @@ namespace LLTrace return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; } - Recording& getCurRecordingPeriod() + Recording getCurRecordingPeriod() { return mRecordingPeriods[mCurPeriod]; } @@ -218,6 +224,13 @@ namespace LLTrace return mRecordingPeriods[mCurPeriod]; } + Recording snapshotCurRecordingPeriod() const + { + Recording recording_copy(getCurRecordingPeriod()); + recording_copy.stop(); + return recording_copy; + } + Recording& getTotalRecording(); private: -- cgit v1.2.3 From e6ca5471a2a816a24888ae1b38332531b22b7254 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Oct 2012 00:06:22 -0700 Subject: SH-3275 Update viewer metrics system to be more flexible put template parameter back in LLUnit units added free function operators for mathematical manipulation of unit values converted texture memory tracking to units --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index bd4b944e5a..5e7b0752c6 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -214,7 +214,7 @@ namespace LLTrace return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; } - Recording getCurRecordingPeriod() + Recording& getCurRecordingPeriod() { return mRecordingPeriods[mCurPeriod]; } -- cgit v1.2.3 From a52d203a4f1d2988e8ffba16258f3f132f22f56d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Oct 2012 20:00:07 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system started conversion of llviewerassetstats removed old, dead LLViewerStats code made units tracing require units declaration clean up of units handling --- indra/llcommon/lltracerecording.h | 95 +++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 19 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 5e7b0752c6..25f4f5c721 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -112,64 +112,121 @@ namespace LLTrace void update(); // Count accessors + template + T getSum(const TraceType >& stat) const + { + return (T)stat.getAccumulator(mCounts).getSum(); + } + template - typename Count::base_unit_t getSum(const Count& stat) const + T getSum(const Count& stat) const + { + return (T)stat.getAccumulator(mCounts).getSum(); + } + + template + T getPerSec(const TraceType >& stat) const { - return (typename Count::base_unit_t)stat.getAccumulator(mCounts).getSum(); + return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; } template - typename Count::base_unit_t getPerSec(const Count& stat) const + T getPerSec(const Count& stat) const { - return (typename Count::base_unit_t)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; + return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; } // Measurement accessors + template + T getSum(const TraceType >& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getSum(); + + } + template - typename Measurement::base_unit_t getSum(const Measurement& stat) const + T getSum(const Measurement& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getSum(); + return (T)stat.getAccumulator(mMeasurements).getSum(); + + } + template + T getPerSec(const TraceType >& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; } template - typename Measurement::base_unit_t getPerSec(const Measurement& stat) const + T getPerSec(const Measurement& stat) const { return (typename Count::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; } - template - typename Measurement::base_unit_t getMin(const Measurement& stat) const + template + T getMin(const TraceType >& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMin(); + return (T)stat.getAccumulator(mMeasurements).getMin(); } template - typename Measurement::base_unit_t getMax(const Measurement& stat) const + T getMin(const Measurement& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMax(); + return (T)stat.getAccumulator(mMeasurements).getMin(); + } + + + template + T getMax(const TraceType >& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getMax(); } template - typename Measurement::base_unit_t getMean(Measurement& stat) const + T getMax(const Measurement& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getMax(); + } + + template + T getMean(const TraceType >& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getMean(); + return (T)stat.getAccumulator(mMeasurements).getMean(); } template - typename Measurement::base_unit_t getStandardDeviation(const Measurement& stat) const + T getMean(Measurement& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getMean(); + } + + template + T getStandardDeviation(const TraceType >& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getStandardDeviation(); + return (T)stat.getAccumulator(mMeasurements).getStandardDeviation(); } template - typename Measurement::base_unit_t getLastValue(const Measurement& stat) const + T getStandardDeviation(const Measurement& stat) const { - return (typename Measurement::base_unit_t)stat.getAccumulator(mMeasurements).getLastValue(); + return (T)stat.getAccumulator(mMeasurements).getStandardDeviation(); + } + + template + T getLastValue(const TraceType >& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getLastValue(); } template - U32 getSampleCount(const Measurement& stat) const + T getLastValue(const Measurement& stat) const + { + return (T)stat.getAccumulator(mMeasurements).getLastValue(); + } + + + template + U32 getSampleCount(const TraceType >& stat) const { return stat.getAccumulator(mMeasurements).getSampleCount(); } -- cgit v1.2.3 From 176ffa54b44f2ef73f23e3252dd439f52fab3265 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Oct 2012 19:35:01 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system finished most of conversion of llviewerassetstats ported some param block fixes from viewer-chui converted viewer asset stats to param block format --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 25f4f5c721..d3f001ab6a 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -231,7 +231,7 @@ namespace LLTrace return stat.getAccumulator(mMeasurements).getSampleCount(); } - F64 getDuration() const { return mElapsedSeconds; } + LLUnit::Seconds getDuration() const { return mElapsedSeconds; } // implementation for LLVCRControlsMixin /*virtual*/ void handleStart(); -- cgit v1.2.3 From 819adb5eb4d7f982121f3dbd82750e05d26864d9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Nov 2012 00:26:44 -0700 Subject: SH-3405 FIX convert existing stats to lltrace system final removal of remaining LLStat code --- indra/llcommon/lltracerecording.h | 216 +++++++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 84 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index d3f001ab6a..4af973515d 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -112,124 +112,81 @@ namespace LLTrace void update(); // Count accessors + F64 getSum(const TraceType >& stat) const; + S64 getSum(const TraceType >& stat) const; template - T getSum(const TraceType >& stat) const + T getSum(const Count& stat) const { - return (T)stat.getAccumulator(mCounts).getSum(); - } - - template - T getSum(const Count& stat) const - { - return (T)stat.getAccumulator(mCounts).getSum(); + return (T)getSum(static_cast::type_t> >&> (stat)); } + F64 getPerSec(const TraceType >& stat) const; + F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const TraceType >& stat) const + T getPerSec(const Count& stat) const { - return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; - } - - template - T getPerSec(const Count& stat) const - { - return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; + return (T)getPerSec(static_cast::type_t> >&> (stat)); } // Measurement accessors + F64 getSum(const TraceType >& stat) const; + S64 getSum(const TraceType >& stat) const; template - T getSum(const TraceType >& stat) const + T getSum(const Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getSum(); - - } - - template - T getSum(const Measurement& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getSum(); - + return (T)getSum(static_cast::type_t> >&> (stat)); } + F64 getPerSec(const TraceType >& stat) const; + F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const TraceType >& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; - } - - template - T getPerSec(const Measurement& stat) const + T getPerSec(const Measurement& stat) const { - return (typename Count::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; + return (T)getPerSec(static_cast::type_t> >&> (stat)); } + F64 getMin(const TraceType >& stat) const; + S64 getMin(const TraceType >& stat) const; template - T getMin(const TraceType >& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getMin(); - } - - template - T getMin(const Measurement& stat) const + T getMin(const Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getMin(); + return (T)getMin(static_cast::type_t> >&> (stat)); } - + F64 getMax(const TraceType >& stat) const; + S64 getMax(const TraceType >& stat) const; template - T getMax(const TraceType >& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getMax(); - } - - template - T getMax(const Measurement& stat) const + T getMax(const Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getMax(); + return (T)getMax(static_cast::type_t> >&> (stat)); } + F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; template - T getMean(const TraceType >& stat) const + T getMean(Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getMean(); - } - - template - T getMean(Measurement& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getMean(); + return (T)getMean(static_cast::type_t> >&> (stat)); } + F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; template - T getStandardDeviation(const TraceType >& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getStandardDeviation(); - } - - template - T getStandardDeviation(const Measurement& stat) const + T getStandardDeviation(const Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getStandardDeviation(); + return (T)getMean(static_cast::type_t> >&> (stat)); } + F64 getLastValue(const TraceType >& stat) const; + S64 getLastValue(const TraceType >& stat) const; template - T getLastValue(const TraceType >& stat) const - { - return (T)stat.getAccumulator(mMeasurements).getLastValue(); - } - - template - T getLastValue(const Measurement& stat) const + T getLastValue(const Measurement& stat) const { - return (T)stat.getAccumulator(mMeasurements).getLastValue(); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } - - template - U32 getSampleCount(const TraceType >& stat) const - { - return stat.getAccumulator(mMeasurements).getSampleCount(); - } + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; LLUnit::Seconds getDuration() const { return mElapsedSeconds; } @@ -244,8 +201,10 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLCopyOnWritePointer > > mCounts; - LLCopyOnWritePointer > > mMeasurements; + LLCopyOnWritePointer > > mCountsFloat; + LLCopyOnWritePointer > > mMeasurementsFloat; + LLCopyOnWritePointer > > mCounts; + LLCopyOnWritePointer > > mMeasurements; LLCopyOnWritePointer > mStackTimers; LLTimer mSamplingTimer; @@ -260,6 +219,7 @@ namespace LLTrace ~PeriodicRecording(); void nextPeriod(); + S32 getNumPeriods() { return mNumPeriods; } Recording& getLastRecordingPeriod() { @@ -268,7 +228,7 @@ namespace LLTrace const Recording& getLastRecordingPeriod() const { - return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; + return getPrevRecordingPeriod(1); } Recording& getCurRecordingPeriod() @@ -281,6 +241,16 @@ namespace LLTrace return mRecordingPeriods[mCurPeriod]; } + Recording& getPrevRecordingPeriod(S32 offset) + { + return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + } + + const Recording& getPrevRecordingPeriod(S32 offset) const + { + return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + } + Recording snapshotCurRecordingPeriod() const { Recording recording_copy(getCurRecordingPeriod()); @@ -290,6 +260,84 @@ namespace LLTrace Recording& getTotalRecording(); + template + typename T getPeriodMin(const TraceType >& stat) const + { + T min_val = std::numeric_limits::max(); + for (S32 i = 0; i < mNumPeriods; i++) + { + min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); + } + return (T)min_val; + } + + template + F64 getPeriodMinPerSec(const TraceType >& stat) const + { + F64 min_val = std::numeric_limits::max(); + for (S32 i = 0; i < mNumPeriods; i++) + { + min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); + } + return min_val; + } + + template + T getPeriodMax(const TraceType >& stat) const + { + T max_val = std::numeric_limits::min(); + for (S32 i = 0; i < mNumPeriods; i++) + { + max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); + } + return max_val; + } + + template + F64 getPeriodMaxPerSec(const TraceType >& stat) const + { + F64 max_val = std::numeric_limits::min(); + for (S32 i = 0; i < mNumPeriods; i++) + { + max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); + } + return max_val; + } + + template + F64 getPeriodMean(const TraceType >& stat) const + { + F64 mean = 0.0; + F64 count = 0; + for (S32 i = 0; i < mNumPeriods; i++) + { + if (mRecordingPeriods[i].getDuration() > 0.f) + { + count++; + mean += mRecordingPeriods[i].getSum(stat); + } + } + mean /= (F64)mNumPeriods; + return mean; + } + + template + F64 getPeriodMeanPerSec(const TraceType >& stat) const + { + F64 mean = 0.0; + F64 count = 0; + for (S32 i = 0; i < mNumPeriods; i++) + { + if (mRecordingPeriods[i].getDuration() > 0.f) + { + count++; + mean += mRecordingPeriods[i].getPerSec(stat); + } + } + mean /= count; + return mean; + } + private: // implementation for LLVCRControlsMixin -- cgit v1.2.3 From 74fe126590fba03752d1d8d88dd3bb59c6900026 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Nov 2012 17:52:11 -0700 Subject: SH-3405 FIX convert existing stats to lltrace system output of floater_stats is now identical to pre-lltrace system (with some tweaks) --- indra/llcommon/lltracerecording.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4af973515d..a11f04b14b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -81,12 +81,12 @@ class LLVCRControlsMixin public: void splitTo(DERIVED& other) { - onSplitTo(other); + handleSplitTo(other); } void splitFrom(DERIVED& other) { - other.onSplitTo(*this); + other.handleSplitTo(*this); } private: // atomically stop this object while starting the other @@ -107,7 +107,7 @@ namespace LLTrace void makePrimary(); bool isPrimary() const; - void mergeRecording(const Recording& other); + void appendRecording(const Recording& other); void update(); -- cgit v1.2.3 From bb6bda9eef48f5b08b56af46321b79fe7f1d49d7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Nov 2012 19:55:06 -0700 Subject: SH-3499 Ensure asset stats output is correct added support for specifying predicates for xui and llsd serialization --- indra/llcommon/lltracerecording.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index a11f04b14b..3a786c1357 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -34,10 +34,10 @@ #include "lltimer.h" #include "lltrace.h" -class LL_COMMON_API LLVCRControlsMixinCommon +class LL_COMMON_API LLStopWatchControlsMixinCommon { public: - virtual ~LLVCRControlsMixinCommon() {} + virtual ~LLStopWatchControlsMixinCommon() {} enum EPlayState { @@ -59,7 +59,7 @@ public: EPlayState getPlayState() { return mPlayState; } protected: - LLVCRControlsMixinCommon() + LLStopWatchControlsMixinCommon() : mPlayState(STOPPED) {} @@ -75,8 +75,8 @@ private: }; template -class LLVCRControlsMixin -: public LLVCRControlsMixinCommon +class LLStopWatchControlsMixin +: public LLStopWatchControlsMixinCommon { public: void splitTo(DERIVED& other) @@ -97,7 +97,7 @@ private: namespace LLTrace { - class LL_COMMON_API Recording : public LLVCRControlsMixin + class LL_COMMON_API Recording : public LLStopWatchControlsMixin { public: Recording(); @@ -190,7 +190,7 @@ namespace LLTrace LLUnit::Seconds getDuration() const { return mElapsedSeconds; } - // implementation for LLVCRControlsMixin + // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); /*virtual*/ void handleStop(); /*virtual*/ void handleReset(); @@ -212,7 +212,7 @@ namespace LLTrace }; class LL_COMMON_API PeriodicRecording - : public LLVCRControlsMixin + : public LLStopWatchControlsMixin { public: PeriodicRecording(S32 num_periods); @@ -340,7 +340,7 @@ namespace LLTrace private: - // implementation for LLVCRControlsMixin + // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); /*virtual*/ void handleStop(); /*virtual*/ void handleReset(); @@ -357,12 +357,12 @@ namespace LLTrace PeriodicRecording& get_frame_recording(); class ExtendableRecording - : public LLVCRControlsMixin + : public LLStopWatchControlsMixin { void extend(); private: - // implementation for LLVCRControlsMixin + // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); /*virtual*/ void handleStop(); /*virtual*/ void handleReset(); -- cgit v1.2.3 From 0007114cf5a60779319ab8cbd0a23a0d462b8010 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 5 Nov 2012 16:10:57 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct fixed copy behavior of recordings and accumulator buffers --- indra/llcommon/lltracerecording.h | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3a786c1357..e994949150 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -53,16 +53,20 @@ public: void restart(); void reset(); - bool isStarted() { return mPlayState == STARTED; } - bool isPaused() { return mPlayState == PAUSED; } - bool isStopped() { return mPlayState == STOPPED; } - EPlayState getPlayState() { return mPlayState; } + bool isStarted() const { return mPlayState == STARTED; } + bool isPaused() const { return mPlayState == PAUSED; } + bool isStopped() const { return mPlayState == STOPPED; } + EPlayState getPlayState() const { return mPlayState; } protected: LLStopWatchControlsMixinCommon() : mPlayState(STOPPED) {} + // derived classes can call this from their constructor in order + // to enforce invariants + void forceState(EPlayState state) { mPlayState = state; } + private: // trigger data accumulation (without reset) virtual void handleStart() = 0; @@ -102,6 +106,23 @@ namespace LLTrace public: Recording(); + Recording(const Recording& other) + { + mSamplingTimer = other.mSamplingTimer; + mElapsedSeconds = other.mElapsedSeconds; + mCountsFloat = other.mCountsFloat; + mMeasurementsFloat = other.mMeasurementsFloat; + mCounts = other.mCounts; + mMeasurements = other.mMeasurements; + mStackTimers = other.mStackTimers; + + if (other.isStarted()) + { + handleStart(); + } + + forceState(other.getPlayState()); + } ~Recording(); void makePrimary(); -- cgit v1.2.3 From 860ff2f7e2a7fe932dfb7c148f0dbc0067018038 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 7 Nov 2012 00:38:21 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct fixed trace data gathering and routing from background thread simplified slave->master thread communication (eliminated redundant recording and proxy object) improved performance of fast timer data gathering (slow iterators) --- indra/llcommon/lltracerecording.h | 112 +++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 51 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index e994949150..31901b599c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -39,43 +39,42 @@ class LL_COMMON_API LLStopWatchControlsMixinCommon public: virtual ~LLStopWatchControlsMixinCommon() {} - enum EPlayState + enum EStopWatchState { STOPPED, PAUSED, STARTED }; - void start(); - void stop(); - void pause(); - void resume(); - void restart(); - void reset(); + virtual void start(); + virtual void stop(); + virtual void pause(); + virtual void resume(); + virtual void restart(); + virtual void reset(); - bool isStarted() const { return mPlayState == STARTED; } - bool isPaused() const { return mPlayState == PAUSED; } - bool isStopped() const { return mPlayState == STOPPED; } - EPlayState getPlayState() const { return mPlayState; } + bool isStarted() const { return mState == STARTED; } + bool isPaused() const { return mState == PAUSED; } + bool isStopped() const { return mState == STOPPED; } + EStopWatchState getPlayState() const { return mState; } protected: LLStopWatchControlsMixinCommon() - : mPlayState(STOPPED) + : mState(STOPPED) {} - // derived classes can call this from their constructor in order - // to enforce invariants - void forceState(EPlayState state) { mPlayState = state; } - + // derived classes can call this from their copy constructor in order + // to duplicate play state of source + void initTo(EStopWatchState state); private: - // trigger data accumulation (without reset) - virtual void handleStart() = 0; - // stop data accumulation, should put object in queryable state - virtual void handleStop() = 0; - // clear accumulated values, can be called while started - virtual void handleReset() = 0; - - EPlayState mPlayState; + // trigger active behavior (without reset) + virtual void handleStart(){}; + // stop active behavior + virtual void handleStop(){}; + // clear accumulated state, can be called while started + virtual void handleReset(){}; + + EStopWatchState mState; }; template @@ -83,19 +82,20 @@ class LLStopWatchControlsMixin : public LLStopWatchControlsMixinCommon { public: - void splitTo(DERIVED& other) + typedef LLStopWatchControlsMixin self_t; + virtual void splitTo(DERIVED& other) { handleSplitTo(other); } - void splitFrom(DERIVED& other) + virtual void splitFrom(DERIVED& other) { - other.handleSplitTo(*this); + static_cast(other).handleSplitTo(*static_cast(this)); } private: // atomically stop this object while starting the other // no data can be missed in between stop and start - virtual void handleSplitTo(DERIVED& other) = 0; + virtual void handleSplitTo(DERIVED& other) {}; }; @@ -108,20 +108,20 @@ namespace LLTrace Recording(const Recording& other) { - mSamplingTimer = other.mSamplingTimer; - mElapsedSeconds = other.mElapsedSeconds; - mCountsFloat = other.mCountsFloat; + mSamplingTimer = other.mSamplingTimer; + mElapsedSeconds = other.mElapsedSeconds; + mCountsFloat = other.mCountsFloat; mMeasurementsFloat = other.mMeasurementsFloat; - mCounts = other.mCounts; - mMeasurements = other.mMeasurements; - mStackTimers = other.mStackTimers; + mCounts = other.mCounts; + mMeasurements = other.mMeasurements; + mStackTimers = other.mStackTimers; + LLStopWatchControlsMixin::initTo(other.getPlayState()); if (other.isStarted()) { handleStart(); } - forceState(other.getPlayState()); } ~Recording(); @@ -149,6 +149,10 @@ namespace LLTrace return (T)getPerSec(static_cast::type_t> >&> (stat)); } + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + + // Measurement accessors F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; @@ -211,14 +215,15 @@ namespace LLTrace LLUnit::Seconds getDuration() const { return mElapsedSeconds; } + private: + friend class ThreadRecorder; + // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); /*virtual*/ void handleStop(); /*virtual*/ void handleReset(); /*virtual*/ void handleSplitTo(Recording& other); - private: - friend class ThreadRecorder; // returns data for current thread class ThreadRecorder* getThreadRecorder(); @@ -236,7 +241,7 @@ namespace LLTrace : public LLStopWatchControlsMixin { public: - PeriodicRecording(S32 num_periods); + PeriodicRecording(S32 num_periods, EStopWatchState state = STOPPED); ~PeriodicRecording(); void nextPeriod(); @@ -359,15 +364,17 @@ namespace LLTrace return mean; } - private: - // implementation for LLStopWatchControlsMixin - /*virtual*/ void handleStart(); - /*virtual*/ void handleStop(); - /*virtual*/ void handleReset(); - - /*virtual*/ void handleSplitTo(PeriodicRecording& other); + /*virtual*/ void start(); + /*virtual*/ void stop(); + /*virtual*/ void pause(); + /*virtual*/ void resume(); + /*virtual*/ void restart(); + /*virtual*/ void reset(); + /*virtual*/ void splitTo(PeriodicRecording& other); + /*virtual*/ void splitFrom(PeriodicRecording& other); + private: Recording* mRecordingPeriods; Recording mTotalRecording; bool mTotalValid; @@ -382,13 +389,16 @@ namespace LLTrace { void extend(); - private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void handleStart(); - /*virtual*/ void handleStop(); - /*virtual*/ void handleReset(); - /*virtual*/ void handleSplitTo(ExtendableRecording& other); - + /*virtual*/ void start(); + /*virtual*/ void stop(); + /*virtual*/ void pause(); + /*virtual*/ void resume(); + /*virtual*/ void restart(); + /*virtual*/ void reset(); + /*virtual*/ void splitTo(ExtendableRecording& other); + /*virtual*/ void splitFrom(ExtendableRecording& other); + private: Recording mAcceptedRecording; Recording mPotentialRecording; }; -- cgit v1.2.3 From ed17c181dd37f56b808838748d289ee7bb5567ec Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 7 Nov 2012 15:32:12 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct further fixes to implicit conversion of unit types --- indra/llcommon/lltracerecording.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 31901b599c..fc96631ce0 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -106,23 +106,7 @@ namespace LLTrace public: Recording(); - Recording(const Recording& other) - { - mSamplingTimer = other.mSamplingTimer; - mElapsedSeconds = other.mElapsedSeconds; - mCountsFloat = other.mCountsFloat; - mMeasurementsFloat = other.mMeasurementsFloat; - mCounts = other.mCounts; - mMeasurements = other.mMeasurements; - mStackTimers = other.mStackTimers; - - LLStopWatchControlsMixin::initTo(other.getPlayState()); - if (other.isStarted()) - { - handleStart(); - } - - } + Recording(const Recording& other); ~Recording(); void makePrimary(); -- cgit v1.2.3 From 0bb0bd514b235948c1a21c81ab0e8ab6223b1990 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 8 Nov 2012 23:42:18 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct Finished making LLUnit implicitly convertible to/from scalar integer values cleaned up test code --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index fc96631ce0..ca9950b78d 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -197,7 +197,7 @@ namespace LLTrace U32 getSampleCount(const TraceType >& stat) const; U32 getSampleCount(const TraceType >& stat) const; - LLUnit::Seconds getDuration() const { return mElapsedSeconds; } + LLUnit getDuration() const { return mElapsedSeconds; } private: friend class ThreadRecorder; -- cgit v1.2.3 From a3e3e8b4ccd96e98da73acf1c584bbfa5a8b2b56 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 12 Nov 2012 19:08:14 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system simplified llfasttimer code down to 2 classes llunit unit conversion now done in floating point or 64 bit integer precision, depending on source type --- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index ca9950b78d..16b80fd1d8 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -122,7 +122,7 @@ namespace LLTrace template T getSum(const Count& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -130,7 +130,7 @@ namespace LLTrace template T getPerSec(const Count& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; @@ -143,7 +143,7 @@ namespace LLTrace template T getSum(const Measurement& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -151,7 +151,7 @@ namespace LLTrace template T getPerSec(const Measurement& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } F64 getMin(const TraceType >& stat) const; @@ -159,7 +159,7 @@ namespace LLTrace template T getMin(const Measurement& stat) const { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast::type_t> >&> (stat)); } F64 getMax(const TraceType >& stat) const; @@ -167,7 +167,7 @@ namespace LLTrace template T getMax(const Measurement& stat) const { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast::type_t> >&> (stat)); } F64 getMean(const TraceType >& stat) const; @@ -175,7 +175,7 @@ namespace LLTrace template T getMean(Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getStandardDeviation(const TraceType >& stat) const; @@ -183,7 +183,7 @@ namespace LLTrace template T getStandardDeviation(const Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getLastValue(const TraceType >& stat) const; @@ -191,7 +191,7 @@ namespace LLTrace template T getLastValue(const Measurement& stat) const { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; -- cgit v1.2.3 From 67ec47e6da389661934ed2ddfa55ca58455fa7e5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 13 Nov 2012 17:10:10 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system moving fast timers into lltrace namespace and accumulation system --- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 16b80fd1d8..4dcadfdf29 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -120,7 +120,7 @@ namespace LLTrace F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; template - T getSum(const Count& stat) const + T getSum(const Count& stat) const { return (T)getSum(static_cast::type_t> >&> (stat)); } @@ -128,7 +128,7 @@ namespace LLTrace F64 getPerSec(const TraceType >& stat) const; F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const Count& stat) const + T getPerSec(const Count& stat) const { return (T)getPerSec(static_cast::type_t> >&> (stat)); } @@ -141,7 +141,7 @@ namespace LLTrace F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; template - T getSum(const Measurement& stat) const + T getSum(const Measurement& stat) const { return (T)getSum(static_cast::type_t> >&> (stat)); } @@ -149,7 +149,7 @@ namespace LLTrace F64 getPerSec(const TraceType >& stat) const; F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const Measurement& stat) const + T getPerSec(const Measurement& stat) const { return (T)getPerSec(static_cast::type_t> >&> (stat)); } @@ -157,7 +157,7 @@ namespace LLTrace F64 getMin(const TraceType >& stat) const; S64 getMin(const TraceType >& stat) const; template - T getMin(const Measurement& stat) const + T getMin(const Measurement& stat) const { return (T)getMin(static_cast::type_t> >&> (stat)); } @@ -165,7 +165,7 @@ namespace LLTrace F64 getMax(const TraceType >& stat) const; S64 getMax(const TraceType >& stat) const; template - T getMax(const Measurement& stat) const + T getMax(const Measurement& stat) const { return (T)getMax(static_cast::type_t> >&> (stat)); } @@ -173,7 +173,7 @@ namespace LLTrace F64 getMean(const TraceType >& stat) const; F64 getMean(const TraceType >& stat) const; template - T getMean(Measurement& stat) const + T getMean(Measurement& stat) const { return (T)getMean(static_cast::type_t> >&> (stat)); } @@ -181,7 +181,7 @@ namespace LLTrace F64 getStandardDeviation(const TraceType >& stat) const; F64 getStandardDeviation(const TraceType >& stat) const; template - T getStandardDeviation(const Measurement& stat) const + T getStandardDeviation(const Measurement& stat) const { return (T)getMean(static_cast::type_t> >&> (stat)); } @@ -189,7 +189,7 @@ namespace LLTrace F64 getLastValue(const TraceType >& stat) const; S64 getLastValue(const TraceType >& stat) const; template - T getLastValue(const Measurement& stat) const + T getLastValue(const Measurement& stat) const { return (T)getLastValue(static_cast::type_t> >&> (stat)); } -- cgit v1.2.3 From 9d77e030d9a0d23cebce616631677459eec1612c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Nov 2012 23:52:27 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system cleaning up build moved most includes of windows.h to llwin32headers.h to disable min/max macros, etc streamlined Time class and consolidated functionality in BlockTimer class llfasttimer is no longer included via llstring.h, so had to add it manually in several places --- indra/llcommon/lltracerecording.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4dcadfdf29..efc54d240f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -273,7 +273,7 @@ namespace LLTrace template typename T getPeriodMin(const TraceType >& stat) const { - T min_val = std::numeric_limits::max(); + T min_val = (std::numeric_limits::max)(); for (S32 i = 0; i < mNumPeriods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); @@ -284,7 +284,7 @@ namespace LLTrace template F64 getPeriodMinPerSec(const TraceType >& stat) const { - F64 min_val = std::numeric_limits::max(); + F64 min_val = (std::numeric_limits::max)(); for (S32 i = 0; i < mNumPeriods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); @@ -295,7 +295,7 @@ namespace LLTrace template T getPeriodMax(const TraceType >& stat) const { - T max_val = std::numeric_limits::min(); + T max_val = (std::numeric_limits::min)(); for (S32 i = 0; i < mNumPeriods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); @@ -306,7 +306,7 @@ namespace LLTrace template F64 getPeriodMaxPerSec(const TraceType >& stat) const { - F64 max_val = std::numeric_limits::min(); + F64 max_val = (std::numeric_limits::min)(); for (S32 i = 0; i < mNumPeriods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); -- cgit v1.2.3 From ca37317a1473bb79ef8de4f683231700cb9e062c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 30 Nov 2012 15:48:22 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system fixed crash when sending viewer asset stats --- indra/llcommon/lltracerecording.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index efc54d240f..e5a21a2d38 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -112,6 +112,8 @@ namespace LLTrace void makePrimary(); bool isPrimary() const; + void makeUnique(); + void appendRecording(const Recording& other); void update(); -- cgit v1.2.3 From 13e4edf1cd664864afa585bc83bbe99d4f743326 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 2 Dec 2012 23:00:36 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system started moving fast timer historical stats over to LLTrace periodic recording --- indra/llcommon/lltracerecording.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index e5a21a2d38..0adea2663b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -118,6 +118,10 @@ namespace LLTrace void update(); + // Timer accessors + LLUnit getSum(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat) const; + // Count accessors F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; @@ -273,18 +277,18 @@ namespace LLTrace Recording& getTotalRecording(); template - typename T getPeriodMin(const TraceType >& stat) const + typename T::value_t getPeriodMin(const TraceType& stat) const { - T min_val = (std::numeric_limits::max)(); + typename T::value_t min_val = (std::numeric_limits::max)(); for (S32 i = 0; i < mNumPeriods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); } - return (T)min_val; + return min_val; } template - F64 getPeriodMinPerSec(const TraceType >& stat) const + F64 getPeriodMinPerSec(const TraceType& stat) const { F64 min_val = (std::numeric_limits::max)(); for (S32 i = 0; i < mNumPeriods; i++) @@ -295,9 +299,9 @@ namespace LLTrace } template - T getPeriodMax(const TraceType >& stat) const + typename T::value_t getPeriodMax(const TraceType& stat) const { - T max_val = (std::numeric_limits::min)(); + typename T::value_t max_val = (std::numeric_limits::min)(); for (S32 i = 0; i < mNumPeriods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); @@ -306,7 +310,7 @@ namespace LLTrace } template - F64 getPeriodMaxPerSec(const TraceType >& stat) const + F64 getPeriodMaxPerSec(const TraceType& stat) const { F64 max_val = (std::numeric_limits::min)(); for (S32 i = 0; i < mNumPeriods; i++) @@ -317,7 +321,7 @@ namespace LLTrace } template - F64 getPeriodMean(const TraceType >& stat) const + F64 getPeriodMean(const TraceType& stat) const { F64 mean = 0.0; F64 count = 0; @@ -334,7 +338,7 @@ namespace LLTrace } template - F64 getPeriodMeanPerSec(const TraceType >& stat) const + F64 getPeriodMeanPerSec(const TraceType& stat) const { F64 mean = 0.0; F64 count = 0; -- cgit v1.2.3 From 407e5013f3845208e0a60e26e8f0a7fad997df5d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 3 Dec 2012 19:54:53 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system converted fast timer view over to new lltrace mechanisms --- indra/llcommon/lltracerecording.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 0adea2663b..efed3f662e 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -119,8 +119,10 @@ namespace LLTrace void update(); // Timer accessors - LLUnit getSum(const TraceType& stat) const; - LLUnit getPerSec(const TraceType& stat) const; + LLUnit getSum(const TraceType& stat) const; + U32 getSum(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat) const; + F32 getPerSec(const TraceType& stat) const; // Count accessors F64 getSum(const TraceType >& stat) const; @@ -221,7 +223,7 @@ namespace LLTrace LLCopyOnWritePointer > > mMeasurementsFloat; LLCopyOnWritePointer > > mCounts; LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimers; + LLCopyOnWritePointer > mStackTimers; LLTimer mSamplingTimer; F64 mElapsedSeconds; -- cgit v1.2.3 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/lltracerecording.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') 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 From 60800dacdd7e9b66ed654af471f2b9e9680cd981 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 6 Dec 2012 00:37:15 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system fixed gcc compile error made LLCopyOnWritePointer contain an LLPointer, not derive from it added type trait to control periodicrecording mean value type --- indra/llcommon/lltracerecording.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index a3af215dd3..6fd1a105d3 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -326,36 +326,32 @@ namespace LLTrace } template - F64 getPeriodMean(const TraceType& stat) const + typename TraceType::mean_t getPeriodMean(const TraceType& stat) const { - F64 mean = 0.0; - F64 count = 0; + typename TraceType::mean_t mean = 0.0; for (S32 i = 0; i < mNumPeriods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { - count++; mean += mRecordingPeriods[i].getSum(stat); } } - mean /= (F64)mNumPeriods; + mean /= mNumPeriods; return mean; } template - F64 getPeriodMeanPerSec(const TraceType& stat) const + typename TraceType::mean_t getPeriodMeanPerSec(const TraceType& stat) const { - F64 mean = 0.0; - F64 count = 0; + typename TraceType::mean_t mean = 0.0; for (S32 i = 0; i < mNumPeriods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { - count++; mean += mRecordingPeriods[i].getPerSec(stat); } } - mean /= count; + mean /= mNumPeriods; return mean; } -- cgit v1.2.3 From c99886d94389babc78e92bbfa5084fdd785915af Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 7 Dec 2012 15:20:12 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system improved unit tests for LLUnit renamed LLUnit to LLUnitImplicit with LLUnit being reserved for explicit units --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 6fd1a105d3..f92281cea8 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -205,7 +205,7 @@ namespace LLTrace U32 getSampleCount(const TraceType >& stat) const; U32 getSampleCount(const TraceType >& stat) const; - LLUnit getDuration() const { return mElapsedSeconds; } + LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } private: friend class ThreadRecorder; -- cgit v1.2.3 From 8c2e3bea71ea15b805a9e2a288744f10d195d803 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 9 Dec 2012 23:19:11 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system added ability to query self time of block timers indepedently --- indra/llcommon/lltracerecording.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f92281cea8..f4841214e8 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -120,8 +120,11 @@ namespace LLTrace // Timer accessors LLUnit getSum(const TraceType& stat) const; + LLUnit getSum(const TraceType& stat) const; U32 getSum(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat) const; F32 getPerSec(const TraceType& stat) const; // Count accessors -- cgit v1.2.3 From c219282f5de753a044cecb53bd806145f68add9a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 18 Dec 2012 20:07:25 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system removed some potential data races got memory stats recording in trace system --- indra/llcommon/lltracerecording.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f4841214e8..8e5f1125ec 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -34,7 +34,7 @@ #include "lltimer.h" #include "lltrace.h" -class LL_COMMON_API LLStopWatchControlsMixinCommon +class LLStopWatchControlsMixinCommon { public: virtual ~LLStopWatchControlsMixinCommon() {} @@ -101,7 +101,7 @@ private: namespace LLTrace { - class LL_COMMON_API Recording : public LLStopWatchControlsMixin + class Recording : public LLStopWatchControlsMixin { public: Recording(); @@ -127,6 +127,10 @@ namespace LLTrace LLUnit getPerSec(const TraceType& stat) const; F32 getPerSec(const TraceType& stat) const; + // Memory accessors + LLUnit getSum(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat) const; + // Count accessors F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; @@ -226,7 +230,8 @@ namespace LLTrace LLCopyOnWritePointer > > mMeasurementsFloat; LLCopyOnWritePointer > > mCounts; LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimers; + LLCopyOnWritePointer > mStackTimers; + LLCopyOnWritePointer > mMemStats; LLTimer mSamplingTimer; F64 mElapsedSeconds; -- cgit v1.2.3 From 013f04cabec8e110ee659d9b3f75a4d25f114b7b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 21 Dec 2012 00:13:21 -0800 Subject: SH-3468 WIP add memory tracking base class improvements on lifetime of lltrace core data structures tweaks to thread local pointer handling so that static constructors/destructors can safely call functions that use lltrace --- indra/llcommon/lltracerecording.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 8e5f1125ec..f2d7d42211 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -114,8 +114,12 @@ namespace LLTrace void makeUnique(); + // accumulate data from subsequent, non-overlapping recording void appendRecording(const Recording& other); + // gather data from recording, ignoring time relationship (for example, pulling data from slave threads) + void mergeRecording(const Recording& other); + void update(); // Timer accessors -- cgit v1.2.3 From 6e82bb7789c1e046dcfb97c6773150df110153f8 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Jan 2013 22:34:34 +0000 Subject: fixing linux compile errors for llcommon after LLTrace work --- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f2d7d42211..aa3200e5ad 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -141,7 +141,7 @@ namespace LLTrace template T getSum(const Count& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -149,7 +149,7 @@ namespace LLTrace template T getPerSec(const Count& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; @@ -162,7 +162,7 @@ namespace LLTrace template T getSum(const Measurement& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -170,7 +170,7 @@ namespace LLTrace template T getPerSec(const Measurement& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } F64 getMin(const TraceType >& stat) const; @@ -178,7 +178,7 @@ namespace LLTrace template T getMin(const Measurement& stat) const { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast::type_t> >&> (stat)); } F64 getMax(const TraceType >& stat) const; @@ -186,7 +186,7 @@ namespace LLTrace template T getMax(const Measurement& stat) const { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast::type_t> >&> (stat)); } F64 getMean(const TraceType >& stat) const; @@ -194,7 +194,7 @@ namespace LLTrace template T getMean(Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getStandardDeviation(const TraceType >& stat) const; @@ -202,7 +202,7 @@ namespace LLTrace template T getStandardDeviation(const Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getLastValue(const TraceType >& stat) const; @@ -210,7 +210,7 @@ namespace LLTrace template T getLastValue(const Measurement& stat) const { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; -- cgit v1.2.3 From 670d03ceb83b92c9bb98d10bb37fba6f75971a2f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Jan 2013 14:28:32 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system fixed LLExtendableRecording to actually accumulator recording time period renamed and updated LLStopWatchControlsMixin::initTo to setPlayState --- indra/llcommon/lltracerecording.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index aa3200e5ad..e6b5e85f90 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -39,7 +39,7 @@ class LLStopWatchControlsMixinCommon public: virtual ~LLStopWatchControlsMixinCommon() {} - enum EStopWatchState + enum EPlayState { STOPPED, PAUSED, @@ -53,19 +53,18 @@ public: virtual void restart(); virtual void reset(); - bool isStarted() const { return mState == STARTED; } - bool isPaused() const { return mState == PAUSED; } - bool isStopped() const { return mState == STOPPED; } - EStopWatchState getPlayState() const { return mState; } + bool isStarted() const { return mPlayState == STARTED; } + bool isPaused() const { return mPlayState == PAUSED; } + bool isStopped() const { return mPlayState == STOPPED; } + EPlayState getPlayState() const { return mPlayState; } + // force play state to specific value by calling appropriate handle* methods + void setPlayState(EPlayState state); protected: LLStopWatchControlsMixinCommon() - : mState(STOPPED) + : mPlayState(STOPPED) {} - // derived classes can call this from their copy constructor in order - // to duplicate play state of source - void initTo(EStopWatchState state); private: // trigger active behavior (without reset) virtual void handleStart(){}; @@ -74,7 +73,7 @@ private: // clear accumulated state, can be called while started virtual void handleReset(){}; - EStopWatchState mState; + EPlayState mPlayState; }; template @@ -245,7 +244,7 @@ namespace LLTrace : public LLStopWatchControlsMixin { public: - PeriodicRecording(S32 num_periods, EStopWatchState state = STOPPED); + PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); PeriodicRecording(PeriodicRecording& recording); ~PeriodicRecording(); -- cgit v1.2.3 From 970fbdbeb80f20811fb286f6731b854f9b20a76e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 15 Jan 2013 20:28:05 -0700 Subject: a minor change to LLTrace::ExtendableRecording, make its functions public. --- indra/llcommon/lltracerecording.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index aa3200e5ad..5105874ba1 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -390,6 +390,7 @@ namespace LLTrace class ExtendableRecording : public LLStopWatchControlsMixin { + public: void extend(); // implementation for LLStopWatchControlsMixin @@ -401,6 +402,8 @@ namespace LLTrace /*virtual*/ void reset(); /*virtual*/ void splitTo(ExtendableRecording& other); /*virtual*/ void splitFrom(ExtendableRecording& other); + + const Recording& getAcceptedRecording() const {return mAcceptedRecording;} private: Recording mAcceptedRecording; Recording mPotentialRecording; -- cgit v1.2.3 From 09ee16c61d372c1eb620bc3ef3dbfeb798c0a82e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 25 Jan 2013 16:15:19 -0800 Subject: SH-3275 WIP interesting Update viewer metrics system to be more flexible fix for extendablerecording not having right state --- indra/llcommon/lltracerecording.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index e6b5e85f90..f575fbd8b2 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -389,7 +389,9 @@ namespace LLTrace class ExtendableRecording : public LLStopWatchControlsMixin { + public: void extend(); + Recording& getAcceptedRecording() { return mAcceptedRecording; } // implementation for LLStopWatchControlsMixin /*virtual*/ void start(); -- cgit v1.2.3 From 2c68d5367c5c44aceb4ff23d9672c35642e030f7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 27 Jan 2013 21:35:20 -0800 Subject: SH-3275 WIP interesting Update viewer metrics system to be more flexible fixed memory leak fixed glitching of fast timer display --- indra/llcommon/lltracerecording.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f575fbd8b2..af9ba02b29 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -119,6 +119,7 @@ namespace LLTrace // gather data from recording, ignoring time relationship (for example, pulling data from slave threads) void mergeRecording(const Recording& other); + // grab latest recorded data void update(); // Timer accessors @@ -217,6 +218,8 @@ namespace LLTrace LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } + void syncTo(Recording& other); + private: friend class ThreadRecorder; @@ -337,9 +340,9 @@ namespace LLTrace } template - typename TraceType::mean_t getPeriodMean(const TraceType& stat) const + typename MeanValueType >::type getPeriodMean(const TraceType& stat) const { - typename TraceType::mean_t mean = 0.0; + typename MeanValueType >::type mean = 0.0; for (S32 i = 0; i < mNumPeriods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) @@ -352,9 +355,9 @@ namespace LLTrace } template - typename TraceType::mean_t getPeriodMeanPerSec(const TraceType& stat) const + typename MeanValueType >::type getPeriodMeanPerSec(const TraceType& stat) const { - typename TraceType::mean_t mean = 0.0; + typename MeanValueType >::type mean = 0.0; for (S32 i = 0; i < mNumPeriods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) -- cgit v1.2.3 From f07b9c2c69f1f6882dcf249aacf33cdfacf878ab Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 6 Mar 2013 11:08:25 -0800 Subject: renamed LLTrace stat gathering classes/methods to make the structure of LLTrace clearer Count becomes CountStatHandle Count.sum becomes sum(Count, value), etc. --- indra/llcommon/lltracerecording.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index af9ba02b29..6b4d4357db 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -135,11 +135,11 @@ namespace LLTrace LLUnit getSum(const TraceType& stat) const; LLUnit getPerSec(const TraceType& stat) const; - // Count accessors + // CountStatHandle accessors F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; template - T getSum(const Count& stat) const + T getSum(const CountStatHandle& stat) const { return (T)getSum(static_cast::type_t> >&> (stat)); } @@ -147,7 +147,7 @@ namespace LLTrace F64 getPerSec(const TraceType >& stat) const; F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const Count& stat) const + T getPerSec(const CountStatHandle& stat) const { return (T)getPerSec(static_cast::type_t> >&> (stat)); } @@ -156,11 +156,11 @@ namespace LLTrace U32 getSampleCount(const TraceType >& stat) const; - // Measurement accessors + // MeasurementStatHandle accessors F64 getSum(const TraceType >& stat) const; S64 getSum(const TraceType >& stat) const; template - T getSum(const Measurement& stat) const + T getSum(const MeasurementStatHandle& stat) const { return (T)getSum(static_cast::type_t> >&> (stat)); } @@ -168,7 +168,7 @@ namespace LLTrace F64 getPerSec(const TraceType >& stat) const; F64 getPerSec(const TraceType >& stat) const; template - T getPerSec(const Measurement& stat) const + T getPerSec(const MeasurementStatHandle& stat) const { return (T)getPerSec(static_cast::type_t> >&> (stat)); } @@ -176,7 +176,7 @@ namespace LLTrace F64 getMin(const TraceType >& stat) const; S64 getMin(const TraceType >& stat) const; template - T getMin(const Measurement& stat) const + T getMin(const MeasurementStatHandle& stat) const { return (T)getMin(static_cast::type_t> >&> (stat)); } @@ -184,7 +184,7 @@ namespace LLTrace F64 getMax(const TraceType >& stat) const; S64 getMax(const TraceType >& stat) const; template - T getMax(const Measurement& stat) const + T getMax(const MeasurementStatHandle& stat) const { return (T)getMax(static_cast::type_t> >&> (stat)); } @@ -192,7 +192,7 @@ namespace LLTrace F64 getMean(const TraceType >& stat) const; F64 getMean(const TraceType >& stat) const; template - T getMean(Measurement& stat) const + T getMean(MeasurementStatHandle& stat) const { return (T)getMean(static_cast::type_t> >&> (stat)); } @@ -200,7 +200,7 @@ namespace LLTrace F64 getStandardDeviation(const TraceType >& stat) const; F64 getStandardDeviation(const TraceType >& stat) const; template - T getStandardDeviation(const Measurement& stat) const + T getStandardDeviation(const MeasurementStatHandle& stat) const { return (T)getMean(static_cast::type_t> >&> (stat)); } @@ -208,7 +208,7 @@ namespace LLTrace F64 getLastValue(const TraceType >& stat) const; S64 getLastValue(const TraceType >& stat) const; template - T getLastValue(const Measurement& stat) const + T getLastValue(const MeasurementStatHandle& stat) const { return (T)getLastValue(static_cast::type_t> >&> (stat)); } @@ -394,6 +394,7 @@ namespace LLTrace { public: void extend(); + Recording& getAcceptedRecording() { return mAcceptedRecording; } // implementation for LLStopWatchControlsMixin -- cgit v1.2.3 From 1a256eca280e41a672fc87e083db851ab180612c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 11 Mar 2013 00:37:50 -0700 Subject: renamed some variables/methods in LLTrace to make things clearer --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 6b4d4357db..7dd3b98187 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -218,7 +218,7 @@ namespace LLTrace LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } - void syncTo(Recording& other); + void handOffTo(Recording& other); private: friend class ThreadRecorder; -- cgit v1.2.3 From 24a1ceb25de2b9573eb369a6e0d1811fe594aabb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 11 Mar 2013 01:08:51 -0700 Subject: separated RecordingBuffers from Recording to make active recording stack more safe --- indra/llcommon/lltracerecording.h | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 7dd3b98187..a5edcb857a 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -100,19 +100,36 @@ private: namespace LLTrace { - class Recording : public LLStopWatchControlsMixin + struct RecordingBuffers { - public: - Recording(); - - Recording(const Recording& other); - ~Recording(); + RecordingBuffers(); + LLCopyOnWritePointer > > mCountsFloat; + LLCopyOnWritePointer > > mMeasurementsFloat; + LLCopyOnWritePointer > > mCounts; + LLCopyOnWritePointer > > mMeasurements; + LLCopyOnWritePointer > mStackTimers; + LLCopyOnWritePointer > mMemStats; + void handOffTo(RecordingBuffers& other); void makePrimary(); bool isPrimary() const; void makeUnique(); + void appendBuffers(const RecordingBuffers& other); + void mergeBuffers(const RecordingBuffers& other); + void resetBuffers(RecordingBuffers* other = NULL); + + }; + + class Recording : public LLStopWatchControlsMixin, public RecordingBuffers + { + public: + Recording(); + + Recording(const Recording& other); + ~Recording(); + // accumulate data from subsequent, non-overlapping recording void appendRecording(const Recording& other); @@ -218,8 +235,6 @@ namespace LLTrace LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } - void handOffTo(Recording& other); - private: friend class ThreadRecorder; @@ -232,13 +247,6 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLCopyOnWritePointer > > mCountsFloat; - LLCopyOnWritePointer > > mMeasurementsFloat; - LLCopyOnWritePointer > > mCounts; - LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimers; - LLCopyOnWritePointer > mMemStats; - LLTimer mSamplingTimer; F64 mElapsedSeconds; }; -- cgit v1.2.3 From 7b4d27ecbcb5ac702459be97cbf6b81354850658 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 14 Mar 2013 19:36:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics collapsed Orientation enums to all use LLView::EOrientation added ability to display stat bar horizontally --- indra/llcommon/lltracerecording.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index a5edcb857a..70afe51d6e 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -100,15 +100,10 @@ private: namespace LLTrace { - struct RecordingBuffers + class RecordingBuffers { + public: RecordingBuffers(); - LLCopyOnWritePointer > > mCountsFloat; - LLCopyOnWritePointer > > mMeasurementsFloat; - LLCopyOnWritePointer > > mCounts; - LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimers; - LLCopyOnWritePointer > mMemStats; void handOffTo(RecordingBuffers& other); void makePrimary(); @@ -120,6 +115,13 @@ namespace LLTrace void mergeBuffers(const RecordingBuffers& other); void resetBuffers(RecordingBuffers* other = NULL); + protected: + LLCopyOnWritePointer > > mCountsFloat; + LLCopyOnWritePointer > > mMeasurementsFloat; + LLCopyOnWritePointer > > mCounts; + LLCopyOnWritePointer > > mMeasurements; + LLCopyOnWritePointer > mStackTimers; + LLCopyOnWritePointer > mMemStats; }; class Recording : public LLStopWatchControlsMixin, public RecordingBuffers -- cgit v1.2.3 From 8de397b19ec9e2f6206fd5ae57dba96c70e78b74 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 18 Mar 2013 08:43:03 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics changed LLCriticalDamp to LLSmoothInterpolation and sped up interpolator lookup improvements to stats display of llstatbar added scene load stats floater accessed with ctrl|shift|2 --- indra/llcommon/lltracerecording.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 70afe51d6e..751ff298ce 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -184,14 +184,6 @@ namespace LLTrace return (T)getSum(static_cast::type_t> >&> (stat)); } - F64 getPerSec(const TraceType >& stat) const; - F64 getPerSec(const TraceType >& stat) const; - template - T getPerSec(const MeasurementStatHandle& stat) const - { - return (T)getPerSec(static_cast::type_t> >&> (stat)); - } - F64 getMin(const TraceType >& stat) const; S64 getMin(const TraceType >& stat) const; template -- cgit v1.2.3 From 1f507c3cfca0c7722ebeaf71883fbaa83988e1a9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 21 Mar 2013 00:37:20 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics copied over scene load frame differencing changes from viewer-interesting made periodicrecording flexible enough to allow for indefinite number of periods added scene loading stats floater fixed collapsing behavior of container views --- indra/llcommon/lltracerecording.h | 51 ++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 751ff298ce..3e7ed2b592 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -249,16 +249,15 @@ namespace LLTrace : public LLStopWatchControlsMixin { public: - PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); - PeriodicRecording(PeriodicRecording& recording); - ~PeriodicRecording(); + PeriodicRecording(U32 num_periods, EPlayState state = STOPPED); void nextPeriod(); - S32 getNumPeriods() { return mNumPeriods; } + U32 getNumPeriods() { return mRecordingPeriods.size(); } Recording& getLastRecordingPeriod() { - return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods]; } const Recording& getLastRecordingPeriod() const @@ -276,16 +275,18 @@ namespace LLTrace return mRecordingPeriods[mCurPeriod]; } - Recording& getPrevRecordingPeriod(S32 offset) + Recording& getPrevRecordingPeriod(U32 offset) { - offset = llclamp(offset, 0, mNumPeriods - 1); - return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0u, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } - const Recording& getPrevRecordingPeriod(S32 offset) const + const Recording& getPrevRecordingPeriod(U32 offset) const { - offset = llclamp(offset, 0, mNumPeriods - 1); - return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods]; + U32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0u, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } Recording snapshotCurRecordingPeriod() const @@ -301,7 +302,8 @@ namespace LLTrace typename T::value_t getPeriodMin(const TraceType& stat) const { typename T::value_t min_val = (std::numeric_limits::max)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); } @@ -312,7 +314,8 @@ namespace LLTrace F64 getPeriodMinPerSec(const TraceType& stat) const { F64 min_val = (std::numeric_limits::max)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); } @@ -323,7 +326,8 @@ namespace LLTrace typename T::value_t getPeriodMax(const TraceType& stat) const { typename T::value_t max_val = (std::numeric_limits::min)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); } @@ -334,7 +338,8 @@ namespace LLTrace F64 getPeriodMaxPerSec(const TraceType& stat) const { F64 max_val = (std::numeric_limits::min)(); - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); } @@ -345,14 +350,15 @@ namespace LLTrace typename MeanValueType >::type getPeriodMean(const TraceType& stat) const { typename MeanValueType >::type mean = 0.0; - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { mean += mRecordingPeriods[i].getSum(stat); } } - mean /= mNumPeriods; + mean /= num_periods; return mean; } @@ -360,14 +366,15 @@ namespace LLTrace typename MeanValueType >::type getPeriodMeanPerSec(const TraceType& stat) const { typename MeanValueType >::type mean = 0.0; - for (S32 i = 0; i < mNumPeriods; i++) + U32 num_periods = mRecordingPeriods.size(); + for (S32 i = 0; i < num_periods; i++) { if (mRecordingPeriods[i].getDuration() > 0.f) { mean += mRecordingPeriods[i].getPerSec(stat); } } - mean /= mNumPeriods; + mean /= num_periods; return mean; } @@ -382,11 +389,11 @@ namespace LLTrace /*virtual*/ void splitFrom(PeriodicRecording& other); private: - Recording* mRecordingPeriods; + std::vector mRecordingPeriods; Recording mTotalRecording; bool mTotalValid; - S32 mNumPeriods, - mCurPeriod; + const bool mAutoResize; + S32 mCurPeriod; }; PeriodicRecording& get_frame_recording(); -- cgit v1.2.3 From 935dce7d6b0a343cef5b13f53d6da5d0c2dc6a73 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 25 Mar 2013 00:18:06 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed some compile errors made label spacing automatic on stat bars fixed infinite values coming from stats --- indra/llcommon/lltracerecording.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3e7ed2b592..b96d0666e5 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -305,7 +305,7 @@ namespace LLTrace U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { - min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat)); + min_val = llmin(min_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat)); } return min_val; } @@ -317,7 +317,7 @@ namespace LLTrace U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { - min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat)); + min_val = llmin(min_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat)); } return min_val; } @@ -329,7 +329,7 @@ namespace LLTrace U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { - max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat)); + max_val = llmax(max_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat)); } return max_val; } @@ -339,9 +339,9 @@ namespace LLTrace { F64 max_val = (std::numeric_limits::min)(); U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + for (S32 i = 1; i < num_periods; i++) { - max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat)); + max_val = llmax(max_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat)); } return max_val; } @@ -353,9 +353,9 @@ namespace LLTrace U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { - if (mRecordingPeriods[i].getDuration() > 0.f) + if (mRecordingPeriods[(mCurPeriod + i) % num_periods].getDuration() > 0.f) { - mean += mRecordingPeriods[i].getSum(stat); + mean += mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat); } } mean /= num_periods; @@ -371,7 +371,7 @@ namespace LLTrace { if (mRecordingPeriods[i].getDuration() > 0.f) { - mean += mRecordingPeriods[i].getPerSec(stat); + mean += mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat); } } mean /= num_periods; -- cgit v1.2.3 From 07ca6fce7c9cffe1b8f215f25bb826fedf57a5b7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 10 Apr 2013 21:51:56 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed PeriodicRecording::getTotalRecording as it was showing up at the top on the profiler renamed getPrevRecordingPeriod, etc. to getPrevRecording --- indra/llcommon/lltracerecording.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b96d0666e5..0a3e9e5a0b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -254,50 +254,48 @@ namespace LLTrace void nextPeriod(); U32 getNumPeriods() { return mRecordingPeriods.size(); } - Recording& getLastRecordingPeriod() + Recording& getLastRecording() { U32 num_periods = mRecordingPeriods.size(); return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods]; } - const Recording& getLastRecordingPeriod() const + const Recording& getLastRecording() const { - return getPrevRecordingPeriod(1); + return getPrevRecording(1); } - Recording& getCurRecordingPeriod() + Recording& getCurRecording() { return mRecordingPeriods[mCurPeriod]; } - const Recording& getCurRecordingPeriod() const + const Recording& getCurRecording() const { return mRecordingPeriods[mCurPeriod]; } - Recording& getPrevRecordingPeriod(U32 offset) + Recording& getPrevRecording(U32 offset) { U32 num_periods = mRecordingPeriods.size(); offset = llclamp(offset, 0u, num_periods - 1); return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } - const Recording& getPrevRecordingPeriod(U32 offset) const + const Recording& getPrevRecording(U32 offset) const { U32 num_periods = mRecordingPeriods.size(); offset = llclamp(offset, 0u, num_periods - 1); return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } - Recording snapshotCurRecordingPeriod() const + Recording snapshotCurRecording() const { - Recording recording_copy(getCurRecordingPeriod()); + Recording recording_copy(getCurRecording()); recording_copy.stop(); return recording_copy; } - Recording& getTotalRecording(); - template typename T::value_t getPeriodMin(const TraceType& stat) const { @@ -391,7 +389,6 @@ namespace LLTrace private: std::vector mRecordingPeriods; Recording mTotalRecording; - bool mTotalValid; const bool mAutoResize; S32 mCurPeriod; }; -- cgit v1.2.3 From 49933aadb1b7044e947575bc377b34826e94fe99 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 11 Apr 2013 06:38:03 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed MeanValueType --- indra/llcommon/lltracerecording.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 0a3e9e5a0b..9ebcbdd8ce 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -345,9 +345,9 @@ namespace LLTrace } template - typename MeanValueType >::type getPeriodMean(const TraceType& stat) const + typename T::value_t getPeriodMean(const TraceType& stat) const { - typename MeanValueType >::type mean = 0.0; + typename T::value_t mean = 0.0; U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { @@ -361,9 +361,9 @@ namespace LLTrace } template - typename MeanValueType >::type getPeriodMeanPerSec(const TraceType& stat) const + typename T::value_t getPeriodMeanPerSec(const TraceType& stat) const { - typename MeanValueType >::type mean = 0.0; + typename T::value_t mean = 0.0; U32 num_periods = mRecordingPeriods.size(); for (S32 i = 0; i < num_periods; i++) { -- cgit v1.2.3 From bdc6d58b7e84bc81977148995b0028f7420eee65 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 11 Apr 2013 19:12:27 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added ability to query periodic timer for specific number of periods used that to do smaller time averaged window for camera speed --- indra/llcommon/lltracerecording.h | 74 +++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 26 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 9ebcbdd8ce..6cf6f4f84f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -297,63 +297,80 @@ namespace LLTrace } template - typename T::value_t getPeriodMin(const TraceType& stat) const + typename T::value_t getPeriodMin(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + typename T::value_t min_val = (std::numeric_limits::max)(); - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + for (S32 i = 1; i <= num_periods; i++) { - min_val = llmin(min_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat)); + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getSum(stat)); } return min_val; } template - F64 getPeriodMinPerSec(const TraceType& stat) const + F64 getPeriodMinPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + F64 min_val = (std::numeric_limits::max)(); - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + for (S32 i = 1; i <= num_periods; i++) { - min_val = llmin(min_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat)); + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getPerSec(stat)); } return min_val; } template - typename T::value_t getPeriodMax(const TraceType& stat) const + typename T::value_t getPeriodMax(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + typename T::value_t max_val = (std::numeric_limits::min)(); - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + for (S32 i = 1; i <= num_periods; i++) { - max_val = llmax(max_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat)); + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getSum(stat)); } return max_val; } template - F64 getPeriodMaxPerSec(const TraceType& stat) const + F64 getPeriodMaxPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + F64 max_val = (std::numeric_limits::min)(); - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 1; i < num_periods; i++) + for (S32 i = 1; i <= num_periods; i++) { - max_val = llmax(max_val, mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat)); + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getPerSec(stat)); } return max_val; } template - typename T::value_t getPeriodMean(const TraceType& stat) const + typename T::value_t getPeriodMean(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + typename T::value_t mean = 0.0; - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + if (num_periods <= 0) { return mean; } + + for (S32 i = 1; i <= num_periods; i++) { - if (mRecordingPeriods[(mCurPeriod + i) % num_periods].getDuration() > 0.f) + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) { - mean += mRecordingPeriods[(mCurPeriod + i) % num_periods].getSum(stat); + mean += mRecordingPeriods[index].getSum(stat); } } mean /= num_periods; @@ -361,15 +378,20 @@ namespace LLTrace } template - typename T::value_t getPeriodMeanPerSec(const TraceType& stat) const + typename T::value_t getPeriodMeanPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + typename T::value_t mean = 0.0; - U32 num_periods = mRecordingPeriods.size(); - for (S32 i = 0; i < num_periods; i++) + if (num_periods <= 0) { return mean; } + + for (S32 i = 1; i <= num_periods; i++) { - if (mRecordingPeriods[i].getDuration() > 0.f) + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) { - mean += mRecordingPeriods[(mCurPeriod + i) % num_periods].getPerSec(stat); + mean += mRecordingPeriods[index].getPerSec(stat); } } mean /= num_periods; -- cgit v1.2.3 From f964c8faa84cfa95bbf73552e99a2d0b80f7bee2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Apr 2013 11:47:15 -0700 Subject: BUILDFIX: attempted gcc fix --- indra/llcommon/lltracerecording.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 6cf6f4f84f..1412d78a56 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -297,7 +297,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMin(const TraceType& stat, U32 num_periods = S32_MAX) const + typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -312,7 +312,7 @@ namespace LLTrace } template - F64 getPeriodMinPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const + F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -327,7 +327,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMax(const TraceType& stat, U32 num_periods = S32_MAX) const + typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -342,7 +342,7 @@ namespace LLTrace } template - F64 getPeriodMaxPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const + F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -357,7 +357,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMean(const TraceType& stat, U32 num_periods = S32_MAX) const + typename T::value_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -378,7 +378,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMeanPerSec(const TraceType& stat, U32 num_periods = S32_MAX) const + typename T::value_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); -- cgit v1.2.3 From 54d7fc95893d1bf8cc3b6ebe94f3bf37f40125d0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Apr 2013 14:25:40 -0700 Subject: BUILDFIX: attempted gcc fix --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 1412d78a56..14018bc48f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -362,7 +362,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = 0.0; + typename T::value_t mean = T::value_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -383,7 +383,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = 0.0; + typename T::value_t mean = T::value_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) -- cgit v1.2.3 From c9470856473097247c5f0290929e11007e572111 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Apr 2013 15:25:10 -0700 Subject: BUILDFIX: attempted gcc fix --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 14018bc48f..765a510dbb 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -362,7 +362,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = T::value_t(); + typename T::value_t mean = typename T::value_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -383,7 +383,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = T::value_t(); + typename T::value_t mean = typename T::value_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) -- cgit v1.2.3 From 39d8ea6327ad96b4977dfec991a20d66e2442b50 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Apr 2013 15:55:34 -0700 Subject: BUILDFIX: attempted gcc fix --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 765a510dbb..511db0e115 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -362,7 +362,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = typename T::value_t(); + typename T::mean_t mean = typename T::mean_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -383,7 +383,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t mean = typename T::value_t(); + typename T::mean_t mean = typename T::mean_t(); if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) -- cgit v1.2.3 From 08b061dc1d9bfef8fc36ac25f260b291adda6d8c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Apr 2013 16:34:38 -0700 Subject: BUILDFIX: attempted gcc fix --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 511db0e115..8a278d80b0 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -357,7 +357,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -378,7 +378,7 @@ namespace LLTrace } template - typename T::value_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); -- cgit v1.2.3 From 62c8844414b84ee9e8cc488f4e02cbaed5f67a14 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 21 Apr 2013 23:10:03 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added ExtendablePeriodicRecording and ability to append periodic recordings to each other --- indra/llcommon/lltracerecording.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 7c4113dbf0..23b031b49b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -254,6 +254,8 @@ namespace LLTrace void nextPeriod(); U32 getNumPeriods() { return mRecordingPeriods.size(); } + void appendPeriodicRecording(PeriodicRecording& other); + Recording& getLastRecording() { U32 num_periods = mRecordingPeriods.size(); @@ -424,6 +426,7 @@ namespace LLTrace void extend(); Recording& getAcceptedRecording() { return mAcceptedRecording; } + const Recording& getAcceptedRecording() const {return mAcceptedRecording;} // implementation for LLStopWatchControlsMixin /*virtual*/ void start(); @@ -435,11 +438,34 @@ namespace LLTrace /*virtual*/ void splitTo(ExtendableRecording& other); /*virtual*/ void splitFrom(ExtendableRecording& other); - const Recording& getAcceptedRecording() const {return mAcceptedRecording;} private: Recording mAcceptedRecording; Recording mPotentialRecording; }; + + class ExtendablePeriodicRecording + : public LLStopWatchControlsMixin + { + public: + void extend(); + + PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } + const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} + + // implementation for LLStopWatchControlsMixin + /*virtual*/ void start(); + /*virtual*/ void stop(); + /*virtual*/ void pause(); + /*virtual*/ void resume(); + /*virtual*/ void restart(); + /*virtual*/ void reset(); + /*virtual*/ void splitTo(ExtendablePeriodicRecording& other); + /*virtual*/ void splitFrom(ExtendablePeriodicRecording& other); + + private: + PeriodicRecording mAcceptedRecording; + PeriodicRecording mPotentialRecording; + }; } #endif // LL_LLTRACERECORDING_H -- cgit v1.2.3 From c6737163854981d94fde8bdd440eaf4bbc816b4f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Apr 2013 18:52:34 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics convert scene monitor to use extendable periodic recording --- indra/llcommon/lltracerecording.h | 56 +++++++++------------------------------ 1 file changed, 12 insertions(+), 44 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 23b031b49b..84006a10b8 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -254,49 +254,16 @@ namespace LLTrace void nextPeriod(); U32 getNumPeriods() { return mRecordingPeriods.size(); } - void appendPeriodicRecording(PeriodicRecording& other); - - Recording& getLastRecording() - { - U32 num_periods = mRecordingPeriods.size(); - return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods]; - } - - const Recording& getLastRecording() const - { - return getPrevRecording(1); - } - - Recording& getCurRecording() - { - return mRecordingPeriods[mCurPeriod]; - } - - const Recording& getCurRecording() const - { - return mRecordingPeriods[mCurPeriod]; - } - - Recording& getPrevRecording(U32 offset) - { - U32 num_periods = mRecordingPeriods.size(); - offset = llclamp(offset, 0u, num_periods - 1); - return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; - } + LLUnit getDuration(); - const Recording& getPrevRecording(U32 offset) const - { - U32 num_periods = mRecordingPeriods.size(); - offset = llclamp(offset, 0u, num_periods - 1); - return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; - } - - Recording snapshotCurRecording() const - { - Recording recording_copy(getCurRecording()); - recording_copy.stop(); - return recording_copy; - } + void appendPeriodicRecording(PeriodicRecording& other); + Recording& getLastRecording(); + const Recording& getLastRecording() const; + Recording& getCurRecording(); + const Recording& getCurRecording() const; + Recording& getPrevRecording(U32 offset); + const Recording& getPrevRecording(U32 offset) const; + Recording snapshotCurRecording() const; template typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) const @@ -447,10 +414,11 @@ namespace LLTrace : public LLStopWatchControlsMixin { public: + ExtendablePeriodicRecording(); void extend(); - PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } - const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} + PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } + const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} // implementation for LLStopWatchControlsMixin /*virtual*/ void start(); -- cgit v1.2.3 From 12c34dc30f0cb6270c11e100fcaceb3fa6b27e81 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 May 2013 00:53:01 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics renamed LLView::handleVisibilityChange to onVisibilityChange to reflect cleaned up scene monitor stats recording, now all trace stats dumped to csv also fixed extendablerecording, periodicrecording, etc. to properly implement start/stop/etc --- indra/llcommon/lltracerecording.h | 73 +++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 84006a10b8..be8618a299 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -46,12 +46,12 @@ public: STARTED }; - virtual void start(); - virtual void stop(); - virtual void pause(); - virtual void resume(); - virtual void restart(); - virtual void reset(); + void start(); + void stop(); + void pause(); + void resume(); + void restart(); + void reset(); bool isStarted() const { return mPlayState == STARTED; } bool isPaused() const { return mPlayState == PAUSED; } @@ -67,11 +67,11 @@ protected: private: // trigger active behavior (without reset) - virtual void handleStart(){}; + virtual void handleStart() = 0; // stop active behavior - virtual void handleStop(){}; + virtual void handleStop() = 0; // clear accumulated state, can be called while started - virtual void handleReset(){}; + virtual void handleReset() = 0; EPlayState mPlayState; }; @@ -84,7 +84,13 @@ public: typedef LLStopWatchControlsMixin self_t; virtual void splitTo(DERIVED& other) { + EPlayState play_state = getPlayState(); + stop(); + other.reset(); + handleSplitTo(other); + + other.setPlayState(play_state); } virtual void splitFrom(DERIVED& other) @@ -124,7 +130,9 @@ namespace LLTrace LLCopyOnWritePointer > mMemStats; }; - class Recording : public LLStopWatchControlsMixin, public RecordingBuffers + class Recording + : public LLStopWatchControlsMixin, + public RecordingBuffers { public: Recording(); @@ -367,15 +375,12 @@ namespace LLTrace return mean; } + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(PeriodicRecording& other); - /*virtual*/ void splitFrom(PeriodicRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(PeriodicRecording& other); private: std::vector mRecordingPeriods; @@ -395,15 +400,15 @@ namespace LLTrace Recording& getAcceptedRecording() { return mAcceptedRecording; } const Recording& getAcceptedRecording() const {return mAcceptedRecording;} + Recording& getPotentialRecording() { return mPotentialRecording; } + const Recording& getPotentialRecording() const { return mPotentialRecording;} + + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(ExtendableRecording& other); - /*virtual*/ void splitFrom(ExtendableRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendableRecording& other); private: Recording mAcceptedRecording; @@ -419,16 +424,16 @@ namespace LLTrace PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} + + PeriodicRecording& getPotentialRecording() { return mPotentialRecording; } + const PeriodicRecording& getPotentialRecording() const {return mPotentialRecording;} + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(ExtendablePeriodicRecording& other); - /*virtual*/ void splitFrom(ExtendablePeriodicRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendablePeriodicRecording& other); private: PeriodicRecording mAcceptedRecording; -- cgit v1.2.3 From ab5106535758393e02b075d1e404e4e1fcf81abf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 20 May 2013 19:27:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed extra dereference for copy on write pointer moved copyonwrite mechanism to RecordingBuffers from individual buffer fixed logic that was leaving scene unfrozen when camera moved during metrics gathering --- indra/llcommon/lltracerecording.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index be8618a299..b339e72e5c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -106,33 +106,28 @@ private: namespace LLTrace { - class RecordingBuffers + struct RecordingBuffers : public LLRefCount { - public: RecordingBuffers(); void handOffTo(RecordingBuffers& other); void makePrimary(); bool isPrimary() const; - void makeUnique(); - - void appendBuffers(const RecordingBuffers& other); - void mergeBuffers(const RecordingBuffers& other); - void resetBuffers(RecordingBuffers* other = NULL); + void append(const RecordingBuffers& other); + void merge(const RecordingBuffers& other); + void reset(RecordingBuffers* other = NULL); - protected: - LLCopyOnWritePointer > > mCountsFloat; - LLCopyOnWritePointer > > mMeasurementsFloat; - LLCopyOnWritePointer > > mCounts; - LLCopyOnWritePointer > > mMeasurements; - LLCopyOnWritePointer > mStackTimers; - LLCopyOnWritePointer > mMemStats; + AccumulatorBuffer > mCountsFloat; + AccumulatorBuffer > mMeasurementsFloat; + AccumulatorBuffer > mCounts; + AccumulatorBuffer > mMeasurements; + AccumulatorBuffer mStackTimers; + AccumulatorBuffer mMemStats; }; class Recording - : public LLStopWatchControlsMixin, - public RecordingBuffers + : public LLStopWatchControlsMixin { public: Recording(); @@ -149,6 +144,9 @@ namespace LLTrace // grab latest recorded data void update(); + // ensure that buffers are exclusively owned by this recording + void makeUnique() { mBuffers.makeUnique(); } + // Timer accessors LLUnit getSum(const TraceType& stat) const; LLUnit getSum(const TraceType& stat) const; @@ -237,7 +235,7 @@ namespace LLTrace LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } - private: + protected: friend class ThreadRecorder; // implementation for LLStopWatchControlsMixin @@ -249,8 +247,9 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLTimer mSamplingTimer; - F64 mElapsedSeconds; + LLTimer mSamplingTimer; + F64 mElapsedSeconds; + LLCopyOnWritePointer mBuffers; }; class LL_COMMON_API PeriodicRecording -- cgit v1.2.3 From 9ae76d12157641033431381959ef4f798a119b8d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 May 2013 17:00:50 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed copy construction behavior of Recordings to not zero out data split measurement into event and sample, with sample representing a continuous function --- indra/llcommon/lltracerecording.h | 244 ++++++++++++++++++++++++++++++++------ 1 file changed, 206 insertions(+), 38 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b339e72e5c..19a4fae737 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -117,11 +117,14 @@ namespace LLTrace void append(const RecordingBuffers& other); void merge(const RecordingBuffers& other); void reset(RecordingBuffers* other = NULL); + void flush(); AccumulatorBuffer > mCountsFloat; - AccumulatorBuffer > mMeasurementsFloat; AccumulatorBuffer > mCounts; - AccumulatorBuffer > mMeasurements; + AccumulatorBuffer > mSamplesFloat; + AccumulatorBuffer > mSamples; + AccumulatorBuffer > mEventsFloat; + AccumulatorBuffer > mEvents; AccumulatorBuffer mStackTimers; AccumulatorBuffer mMemStats; }; @@ -181,57 +184,101 @@ namespace LLTrace U32 getSampleCount(const TraceType >& stat) const; - // MeasurementStatHandle accessors - F64 getSum(const TraceType >& stat) const; - S64 getSum(const TraceType >& stat) const; + // SampleStatHandle accessors + F64 getMin(const TraceType >& stat) const; + S64 getMin(const TraceType >& stat) const; template - T getSum(const MeasurementStatHandle& stat) const + T getMin(const SampleStatHandle& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast::type_t> >&> (stat)); } - F64 getMin(const TraceType >& stat) const; - S64 getMin(const TraceType >& stat) const; + F64 getMax(const TraceType >& stat) const; + S64 getMax(const TraceType >& stat) const; template - T getMin(const MeasurementStatHandle& stat) const + T getMax(const SampleStatHandle& stat) const { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast::type_t> >&> (stat)); } - F64 getMax(const TraceType >& stat) const; - S64 getMax(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; template - T getMax(const MeasurementStatHandle& stat) const + T getMean(SampleStatHandle& stat) const { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } - F64 getMean(const TraceType >& stat) const; - F64 getMean(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; template - T getMean(MeasurementStatHandle& stat) const + T getStandardDeviation(const SampleStatHandle& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat) const; - F64 getStandardDeviation(const TraceType >& stat) const; + F64 getLastValue(const TraceType >& stat) const; + S64 getLastValue(const TraceType >& stat) const; template - T getStandardDeviation(const MeasurementStatHandle& stat) const + T getLastValue(const SampleStatHandle& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } - F64 getLastValue(const TraceType >& stat) const; - S64 getLastValue(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + + // EventStatHandle accessors + F64 getSum(const TraceType >& stat) const; + S64 getSum(const TraceType >& stat) const; + template + T getSum(const EventStatHandle& stat) const + { + return (T)getSum(static_cast::type_t> >&> (stat)); + } + + F64 getMin(const TraceType >& stat) const; + S64 getMin(const TraceType >& stat) const; + template + T getMin(const EventStatHandle& stat) const + { + return (T)getMin(static_cast::type_t> >&> (stat)); + } + + F64 getMax(const TraceType >& stat) const; + S64 getMax(const TraceType >& stat) const; + template + T getMax(const EventStatHandle& stat) const + { + return (T)getMax(static_cast::type_t> >&> (stat)); + } + + F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat) const; + template + T getMean(EventStatHandle& stat) const + { + return (T)getMean(static_cast::type_t> >&> (stat)); + } + + F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat) const; + template + T getStandardDeviation(const EventStatHandle& stat) const + { + return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); + } + + F64 getLastValue(const TraceType >& stat) const; + S64 getLastValue(const TraceType >& stat) const; template - T getLastValue(const MeasurementStatHandle& stat) const + T getLastValue(const EventStatHandle& stat) const { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } - U32 getSampleCount(const TraceType >& stat) const; - U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat) const; LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } @@ -272,13 +319,14 @@ namespace LLTrace const Recording& getPrevRecording(U32 offset) const; Recording snapshotCurRecording() const; + // catch all for stats that have a defined sum template typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t min_val = (std::numeric_limits::max)(); + typename T::value_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -287,13 +335,43 @@ namespace LLTrace return min_val; } + template + typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T min_val = std::numeric_limits::max(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); + } + return min_val; + } + + template + typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T min_val = std::numeric_limits::max(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); + } + return min_val; + } + template F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - F64 min_val = (std::numeric_limits::max)(); + F64 min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -302,13 +380,14 @@ namespace LLTrace return min_val; } + // catch all for stats that have a defined sum template typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::value_t max_val = (std::numeric_limits::min)(); + typename T::value_t max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -317,13 +396,43 @@ namespace LLTrace return max_val; } + template + typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T max_val = std::numeric_limits::min(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); + } + return max_val; + } + + template + typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename T max_val = std::numeric_limits::min(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); + } + return max_val; + } + template F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - F64 max_val = (std::numeric_limits::min)(); + F64 max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -332,13 +441,14 @@ namespace LLTrace return max_val; } + // catch all for stats that have a defined sum template - typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::mean_t mean = typename T::mean_t(); + typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -349,7 +459,65 @@ namespace LLTrace mean += mRecordingPeriods[index].getSum(stat); } } - mean /= num_periods; + mean = mean / num_periods; + return mean; + } + + template + typename SampleAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + LLUnit total_duration = 0.f; + + typename SampleAccumulator::mean_t mean = 0; + if (num_periods <= 0) { return mean; } + + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) + { + LLUnit recording_duration = mRecordingPeriods[index].getDuration(); + mean += mRecordingPeriods[index].getMean(stat) * recording_duration.value(); + total_duration += recording_duration; + } + } + + if (total_duration.value()) + { + mean = mean / total_duration; + } + return mean; + } + + template + typename EventAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + { + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, total_periods); + + typename EventAccumulator::mean_t mean = 0; + if (num_periods <= 0) { return mean; } + + S32 total_sample_count = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + if (mRecordingPeriods[index].getDuration() > 0.f) + { + S32 period_sample_count = mRecordingPeriods[index].getSampleCount(stat); + mean += mRecordingPeriods[index].getMean(stat) * period_sample_count; + total_sample_count += period_sample_count; + } + } + + if (total_sample_count) + { + mean = mean / total_sample_count; + } return mean; } @@ -359,7 +527,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T::mean_t mean = typename T::mean_t(); + typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } for (S32 i = 1; i <= num_periods; i++) @@ -370,7 +538,7 @@ namespace LLTrace mean += mRecordingPeriods[index].getPerSec(stat); } } - mean /= num_periods; + mean = mean / num_periods; return mean; } -- cgit v1.2.3 From ae355188327515d53b9c15c27ed576829fce3668 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 30 May 2013 18:30:11 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed LLTrace::ExtendablePeriodicRecording::extend() to include *all* frame extensions gated SlaveThreadRecorder pushing to master based on master update rate reverted changes to LLThreadLocalSingletonPointer to not use offset-from-default trick --- indra/llcommon/lltracerecording.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 19a4fae737..aaeb32e891 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -336,12 +336,12 @@ namespace LLTrace } template - typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T min_val = std::numeric_limits::max(); + T min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -351,7 +351,7 @@ namespace LLTrace } template - typename T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); -- cgit v1.2.3 From 9def3590f41dee3cba7760e4443fdc71f5fb2db6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 31 May 2013 16:01:46 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed multithreading lltrace causing values to be interpolated towards 0 added Radians unit improved sceneloadmonitor restart heuristic to use accumulated camera motion --- indra/llcommon/lltracerecording.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index aaeb32e891..4a77dfb1f6 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -308,7 +308,7 @@ namespace LLTrace void nextPeriod(); U32 getNumPeriods() { return mRecordingPeriods.size(); } - LLUnit getDuration(); + LLUnit getDuration() const; void appendPeriodicRecording(PeriodicRecording& other); Recording& getLastRecording(); @@ -356,7 +356,7 @@ namespace LLTrace size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); - typename T min_val = std::numeric_limits::max(); + T min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { S32 index = (mCurPeriod + total_periods - i) % total_periods; @@ -397,7 +397,7 @@ namespace LLTrace } template - typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -412,7 +412,7 @@ namespace LLTrace } template - typename T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -551,7 +551,6 @@ namespace LLTrace private: std::vector mRecordingPeriods; - Recording mTotalRecording; const bool mAutoResize; S32 mCurPeriod; }; -- cgit v1.2.3 From fd21ddd9d0adf7342fe89d371868c3f7f7ca9f5f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 31 May 2013 23:40:10 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics made recordings auto-update when executing query while active --- indra/llcommon/lltracerecording.h | 130 +++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4a77dfb1f6..58b40fa378 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -151,134 +151,134 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - LLUnit getSum(const TraceType& stat) const; - LLUnit getSum(const TraceType& stat) const; - U32 getSum(const TraceType& stat) const; + LLUnit getSum(const TraceType& stat); + LLUnit getSum(const TraceType& stat); + U32 getSum(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat) const; - LLUnit getPerSec(const TraceType& stat) const; - F32 getPerSec(const TraceType& stat) const; + LLUnit getPerSec(const TraceType& stat); + LLUnit getPerSec(const TraceType& stat); + F32 getPerSec(const TraceType& stat); // Memory accessors - LLUnit getSum(const TraceType& stat) const; - LLUnit getPerSec(const TraceType& stat) const; + LLUnit getSum(const TraceType& stat); + LLUnit getPerSec(const TraceType& stat); // CountStatHandle accessors - F64 getSum(const TraceType >& stat) const; - S64 getSum(const TraceType >& stat) const; + F64 getSum(const TraceType >& stat); + S64 getSum(const TraceType >& stat); template - T getSum(const CountStatHandle& stat) const + T getSum(const CountStatHandle& stat) { return (T)getSum(static_cast::type_t> >&> (stat)); } - F64 getPerSec(const TraceType >& stat) const; - F64 getPerSec(const TraceType >& stat) const; + F64 getPerSec(const TraceType >& stat); + F64 getPerSec(const TraceType >& stat); template - T getPerSec(const CountStatHandle& stat) const + T getPerSec(const CountStatHandle& stat) { return (T)getPerSec(static_cast::type_t> >&> (stat)); } - U32 getSampleCount(const TraceType >& stat) const; - U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType >& stat); // SampleStatHandle accessors - F64 getMin(const TraceType >& stat) const; - S64 getMin(const TraceType >& stat) const; + F64 getMin(const TraceType >& stat); + S64 getMin(const TraceType >& stat); template - T getMin(const SampleStatHandle& stat) const + T getMin(const SampleStatHandle& stat) { return (T)getMin(static_cast::type_t> >&> (stat)); } - F64 getMax(const TraceType >& stat) const; - S64 getMax(const TraceType >& stat) const; + F64 getMax(const TraceType >& stat); + S64 getMax(const TraceType >& stat); template - T getMax(const SampleStatHandle& stat) const + T getMax(const SampleStatHandle& stat) { return (T)getMax(static_cast::type_t> >&> (stat)); } - F64 getMean(const TraceType >& stat) const; - F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat); + F64 getMean(const TraceType >& stat); template - T getMean(SampleStatHandle& stat) const + T getMean(SampleStatHandle& stat) { return (T)getMean(static_cast::type_t> >&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat) const; - F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat); + F64 getStandardDeviation(const TraceType >& stat); template - T getStandardDeviation(const SampleStatHandle& stat) const + T getStandardDeviation(const SampleStatHandle& stat) { return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); } - F64 getLastValue(const TraceType >& stat) const; - S64 getLastValue(const TraceType >& stat) const; + F64 getLastValue(const TraceType >& stat); + S64 getLastValue(const TraceType >& stat); template - T getLastValue(const SampleStatHandle& stat) const + T getLastValue(const SampleStatHandle& stat) { return (T)getLastValue(static_cast::type_t> >&> (stat)); } - U32 getSampleCount(const TraceType >& stat) const; - U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType >& stat); // EventStatHandle accessors - F64 getSum(const TraceType >& stat) const; - S64 getSum(const TraceType >& stat) const; + F64 getSum(const TraceType >& stat); + S64 getSum(const TraceType >& stat); template - T getSum(const EventStatHandle& stat) const + T getSum(const EventStatHandle& stat) { return (T)getSum(static_cast::type_t> >&> (stat)); } - F64 getMin(const TraceType >& stat) const; - S64 getMin(const TraceType >& stat) const; + F64 getMin(const TraceType >& stat); + S64 getMin(const TraceType >& stat); template - T getMin(const EventStatHandle& stat) const + T getMin(const EventStatHandle& stat) { return (T)getMin(static_cast::type_t> >&> (stat)); } - F64 getMax(const TraceType >& stat) const; - S64 getMax(const TraceType >& stat) const; + F64 getMax(const TraceType >& stat); + S64 getMax(const TraceType >& stat); template - T getMax(const EventStatHandle& stat) const + T getMax(const EventStatHandle& stat) { return (T)getMax(static_cast::type_t> >&> (stat)); } - F64 getMean(const TraceType >& stat) const; - F64 getMean(const TraceType >& stat) const; + F64 getMean(const TraceType >& stat); + F64 getMean(const TraceType >& stat); template - T getMean(EventStatHandle& stat) const + T getMean(EventStatHandle& stat) { return (T)getMean(static_cast::type_t> >&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat) const; - F64 getStandardDeviation(const TraceType >& stat) const; + F64 getStandardDeviation(const TraceType >& stat); + F64 getStandardDeviation(const TraceType >& stat); template - T getStandardDeviation(const EventStatHandle& stat) const + T getStandardDeviation(const EventStatHandle& stat) { return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); } - F64 getLastValue(const TraceType >& stat) const; - S64 getLastValue(const TraceType >& stat) const; + F64 getLastValue(const TraceType >& stat); + S64 getLastValue(const TraceType >& stat); template - T getLastValue(const EventStatHandle& stat) const + T getLastValue(const EventStatHandle& stat) { return (T)getLastValue(static_cast::type_t> >&> (stat)); } - U32 getSampleCount(const TraceType >& stat) const; - U32 getSampleCount(const TraceType >& stat) const; + U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType >& stat); LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } @@ -321,7 +321,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -336,7 +336,7 @@ namespace LLTrace } template - T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -351,7 +351,7 @@ namespace LLTrace } template - T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -366,7 +366,7 @@ namespace LLTrace } template - F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const + F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -382,7 +382,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -397,7 +397,7 @@ namespace LLTrace } template - T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -412,7 +412,7 @@ namespace LLTrace } template - T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) const + T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -427,7 +427,7 @@ namespace LLTrace } template - F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const + F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -443,7 +443,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -464,7 +464,7 @@ namespace LLTrace } template - typename SampleAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + typename SampleAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -493,7 +493,7 @@ namespace LLTrace } template - typename EventAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) const + typename EventAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); @@ -522,7 +522,7 @@ namespace LLTrace } template - typename T::mean_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) const + typename T::mean_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); num_periods = llmin(num_periods, total_periods); -- cgit v1.2.3 From 233201f8227f92e93061d3e2393a17b42dfa3dd1 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 2 Jun 2013 22:49:17 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics removed unnecessary templates from accumulator types...now always track data in double precision floating point, using templated accessors to convert to and from arbitrary types --- indra/llcommon/lltracerecording.h | 209 +++++++++++--------------------------- 1 file changed, 57 insertions(+), 152 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 58b40fa378..b4452d67a0 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -119,12 +119,9 @@ namespace LLTrace void reset(RecordingBuffers* other = NULL); void flush(); - AccumulatorBuffer > mCountsFloat; - AccumulatorBuffer > mCounts; - AccumulatorBuffer > mSamplesFloat; - AccumulatorBuffer > mSamples; - AccumulatorBuffer > mEventsFloat; - AccumulatorBuffer > mEvents; + AccumulatorBuffer mCounts; + AccumulatorBuffer mSamples; + AccumulatorBuffer mEvents; AccumulatorBuffer mStackTimers; AccumulatorBuffer mMemStats; }; @@ -164,121 +161,105 @@ namespace LLTrace LLUnit getPerSec(const TraceType& stat); // CountStatHandle accessors - F64 getSum(const TraceType >& stat); - S64 getSum(const TraceType >& stat); + F64 getSum(const TraceType& stat); template T getSum(const CountStatHandle& stat) { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast&> (stat)); } - F64 getPerSec(const TraceType >& stat); - F64 getPerSec(const TraceType >& stat); + F64 getPerSec(const TraceType& stat); template T getPerSec(const CountStatHandle& stat) { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast&> (stat)); } - U32 getSampleCount(const TraceType >& stat); - U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType& stat); // SampleStatHandle accessors - F64 getMin(const TraceType >& stat); - S64 getMin(const TraceType >& stat); + F64 getMin(const TraceType& stat); template T getMin(const SampleStatHandle& stat) { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast&> (stat)); } - F64 getMax(const TraceType >& stat); - S64 getMax(const TraceType >& stat); + F64 getMax(const TraceType& stat); template T getMax(const SampleStatHandle& stat) { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast&> (stat)); } - F64 getMean(const TraceType >& stat); - F64 getMean(const TraceType >& stat); + F64 getMean(const TraceType& stat); template T getMean(SampleStatHandle& stat) { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat); - F64 getStandardDeviation(const TraceType >& stat); + F64 getStandardDeviation(const TraceType& stat); template T getStandardDeviation(const SampleStatHandle& stat) { - return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); + return (T)getStandardDeviation(static_cast&> (stat)); } - F64 getLastValue(const TraceType >& stat); - S64 getLastValue(const TraceType >& stat); + F64 getLastValue(const TraceType& stat); template T getLastValue(const SampleStatHandle& stat) { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast&> (stat)); } - U32 getSampleCount(const TraceType >& stat); - U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType& stat); // EventStatHandle accessors - F64 getSum(const TraceType >& stat); - S64 getSum(const TraceType >& stat); + F64 getSum(const TraceType& stat); template T getSum(const EventStatHandle& stat) { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast&> (stat)); } - F64 getMin(const TraceType >& stat); - S64 getMin(const TraceType >& stat); + F64 getMin(const TraceType& stat); template T getMin(const EventStatHandle& stat) { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast&> (stat)); } - F64 getMax(const TraceType >& stat); - S64 getMax(const TraceType >& stat); + F64 getMax(const TraceType& stat); template T getMax(const EventStatHandle& stat) { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast&> (stat)); } - F64 getMean(const TraceType >& stat); - F64 getMean(const TraceType >& stat); + F64 getMean(const TraceType& stat); template T getMean(EventStatHandle& stat) { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast&> (stat)); } - F64 getStandardDeviation(const TraceType >& stat); - F64 getStandardDeviation(const TraceType >& stat); + F64 getStandardDeviation(const TraceType& stat); template T getStandardDeviation(const EventStatHandle& stat) { - return (T)getStandardDeviation(static_cast::type_t> >&> (stat)); + return (T)getStandardDeviation(static_cast&> (stat)); } - F64 getLastValue(const TraceType >& stat); - S64 getLastValue(const TraceType >& stat); + F64 getLastValue(const TraceType& stat); template T getLastValue(const EventStatHandle& stat) { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast&> (stat)); } - U32 getSampleCount(const TraceType >& stat); - U32 getSampleCount(const TraceType >& stat); + U32 getSampleCount(const TraceType& stat); LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } @@ -335,34 +316,18 @@ namespace LLTrace return min_val; } - template - T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) + F64 getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMin(const SampleStatHandle& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - - T min_val = std::numeric_limits::max(); - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); - } - return min_val; + return T(getPeriodMin(static_cast&>(stat), num_periods)); } - - template - T getPeriodMin(const TraceType >& stat, size_t num_periods = U32_MAX) - { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - T min_val = std::numeric_limits::max(); - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - min_val = llmin(min_val, mRecordingPeriods[index].getMin(stat)); - } - return min_val; + F64 getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMin(const EventStatHandle& stat, size_t num_periods = U32_MAX) + { + return T(getPeriodMin(static_cast&>(stat), num_periods)); } template @@ -396,34 +361,18 @@ namespace LLTrace return max_val; } - template - T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) + F64 getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMax(const SampleStatHandle& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - - typename T max_val = std::numeric_limits::min(); - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); - } - return max_val; + return T(getPeriodMax(static_cast&>(stat), num_periods)); } - template - T getPeriodMax(const TraceType >& stat, size_t num_periods = U32_MAX) + F64 getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMax(const EventStatHandle& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - - typename T max_val = std::numeric_limits::min(); - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - max_val = llmax(max_val, mRecordingPeriods[index].getMax(stat)); - } - return max_val; + return T(getPeriodMax(static_cast&>(stat), num_periods)); } template @@ -463,62 +412,18 @@ namespace LLTrace return mean; } - template - typename SampleAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) + F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMean(const SampleStatHandle& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - - LLUnit total_duration = 0.f; - - typename SampleAccumulator::mean_t mean = 0; - if (num_periods <= 0) { return mean; } - - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - if (mRecordingPeriods[index].getDuration() > 0.f) - { - LLUnit recording_duration = mRecordingPeriods[index].getDuration(); - mean += mRecordingPeriods[index].getMean(stat) * recording_duration.value(); - total_duration += recording_duration; - } - } - - if (total_duration.value()) - { - mean = mean / total_duration; - } - return mean; + return T(getPeriodMean(static_cast&>(stat), num_periods)); } - template - typename EventAccumulator::mean_t getPeriodMean(const TraceType >& stat, size_t num_periods = U32_MAX) + F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + template + T getPeriodMean(const EventStatHandle& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); - - typename EventAccumulator::mean_t mean = 0; - if (num_periods <= 0) { return mean; } - - S32 total_sample_count = 0; - - for (S32 i = 1; i <= num_periods; i++) - { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - if (mRecordingPeriods[index].getDuration() > 0.f) - { - S32 period_sample_count = mRecordingPeriods[index].getSampleCount(stat); - mean += mRecordingPeriods[index].getMean(stat) * period_sample_count; - total_sample_count += period_sample_count; - } - } - - if (total_sample_count) - { - mean = mean / total_sample_count; - } - return mean; + return T(getPeriodMean(static_cast&>(stat), num_periods)); } template -- cgit v1.2.3 From a74b5dfa923f8eeccc9b786143f0f832de3ad450 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Jun 2013 19:45:33 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics fixed mem stat tracking...now properly tracks memory footprint with floating point precision cleaned up macros for unit declaration renamed units to SI standard for 1024 multiples (kibibytes, etc) fixed units output for scene monitor dump --- indra/llcommon/lltracerecording.h | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b4452d67a0..4651bfcb61 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -149,16 +149,28 @@ namespace LLTrace // Timer accessors LLUnit getSum(const TraceType& stat); - LLUnit getSum(const TraceType& stat); - U32 getSum(const TraceType& stat); + LLUnit getSum(const TraceType& stat); + U32 getSum(const TraceType& stat); LLUnit getPerSec(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); - F32 getPerSec(const TraceType& stat); + LLUnit getPerSec(const TraceType& stat); + F32 getPerSec(const TraceType& stat); // Memory accessors - LLUnit getSum(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); + LLUnit getMin(const TraceType& stat); + LLUnit getMean(const TraceType& stat); + LLUnit getMax(const TraceType& stat); + LLUnit getStandardDeviation(const TraceType& stat); + LLUnit getLastValue(const TraceType& stat); + + LLUnit getMin(const TraceType& stat); + LLUnit getMean(const TraceType& stat); + LLUnit getMax(const TraceType& stat); + LLUnit getStandardDeviation(const TraceType& stat); + LLUnit getLastValue(const TraceType& stat); + + U32 getSum(const TraceType& stat); + U32 getSum(const TraceType& stat); // CountStatHandle accessors F64 getSum(const TraceType& stat); @@ -186,18 +198,18 @@ namespace LLTrace return (T)getMin(static_cast&> (stat)); } - F64 getMax(const TraceType& stat); + F64 getMean(const TraceType& stat); template - T getMax(const SampleStatHandle& stat) + T getMean(SampleStatHandle& stat) { - return (T)getMax(static_cast&> (stat)); + return (T)getMean(static_cast&> (stat)); } - F64 getMean(const TraceType& stat); + F64 getMax(const TraceType& stat); template - T getMean(SampleStatHandle& stat) + T getMax(const SampleStatHandle& stat) { - return (T)getMean(static_cast&> (stat)); + return (T)getMax(static_cast&> (stat)); } F64 getStandardDeviation(const TraceType& stat); -- cgit v1.2.3 From 9fd3af3c389ed491b515cbb5136b344b069913e4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 13 Jun 2013 15:29:15 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics changed Units macros and argument order to make it more clear optimized units for integer types fixed merging of periodicrecordings...should eliminate duplicate entries in sceneloadmonitor history --- indra/llcommon/lltracerecording.h | 56 ++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4651bfcb61..e3cef77b06 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -148,26 +148,26 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - LLUnit getSum(const TraceType& stat); - LLUnit getSum(const TraceType& stat); + LLUnit getSum(const TraceType& stat); + LLUnit getSum(const TraceType& stat); U32 getSum(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); + LLUnit getPerSec(const TraceType& stat); + LLUnit getPerSec(const TraceType& stat); F32 getPerSec(const TraceType& stat); // Memory accessors - LLUnit getMin(const TraceType& stat); - LLUnit getMean(const TraceType& stat); - LLUnit getMax(const TraceType& stat); - LLUnit getStandardDeviation(const TraceType& stat); - LLUnit getLastValue(const TraceType& stat); - - LLUnit getMin(const TraceType& stat); - LLUnit getMean(const TraceType& stat); - LLUnit getMax(const TraceType& stat); - LLUnit getStandardDeviation(const TraceType& stat); - LLUnit getLastValue(const TraceType& stat); + LLUnit getMin(const TraceType& stat); + LLUnit getMean(const TraceType& stat); + LLUnit getMax(const TraceType& stat); + LLUnit getStandardDeviation(const TraceType& stat); + LLUnit getLastValue(const TraceType& stat); + + LLUnit getMin(const TraceType& stat); + LLUnit getMean(const TraceType& stat); + LLUnit getMax(const TraceType& stat); + LLUnit getStandardDeviation(const TraceType& stat); + LLUnit getLastValue(const TraceType& stat); U32 getSum(const TraceType& stat); U32 getSum(const TraceType& stat); @@ -273,7 +273,7 @@ namespace LLTrace U32 getSampleCount(const TraceType& stat); - LLUnit getDuration() const { return LLUnit(mElapsedSeconds); } + LLUnit getDuration() const { return mElapsedSeconds; } protected: friend class ThreadRecorder; @@ -288,7 +288,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - F64 mElapsedSeconds; + LLUnit mElapsedSeconds; LLCopyOnWritePointer mBuffers; }; @@ -299,11 +299,12 @@ namespace LLTrace PeriodicRecording(U32 num_periods, EPlayState state = STOPPED); void nextPeriod(); - U32 getNumPeriods() { return mRecordingPeriods.size(); } + size_t getNumRecordedPeriods() { return mNumPeriods; } - LLUnit getDuration() const; + LLUnit getDuration() const; void appendPeriodicRecording(PeriodicRecording& other); + void appendRecording(Recording& recording); Recording& getLastRecording(); const Recording& getLastRecording() const; Recording& getCurRecording(); @@ -317,7 +318,7 @@ namespace LLTrace typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) @@ -346,7 +347,7 @@ namespace LLTrace F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); F64 min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) @@ -362,7 +363,7 @@ namespace LLTrace typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) @@ -391,7 +392,7 @@ namespace LLTrace F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); F64 max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) @@ -407,7 +408,7 @@ namespace LLTrace typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } @@ -442,7 +443,7 @@ namespace LLTrace typename T::mean_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mRecordingPeriods.size(); - num_periods = llmin(num_periods, total_periods); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::mean_t mean = 0; if (num_periods <= 0) { return mean; } @@ -468,8 +469,9 @@ namespace LLTrace private: std::vector mRecordingPeriods; - const bool mAutoResize; - S32 mCurPeriod; + const bool mAutoResize; + size_t mCurPeriod; + size_t mNumPeriods; }; PeriodicRecording& get_frame_recording(); -- cgit v1.2.3 From 3f2de87340b1c831ea59e4a3ca960d49f343c9fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 17 Jun 2013 01:18:21 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics added getAs and setAs to LLUnit to make it clearer how you specify units removed accidental 0-based indexing of periodicRecording history... should now be consistently 1-based, with 0 accessing current active recording removed per frame timer updates of all historical timer bars in fast timer display added missing assignment operator to recordings --- indra/llcommon/lltracerecording.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index e3cef77b06..b839e85de0 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -135,6 +135,8 @@ namespace LLTrace Recording(const Recording& other); ~Recording(); + Recording& operator = (const Recording& other); + // accumulate data from subsequent, non-overlapping recording void appendRecording(const Recording& other); -- cgit v1.2.3 From 8bddaeec6647e735415f9bd72a4e1313e11fe720 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sat, 22 Jun 2013 12:00:18 -0700 Subject: fixed scene load monitor resetting to eagerly due to spurious camer amotion pulled swap() out of ui time block cleaned up internal lltrace dependencies, factored out common accumulator definitions --- indra/llcommon/lltracerecording.h | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b839e85de0..38eaa47f9f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -32,7 +32,7 @@ #include "llpointer.h" #include "lltimer.h" -#include "lltrace.h" +#include "lltraceaccumulators.h" class LLStopWatchControlsMixinCommon { @@ -106,26 +106,6 @@ private: namespace LLTrace { - struct RecordingBuffers : public LLRefCount - { - RecordingBuffers(); - - void handOffTo(RecordingBuffers& other); - void makePrimary(); - bool isPrimary() const; - - void append(const RecordingBuffers& other); - void merge(const RecordingBuffers& other); - void reset(RecordingBuffers* other = NULL); - void flush(); - - AccumulatorBuffer mCounts; - AccumulatorBuffer mSamples; - AccumulatorBuffer mEvents; - AccumulatorBuffer mStackTimers; - AccumulatorBuffer mMemStats; - }; - class Recording : public LLStopWatchControlsMixin { @@ -138,10 +118,7 @@ namespace LLTrace Recording& operator = (const Recording& other); // accumulate data from subsequent, non-overlapping recording - void appendRecording(const Recording& other); - - // gather data from recording, ignoring time relationship (for example, pulling data from slave threads) - void mergeRecording(const Recording& other); + void appendRecording(Recording& other); // grab latest recorded data void update(); @@ -291,7 +268,7 @@ namespace LLTrace LLTimer mSamplingTimer; LLUnit mElapsedSeconds; - LLCopyOnWritePointer mBuffers; + LLCopyOnWritePointer mBuffers; }; class LL_COMMON_API PeriodicRecording -- cgit v1.2.3 From 808d3eff198d65e5a870abb670786935fc8356bd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 27 Jun 2013 00:07:21 -0700 Subject: SH-4299 WIP: Interesting: High fps shown temporarily off scale in statistics console fixed some lltrace logic errors more consistent syncing of timestamps of sample values in recording stack selection of primary buffers was completely incorrect assignment of recordings got wrong play state due to implicit operator = defined in base class fixed asset stats only working up to the first send --- indra/llcommon/lltracerecording.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 38eaa47f9f..355dbabb1c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -81,6 +81,7 @@ class LLStopWatchControlsMixin : public LLStopWatchControlsMixinCommon { public: + typedef LLStopWatchControlsMixin self_t; virtual void splitTo(DERIVED& other) { @@ -98,6 +99,11 @@ public: static_cast(other).handleSplitTo(*static_cast(this)); } private: + self_t& operator = (const self_t& other) + { + // don't do anything, derived class must implement logic + } + // atomically stop this object while starting the other // no data can be missed in between stop and start virtual void handleSplitTo(DERIVED& other) {}; -- cgit v1.2.3 From 72eea31b1542f56e987a8701f079b27d8b7276bd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Jul 2013 20:10:24 -0700 Subject: BUILDFIX: forward declare TraceType to appease gcc template instantiation gods --- indra/llcommon/lltracerecording.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 355dbabb1c..b646075228 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -112,6 +112,9 @@ private: namespace LLTrace { + template + class TraceType; + class Recording : public LLStopWatchControlsMixin { -- cgit v1.2.3 From bc7d2b76961c0397dcd108e625db4304855f4539 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Jul 2013 20:43:24 -0700 Subject: BUILDFIX: more template forward declarations --- indra/llcommon/lltracerecording.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b646075228..7b0970ffdf 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -115,6 +115,15 @@ namespace LLTrace template class TraceType; + template + class CountStatHandle; + + template + class SampleStatHandle; + + template + class EventStatHandle; + class Recording : public LLStopWatchControlsMixin { -- cgit v1.2.3 From 11e14cd3b0f58225a96b9b7a9839a7f030fe4045 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Jul 2013 11:05:57 -0700 Subject: SH-4299Interesting: High fps shown temporarily off scale in statistics console various fixes to lltrace start() on started recording no longer resets fixed various instances of unit forgetfullness in lltrace recording split now has gapless timing scene monitor now guarantees min sample time renamed a bunch of stats added names to debug thread view on windows --- indra/llcommon/lltracerecording.h | 143 ++++++++++++++++++++++++++++---------- 1 file changed, 106 insertions(+), 37 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 7b0970ffdf..31616a52cc 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -124,11 +124,32 @@ namespace LLTrace template class EventStatHandle; + template + struct RelatedTypes + { + typedef F64 fractional_t; + typedef T sum_t; + }; + + template + struct RelatedTypes > + { + typedef LLUnit::fractional_t, UNIT_T> fractional_t; + typedef LLUnit::sum_t, UNIT_T> sum_t; + }; + + template<> + struct RelatedTypes + { + typedef F64 fractional_t; + typedef U32 sum_t; + }; + class Recording : public LLStopWatchControlsMixin { public: - Recording(); + Recording(EPlayState state = LLStopWatchControlsMixinCommon::STOPPED); Recording(const Recording& other); ~Recording(); @@ -172,16 +193,16 @@ namespace LLTrace // CountStatHandle accessors F64 getSum(const TraceType& stat); template - T getSum(const CountStatHandle& stat) + typename RelatedTypes::sum_t getSum(const CountStatHandle& stat) { - return (T)getSum(static_cast&> (stat)); + return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); } F64 getPerSec(const TraceType& stat); template - T getPerSec(const CountStatHandle& stat) + typename RelatedTypes::fractional_t getPerSec(const CountStatHandle& stat) { - return (T)getPerSec(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getPerSec(static_cast&> (stat)); } U32 getSampleCount(const TraceType& stat); @@ -197,9 +218,9 @@ namespace LLTrace F64 getMean(const TraceType& stat); template - T getMean(SampleStatHandle& stat) + typename RelatedTypes::fractional_t getMean(SampleStatHandle& stat) { - return (T)getMean(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); } F64 getMax(const TraceType& stat); @@ -211,9 +232,9 @@ namespace LLTrace F64 getStandardDeviation(const TraceType& stat); template - T getStandardDeviation(const SampleStatHandle& stat) + typename RelatedTypes::fractional_t getStandardDeviation(const SampleStatHandle& stat) { - return (T)getStandardDeviation(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); } F64 getLastValue(const TraceType& stat); @@ -228,9 +249,9 @@ namespace LLTrace // EventStatHandle accessors F64 getSum(const TraceType& stat); template - T getSum(const EventStatHandle& stat) + typename RelatedTypes::sum_t getSum(const EventStatHandle& stat) { - return (T)getSum(static_cast&> (stat)); + return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); } F64 getMin(const TraceType& stat); @@ -249,16 +270,16 @@ namespace LLTrace F64 getMean(const TraceType& stat); template - T getMean(EventStatHandle& stat) + typename RelatedTypes::fractional_t getMean(EventStatHandle& stat) { - return (T)getMean(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); } F64 getStandardDeviation(const TraceType& stat); template - T getStandardDeviation(const EventStatHandle& stat) + typename RelatedTypes::fractional_t getStandardDeviation(const EventStatHandle& stat) { - return (T)getStandardDeviation(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); } F64 getLastValue(const TraceType& stat); @@ -284,9 +305,11 @@ namespace LLTrace // returns data for current thread class ThreadRecorder* getThreadRecorder(); - LLTimer mSamplingTimer; - LLUnit mElapsedSeconds; + LLTimer mSamplingTimer; + LLUnit mElapsedSeconds; LLCopyOnWritePointer mBuffers; + bool mInHandOff; + }; class LL_COMMON_API PeriodicRecording @@ -310,11 +333,15 @@ namespace LLTrace const Recording& getPrevRecording(U32 offset) const; Recording snapshotCurRecording() const; + // + // PERIODIC MIN + // + // catch all for stats that have a defined sum template typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t min_val = std::numeric_limits::max(); @@ -326,6 +353,12 @@ namespace LLTrace return min_val; } + template + T getPeriodMin(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return T(getPeriodMin(static_cast&>(stat), num_periods)); + } + F64 getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); template T getPeriodMin(const SampleStatHandle& stat, size_t num_periods = U32_MAX) @@ -341,9 +374,9 @@ namespace LLTrace } template - F64 getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); F64 min_val = std::numeric_limits::max(); @@ -352,14 +385,24 @@ namespace LLTrace S32 index = (mCurPeriod + total_periods - i) % total_periods; min_val = llmin(min_val, mRecordingPeriods[index].getPerSec(stat)); } - return min_val; + return (typename RelatedTypes::fractional_t) min_val; + } + + template + typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodMinPerSec(static_cast&>(stat), num_periods)); } + // + // PERIODIC MAX + // + // catch all for stats that have a defined sum template typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t max_val = std::numeric_limits::min(); @@ -371,6 +414,12 @@ namespace LLTrace return max_val; } + template + T getPeriodMax(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return T(getPeriodMax(static_cast&>(stat), num_periods)); + } + F64 getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); template T getPeriodMax(const SampleStatHandle& stat, size_t num_periods = U32_MAX) @@ -386,9 +435,9 @@ namespace LLTrace } template - F64 getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); F64 max_val = std::numeric_limits::min(); @@ -397,14 +446,24 @@ namespace LLTrace S32 index = (mCurPeriod + total_periods - i) % total_periods; max_val = llmax(max_val, mRecordingPeriods[index].getPerSec(stat)); } - return max_val; + return (typename RelatedTypes::fractional_t)max_val; + } + + template + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodMaxPerSec(static_cast&>(stat), num_periods)); } + // + // PERIODIC MEAN + // + // catch all for stats that have a defined sum template typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::mean_t mean = 0; @@ -422,24 +481,29 @@ namespace LLTrace return mean; } + template + typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); + } F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); template - T getPeriodMean(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, size_t num_periods = U32_MAX) { - return T(getPeriodMean(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); template - T getPeriodMean(const EventStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, size_t num_periods = U32_MAX) { - return T(getPeriodMean(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } template - typename T::mean_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { - size_t total_periods = mRecordingPeriods.size(); + size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::mean_t mean = 0; @@ -454,7 +518,13 @@ namespace LLTrace } } mean = mean / num_periods; - return mean; + return (typename RelatedTypes::fractional_t)mean; + } + + template + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); } private: @@ -504,11 +574,10 @@ namespace LLTrace ExtendablePeriodicRecording(); void extend(); - PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } - const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} + PeriodicRecording& getResults() { return mAcceptedRecording; } + const PeriodicRecording& getResults() const {return mAcceptedRecording;} - PeriodicRecording& getPotentialRecording() { return mPotentialRecording; } - const PeriodicRecording& getPotentialRecording() const {return mPotentialRecording;} + void nextPeriod() { mPotentialRecording.nextPeriod(); } private: // implementation for LLStopWatchControlsMixin -- cgit v1.2.3 From 0127e66228acd41402da9acab8ce91d394c3096f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Jul 2013 16:42:22 -0700 Subject: stat bars with no stats now show n/a instead of o --- indra/llcommon/lltracerecording.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 31616a52cc..f5e4ea603c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -333,6 +333,21 @@ namespace LLTrace const Recording& getPrevRecording(U32 offset) const; Recording snapshotCurRecording() const; + template + size_t getSampleCount(const TraceType& stat, size_t num_periods = U32_MAX) + { + size_t total_periods = mNumPeriods; + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + + size_t num_samples = 0; + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + total_periods - i) % total_periods; + num_samples += mRecordingPeriods[index].getSampleCount(stat); + } + return num_samples; + } + // // PERIODIC MIN // -- cgit v1.2.3 From f58eb60b1e0bbdf2148255c61100cbc20d1ba1b0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Aug 2013 08:17:21 -0700 Subject: SH-4374 WIP Interesting: Statistics Object cache hit rate is always 100% --- indra/llcommon/lltracerecording.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f5e4ea603c..51b411b7bd 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -209,6 +209,7 @@ namespace LLTrace // SampleStatHandle accessors + bool hasValue(const TraceType& stat); F64 getMin(const TraceType& stat); template T getMin(const SampleStatHandle& stat) -- cgit v1.2.3 From 8d3daa141e9ea14f533559843d77ab5c0f715421 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 16:14:19 -0700 Subject: SH-4374 FIX Interesting: Statistics Object cache hit rate is always 100% moved object cache sampling code so that it actually gets executed default values for stats are NaN instead of 0 in many cases --- indra/llcommon/lltracerecording.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 51b411b7bd..7ee8aba874 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -248,6 +248,8 @@ namespace LLTrace U32 getSampleCount(const TraceType& stat); // EventStatHandle accessors + bool hasValue(const TraceType& stat); + F64 getSum(const TraceType& stat); template typename RelatedTypes::sum_t getSum(const EventStatHandle& stat) -- cgit v1.2.3 From cc31b4ae7934010762b8aaaa7e190c74a1cd7820 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 12 Aug 2013 20:05:16 -0700 Subject: SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue bounces once per second SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary made llerrs/infos/etc properly variadic wrt tags LL_INFOS("A", "B", "C") works, for example fixed unit tests remove llsimplestat --- indra/llcommon/lltracerecording.h | 87 ++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 33 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 7ee8aba874..3722a61327 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -210,6 +210,7 @@ namespace LLTrace // SampleStatHandle accessors bool hasValue(const TraceType& stat); + F64 getMin(const TraceType& stat); template T getMin(const SampleStatHandle& stat) @@ -217,18 +218,18 @@ namespace LLTrace return (T)getMin(static_cast&> (stat)); } - F64 getMean(const TraceType& stat); + F64 getMax(const TraceType& stat); template - typename RelatedTypes::fractional_t getMean(SampleStatHandle& stat) + T getMax(const SampleStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); + return (T)getMax(static_cast&> (stat)); } - F64 getMax(const TraceType& stat); + F64 getMean(const TraceType& stat); template - T getMax(const SampleStatHandle& stat) + typename RelatedTypes::fractional_t getMean(SampleStatHandle& stat) { - return (T)getMax(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); } F64 getStandardDeviation(const TraceType& stat); @@ -345,8 +346,8 @@ namespace LLTrace size_t num_samples = 0; for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - num_samples += mRecordingPeriods[index].getSampleCount(stat); + Recording& recording = getPrevRecording(i); + num_samples += Recording.getSampleCount(stat); } return num_samples; } @@ -365,8 +366,8 @@ namespace LLTrace typename T::value_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - min_val = llmin(min_val, mRecordingPeriods[index].getSum(stat)); + Recording& recording = getPrevRecording(i) + min_val = llmin(min_val, recording.getSum(stat)); } return min_val; } @@ -397,11 +398,11 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - F64 min_val = std::numeric_limits::max(); + RelatedTypes::fractional_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - min_val = llmin(min_val, mRecordingPeriods[index].getPerSec(stat)); + Recording& recording = getPrevRecording(i); + min_val = llmin(min_val, recording.getPerSec(stat)); } return (typename RelatedTypes::fractional_t) min_val; } @@ -426,8 +427,8 @@ namespace LLTrace typename T::value_t max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - max_val = llmax(max_val, mRecordingPeriods[index].getSum(stat)); + Recording& recording = getPrevRecording(i); + max_val = llmax(max_val, recording.getSum(stat)); } return max_val; } @@ -461,8 +462,8 @@ namespace LLTrace F64 max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - max_val = llmax(max_val, mRecordingPeriods[index].getPerSec(stat)); + Recording& recording = getPrevRecording(i); + max_val = llmax(max_val, recording.getPerSec(stat)); } return (typename RelatedTypes::fractional_t)max_val; } @@ -479,24 +480,24 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::mean_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename T::mean_t mean = 0; - if (num_periods <= 0) { return mean; } + typename RelatedTypes::fractional_t mean = 0; for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - if (mRecordingPeriods[index].getDuration() > 0.f) + Recording& recording = getPrevRecording(i); + if (recording.getDuration() > 0.f) { - mean += mRecordingPeriods[index].getSum(stat); + mean += recording.getSum(stat); } } - mean = mean / num_periods; - return mean; + return RelatedTypes::fractional_t(num_periods + ? mean / num_periods + : NaN); } template @@ -519,24 +520,25 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename T::mean_t mean = 0; - if (num_periods <= 0) { return mean; } + typename RelatedTypes::fractional_t mean = 0; for (S32 i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + total_periods - i) % total_periods; - if (mRecordingPeriods[index].getDuration() > 0.f) + Recording& recording = getPrevRecording(i); + if (recording.getDuration() > 0.f) { - mean += mRecordingPeriods[index].getPerSec(stat); + mean += recording.getPerSec(stat); } } - mean = mean / num_periods; - return (typename RelatedTypes::fractional_t)mean; + + return RelatedTypes::fractional_t(num_periods + ? mean / num_periods + : NaN); } template @@ -545,6 +547,25 @@ namespace LLTrace return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); } + // + // PERIODIC STANDARD DEVIATION + // + + F64 getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + + template + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); + } + + F64 getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + template + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, size_t num_periods = U32_MAX) + { + return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); + } + private: // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); -- cgit v1.2.3 From 26581404e426b00cd0a07c38b5cb858d5d5faa28 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Aug 2013 11:51:49 -0700 Subject: BUILDFIX: added header for numeric_limits support on gcc added convenience types for units F32Seconds, etc. --- indra/llcommon/lltracerecording.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3722a61327..811786fbfa 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -166,12 +166,12 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - LLUnit getSum(const TraceType& stat); - LLUnit getSum(const TraceType& stat); + LLUnits::F64Seconds getSum(const TraceType& stat); + LLUnits::F64Seconds getSum(const TraceType& stat); U32 getSum(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); - LLUnit getPerSec(const TraceType& stat); + LLUnits::F64Seconds getPerSec(const TraceType& stat); + LLUnits::F64Seconds getPerSec(const TraceType& stat); F32 getPerSec(const TraceType& stat); // Memory accessors @@ -295,7 +295,7 @@ namespace LLTrace U32 getSampleCount(const TraceType& stat); - LLUnit getDuration() const { return mElapsedSeconds; } + LLUnits::F64Seconds getDuration() const { return mElapsedSeconds; } protected: friend class ThreadRecorder; @@ -310,7 +310,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - LLUnit mElapsedSeconds; + LLUnits::F64Seconds mElapsedSeconds; LLCopyOnWritePointer mBuffers; bool mInHandOff; @@ -325,7 +325,7 @@ namespace LLTrace void nextPeriod(); size_t getNumRecordedPeriods() { return mNumPeriods; } - LLUnit getDuration() const; + LLUnits::F64Seconds getDuration() const; void appendPeriodicRecording(PeriodicRecording& other); void appendRecording(Recording& recording); @@ -485,7 +485,7 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename RelatedTypes::fractional_t mean = 0; + typename RelatedTypes::fractional_t mean(0); for (S32 i = 1; i <= num_periods; i++) { @@ -495,9 +495,9 @@ namespace LLTrace mean += recording.getSum(stat); } } - return RelatedTypes::fractional_t(num_periods - ? mean / num_periods - : NaN); + return (num_periods + ? RelatedTypes::fractional_t(mean / num_periods) + : RelatedTypes::fractional_t(NaN)); } template @@ -536,9 +536,9 @@ namespace LLTrace } } - return RelatedTypes::fractional_t(num_periods - ? mean / num_periods - : NaN); + return (num_periods + ? RelatedTypes::fractional_t(mean / num_periods) + : RelatedTypes::fractional_t(NaN)); } template -- cgit v1.2.3 From a2dc1b7e55b27987f9b20d1e0470a8df77ecc595 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Aug 2013 17:45:15 -0700 Subject: BUILDFIX: more gcc fixes --- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 811786fbfa..3c23c6a3f6 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -347,7 +347,7 @@ namespace LLTrace for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); - num_samples += Recording.getSampleCount(stat); + num_samples += recording.getSampleCount(stat); } return num_samples; } @@ -366,7 +366,7 @@ namespace LLTrace typename T::value_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { - Recording& recording = getPrevRecording(i) + Recording& recording = getPrevRecording(i); min_val = llmin(min_val, recording.getSum(stat)); } return min_val; @@ -398,7 +398,7 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - RelatedTypes::fractional_t min_val = std::numeric_limits::max(); + typename RelatedTypes::fractional_t min_val = std::numeric_limits::max(); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -485,7 +485,7 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename RelatedTypes::fractional_t mean(0); + typename RelatedTypes::fractional_t mean(0); for (S32 i = 1; i <= num_periods; i++) { @@ -496,8 +496,8 @@ namespace LLTrace } } return (num_periods - ? RelatedTypes::fractional_t(mean / num_periods) - : RelatedTypes::fractional_t(NaN)); + ? RelatedTypes::fractional_t(mean / num_periods) + : RelatedTypes::fractional_t(NaN)); } template @@ -525,7 +525,7 @@ namespace LLTrace size_t total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename RelatedTypes::fractional_t mean = 0; + typename RelatedTypes::fractional_t mean = 0; for (S32 i = 1; i <= num_periods; i++) { @@ -537,8 +537,8 @@ namespace LLTrace } return (num_periods - ? RelatedTypes::fractional_t(mean / num_periods) - : RelatedTypes::fractional_t(NaN)); + ? RelatedTypes::fractional_t(mean / num_periods) + : RelatedTypes::fractional_t(NaN)); } template -- cgit v1.2.3 From 9f7bfa1c3710856cd2b0a0a8a429d6c45b0fcd09 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Aug 2013 00:02:23 -0700 Subject: moved unit types out of LLUnits namespace, since they are prefixed --- indra/llcommon/lltracerecording.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3c23c6a3f6..68b95a1003 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -166,26 +166,26 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - LLUnits::F64Seconds getSum(const TraceType& stat); - LLUnits::F64Seconds getSum(const TraceType& stat); + F64Seconds getSum(const TraceType& stat); + F64Seconds getSum(const TraceType& stat); U32 getSum(const TraceType& stat); - LLUnits::F64Seconds getPerSec(const TraceType& stat); - LLUnits::F64Seconds getPerSec(const TraceType& stat); + F64Seconds getPerSec(const TraceType& stat); + F64Seconds getPerSec(const TraceType& stat); F32 getPerSec(const TraceType& stat); // Memory accessors - LLUnit getMin(const TraceType& stat); - LLUnit getMean(const TraceType& stat); - LLUnit getMax(const TraceType& stat); - LLUnit getStandardDeviation(const TraceType& stat); - LLUnit getLastValue(const TraceType& stat); - - LLUnit getMin(const TraceType& stat); - LLUnit getMean(const TraceType& stat); - LLUnit getMax(const TraceType& stat); - LLUnit getStandardDeviation(const TraceType& stat); - LLUnit getLastValue(const TraceType& stat); + F64Bytes getMin(const TraceType& stat); + F64Bytes getMean(const TraceType& stat); + F64Bytes getMax(const TraceType& stat); + F64Bytes getStandardDeviation(const TraceType& stat); + F64Bytes getLastValue(const TraceType& stat); + + F64Bytes getMin(const TraceType& stat); + F64Bytes getMean(const TraceType& stat); + F64Bytes getMax(const TraceType& stat); + F64Bytes getStandardDeviation(const TraceType& stat); + F64Bytes getLastValue(const TraceType& stat); U32 getSum(const TraceType& stat); U32 getSum(const TraceType& stat); @@ -295,7 +295,7 @@ namespace LLTrace U32 getSampleCount(const TraceType& stat); - LLUnits::F64Seconds getDuration() const { return mElapsedSeconds; } + F64Seconds getDuration() const { return mElapsedSeconds; } protected: friend class ThreadRecorder; @@ -310,7 +310,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - LLUnits::F64Seconds mElapsedSeconds; + F64Seconds mElapsedSeconds; LLCopyOnWritePointer mBuffers; bool mInHandOff; @@ -325,7 +325,7 @@ namespace LLTrace void nextPeriod(); size_t getNumRecordedPeriods() { return mNumPeriods; } - LLUnits::F64Seconds getDuration() const; + F64Seconds getDuration() const; void appendPeriodicRecording(PeriodicRecording& other); void appendRecording(Recording& recording); -- cgit v1.2.3 From 52640b85c497e8b0a900ff3f1e051021b5485277 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Aug 2013 17:35:17 -0700 Subject: BUILDFIX: mac --- indra/llcommon/lltracerecording.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 68b95a1003..f5fb2bf561 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -496,8 +496,8 @@ namespace LLTrace } } return (num_periods - ? RelatedTypes::fractional_t(mean / num_periods) - : RelatedTypes::fractional_t(NaN)); + ? typename RelatedTypes::fractional_t(mean / num_periods) + : typename RelatedTypes::fractional_t(NaN)); } template @@ -537,8 +537,8 @@ namespace LLTrace } return (num_periods - ? RelatedTypes::fractional_t(mean / num_periods) - : RelatedTypes::fractional_t(NaN)); + ? typename RelatedTypes::fractional_t(mean / num_periods) + : typename RelatedTypes::fractional_t(NaN)); } template -- cgit v1.2.3 From 612892b45a3413b16e40c49d3bfde77a4ca927fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 18 Aug 2013 22:30:27 -0700 Subject: SH-4433 WIP: Interesting: Statistics > Ping Sim is always 0 ms continued conversion to units system made units perform type promotion correctly and preserve type in arithmetic e.g. can now do LLVector3 in units added typedefs for remaining common unit types, including implicits --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f5fb2bf561..ea090e6ee1 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -490,7 +490,7 @@ namespace LLTrace for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); - if (recording.getDuration() > 0.f) + if (recording.getDuration() > (F32Seconds)0.f) { mean += recording.getSum(stat); } @@ -530,7 +530,7 @@ namespace LLTrace for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); - if (recording.getDuration() > 0.f) + if (recording.getDuration() > (F32Seconds)0.f) { mean += recording.getPerSec(stat); } -- cgit v1.2.3 From 72f979135b3497d16c2635babf057900ddbc42fe Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 18 Sep 2013 14:20:30 -0700 Subject: merge --- indra/llcommon/lltracerecording.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index ea090e6ee1..9550838798 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -181,11 +181,11 @@ namespace LLTrace F64Bytes getStandardDeviation(const TraceType& stat); F64Bytes getLastValue(const TraceType& stat); - F64Bytes getMin(const TraceType& stat); - F64Bytes getMean(const TraceType& stat); - F64Bytes getMax(const TraceType& stat); - F64Bytes getStandardDeviation(const TraceType& stat); - F64Bytes getLastValue(const TraceType& stat); + F64Bytes getMin(const TraceType& stat); + F64Bytes getMean(const TraceType& stat); + F64Bytes getMax(const TraceType& stat); + F64Bytes getStandardDeviation(const TraceType& stat); + F64Bytes getLastValue(const TraceType& stat); U32 getSum(const TraceType& stat); U32 getSum(const TraceType& stat); -- cgit v1.2.3 From 0dfc08d22a21728ec670bd75e6fd0ed60c97bf06 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Sep 2013 15:21:46 -0700 Subject: BUILDFIX: more bad merge stuff also added ability for statbar to show memtrackable info --- indra/llcommon/lltracerecording.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 9550838798..edda0f3a8c 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -175,6 +175,9 @@ namespace LLTrace F32 getPerSec(const TraceType& stat); // Memory accessors + bool hasValue(const TraceType& stat); + bool hasValue(const TraceType& stat); + F64Bytes getMin(const TraceType& stat); F64Bytes getMean(const TraceType& stat); F64Bytes getMax(const TraceType& stat); @@ -392,6 +395,9 @@ namespace LLTrace return T(getPeriodMin(static_cast&>(stat), num_periods)); } + F64Bytes getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { @@ -453,6 +459,9 @@ namespace LLTrace return T(getPeriodMax(static_cast&>(stat), num_periods)); } + F64Bytes getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { @@ -519,6 +528,9 @@ namespace LLTrace return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } + F64Bytes getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) { @@ -566,6 +578,9 @@ namespace LLTrace return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } + F64Bytes getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); + private: // implementation for LLStopWatchControlsMixin /*virtual*/ void handleStart(); -- cgit v1.2.3 From 05ec5ca3d592ed7c730026582a2573d04c6e4c16 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Sep 2013 20:05:53 -0700 Subject: BUILDFIX: forgot forward declaration better overrides for memclaim and memdisclaim of sizes added occlusion stats to stats floater stats now render range instead of mean --- indra/llcommon/lltracerecording.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index edda0f3a8c..2f5cefa8eb 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -124,6 +124,8 @@ namespace LLTrace template class EventStatHandle; + class MemStatHandle; + template struct RelatedTypes { -- cgit v1.2.3 From e25b5a359faaf4bb51186235567fcb1fea15e440 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Sep 2013 16:07:32 -0700 Subject: refactored lltrace mem tracking to store allocation and deallocation sizes at the same time and work better with threads --- indra/llcommon/lltracerecording.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 2f5cefa8eb..466efe44ce 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -177,7 +177,7 @@ namespace LLTrace F32 getPerSec(const TraceType& stat); // Memory accessors - bool hasValue(const TraceType& stat); + bool hasValue(const TraceType& stat); bool hasValue(const TraceType& stat); F64Bytes getMin(const TraceType& stat); @@ -192,8 +192,21 @@ namespace LLTrace F64Bytes getStandardDeviation(const TraceType& stat); F64Bytes getLastValue(const TraceType& stat); - U32 getSum(const TraceType& stat); - U32 getSum(const TraceType& stat); + F64Bytes getSum(const TraceType& stat); + F64Bytes getPerSec(const TraceType& stat); + U32 getSampleCount(const TraceType& stat); + + F64Bytes getSum(const TraceType& stat); + F64Bytes getPerSec(const TraceType& stat); + U32 getSampleCount(const TraceType& stat); + + F64Bytes getSum(const TraceType& stat); + F64Bytes getPerSec(const TraceType& stat); + U32 getSampleCount(const TraceType& stat); + + F64Bytes getSum(const TraceType& stat); + F64Bytes getPerSec(const TraceType& stat); + U32 getSampleCount(const TraceType& stat); // CountStatHandle accessors F64 getSum(const TraceType& stat); -- cgit v1.2.3 From ab8f64a96754edaa68dd1ff97b9519eff4496aa6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 24 Sep 2013 00:05:43 -0700 Subject: converted memory tracking units to KB from B added more memory tracking to LLFolderView and kin --- indra/llcommon/lltracerecording.h | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 466efe44ce..3f7737b20b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -180,32 +180,32 @@ namespace LLTrace bool hasValue(const TraceType& stat); bool hasValue(const TraceType& stat); - F64Bytes getMin(const TraceType& stat); - F64Bytes getMean(const TraceType& stat); - F64Bytes getMax(const TraceType& stat); - F64Bytes getStandardDeviation(const TraceType& stat); - F64Bytes getLastValue(const TraceType& stat); - - F64Bytes getMin(const TraceType& stat); - F64Bytes getMean(const TraceType& stat); - F64Bytes getMax(const TraceType& stat); - F64Bytes getStandardDeviation(const TraceType& stat); - F64Bytes getLastValue(const TraceType& stat); - - F64Bytes getSum(const TraceType& stat); - F64Bytes getPerSec(const TraceType& stat); + F64Kilobytes getMin(const TraceType& stat); + F64Kilobytes getMean(const TraceType& stat); + F64Kilobytes getMax(const TraceType& stat); + F64Kilobytes getStandardDeviation(const TraceType& stat); + F64Kilobytes getLastValue(const TraceType& stat); + + F64Kilobytes getMin(const TraceType& stat); + F64Kilobytes getMean(const TraceType& stat); + F64Kilobytes getMax(const TraceType& stat); + F64Kilobytes getStandardDeviation(const TraceType& stat); + F64Kilobytes getLastValue(const TraceType& stat); + + F64Kilobytes getSum(const TraceType& stat); + F64Kilobytes getPerSec(const TraceType& stat); U32 getSampleCount(const TraceType& stat); - F64Bytes getSum(const TraceType& stat); - F64Bytes getPerSec(const TraceType& stat); + F64Kilobytes getSum(const TraceType& stat); + F64Kilobytes getPerSec(const TraceType& stat); U32 getSampleCount(const TraceType& stat); - F64Bytes getSum(const TraceType& stat); - F64Bytes getPerSec(const TraceType& stat); + F64Kilobytes getSum(const TraceType& stat); + F64Kilobytes getPerSec(const TraceType& stat); U32 getSampleCount(const TraceType& stat); - F64Bytes getSum(const TraceType& stat); - F64Bytes getPerSec(const TraceType& stat); + F64Kilobytes getSum(const TraceType& stat); + F64Kilobytes getPerSec(const TraceType& stat); U32 getSampleCount(const TraceType& stat); // CountStatHandle accessors @@ -410,8 +410,8 @@ namespace LLTrace return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64Bytes getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); template typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) @@ -474,8 +474,8 @@ namespace LLTrace return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64Bytes getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); template typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) @@ -543,8 +543,8 @@ namespace LLTrace return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64Bytes getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); template typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) @@ -593,8 +593,8 @@ namespace LLTrace return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64Bytes getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); - F64Bytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); private: // implementation for LLStopWatchControlsMixin -- cgit v1.2.3 From e0a443f5a6b76fd1ab5ffaa8e7a1941d47c80f4f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Sep 2013 11:18:39 -0700 Subject: BUILDFIX: fix for mac builds also, fixed alignment of tick labels on stat bars --- indra/llcommon/lltracerecording.h | 120 +++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 3f7737b20b..13dffdc701 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -144,7 +144,7 @@ namespace LLTrace struct RelatedTypes { typedef F64 fractional_t; - typedef U32 sum_t; + typedef S32 sum_t; }; class Recording @@ -170,7 +170,7 @@ namespace LLTrace // Timer accessors F64Seconds getSum(const TraceType& stat); F64Seconds getSum(const TraceType& stat); - U32 getSum(const TraceType& stat); + S32 getSum(const TraceType& stat); F64Seconds getPerSec(const TraceType& stat); F64Seconds getPerSec(const TraceType& stat); @@ -194,19 +194,19 @@ namespace LLTrace F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); // CountStatHandle accessors F64 getSum(const TraceType& stat); @@ -223,7 +223,7 @@ namespace LLTrace return (typename RelatedTypes::fractional_t)getPerSec(static_cast&> (stat)); } - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); // SampleStatHandle accessors @@ -264,7 +264,7 @@ namespace LLTrace return (T)getLastValue(static_cast&> (stat)); } - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); // EventStatHandle accessors bool hasValue(const TraceType& stat); @@ -311,7 +311,7 @@ namespace LLTrace return (T)getLastValue(static_cast&> (stat)); } - U32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const TraceType& stat); F64Seconds getDuration() const { return mElapsedSeconds; } @@ -338,10 +338,10 @@ namespace LLTrace : public LLStopWatchControlsMixin { public: - PeriodicRecording(U32 num_periods, EPlayState state = STOPPED); + PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); void nextPeriod(); - size_t getNumRecordedPeriods() { return mNumPeriods; } + S32 getNumRecordedPeriods() { return mNumPeriods; } F64Seconds getDuration() const; @@ -351,17 +351,17 @@ namespace LLTrace const Recording& getLastRecording() const; Recording& getCurRecording(); const Recording& getCurRecording() const; - Recording& getPrevRecording(U32 offset); - const Recording& getPrevRecording(U32 offset) const; + Recording& getPrevRecording(S32 offset); + const Recording& getPrevRecording(S32 offset) const; Recording snapshotCurRecording() const; template - size_t getSampleCount(const TraceType& stat, size_t num_periods = U32_MAX) + S32 getSampleCount(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - size_t num_samples = 0; + S32 num_samples = 0; for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -376,9 +376,9 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX) + typename T::value_t getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t min_val = std::numeric_limits::max(); @@ -391,32 +391,32 @@ namespace LLTrace } template - T getPeriodMin(const CountStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMin(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); template - T getPeriodMin(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMin(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); template - T getPeriodMin(const EventStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMin(const EventStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMin(const TraceType& stat, size_t num_periods = U32_MAX); - F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename RelatedTypes::fractional_t min_val = std::numeric_limits::max(); @@ -429,7 +429,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMinPerSec(static_cast&>(stat), num_periods)); } @@ -440,9 +440,9 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX) + typename T::value_t getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename T::value_t max_val = std::numeric_limits::min(); @@ -455,32 +455,32 @@ namespace LLTrace } template - T getPeriodMax(const CountStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMax(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); template - T getPeriodMax(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMax(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); template - T getPeriodMax(const EventStatHandle& stat, size_t num_periods = U32_MAX) + T getPeriodMax(const EventStatHandle& stat, S32 num_periods = S32_MAX) { return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMax(const TraceType& stat, size_t num_periods = U32_MAX); - F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); F64 max_val = std::numeric_limits::min(); @@ -493,7 +493,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMaxPerSec(static_cast&>(stat), num_periods)); } @@ -504,9 +504,9 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename RelatedTypes::fractional_t getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename RelatedTypes::fractional_t mean(0); @@ -525,31 +525,31 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMean(const TraceType& stat, size_t num_periods = U32_MAX); - F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, S32 num_periods = S32_MAX) { - size_t total_periods = mNumPeriods; + S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); typename RelatedTypes::fractional_t mean = 0; @@ -569,7 +569,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); } @@ -578,23 +578,23 @@ namespace LLTrace // PERIODIC STANDARD DEVIATION // - F64 getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64 getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); + F64 getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, size_t num_periods = U32_MAX) + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, S32 num_periods = S32_MAX) { return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodStandardDeviation(const TraceType& stat, size_t num_periods = U32_MAX); - F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = U32_MAX); + F64Kilobytes getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX); private: // implementation for LLStopWatchControlsMixin @@ -606,8 +606,8 @@ namespace LLTrace private: std::vector mRecordingPeriods; const bool mAutoResize; - size_t mCurPeriod; - size_t mNumPeriods; + S32 mCurPeriod; + S32 mNumPeriods; }; PeriodicRecording& get_frame_recording(); -- cgit v1.2.3 From 12f0f8cb72f789e21b01b45063dcc5f1f5292087 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 13:46:43 -0700 Subject: changed over to manual naming of MemTrackable stats changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats --- indra/llcommon/lltracerecording.h | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 13dffdc701..085780198d 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -30,7 +30,6 @@ #include "stdtypes.h" #include "llpreprocessor.h" -#include "llpointer.h" #include "lltimer.h" #include "lltraceaccumulators.h" @@ -178,7 +177,6 @@ namespace LLTrace // Memory accessors bool hasValue(const TraceType& stat); - bool hasValue(const TraceType& stat); F64Kilobytes getMin(const TraceType& stat); F64Kilobytes getMean(const TraceType& stat); @@ -186,12 +184,6 @@ namespace LLTrace F64Kilobytes getStandardDeviation(const TraceType& stat); F64Kilobytes getLastValue(const TraceType& stat); - F64Kilobytes getMin(const TraceType& stat); - F64Kilobytes getMean(const TraceType& stat); - F64Kilobytes getMax(const TraceType& stat); - F64Kilobytes getStandardDeviation(const TraceType& stat); - F64Kilobytes getLastValue(const TraceType& stat); - F64Kilobytes getSum(const TraceType& stat); F64Kilobytes getPerSec(const TraceType& stat); S32 getSampleCount(const TraceType& stat); @@ -200,14 +192,6 @@ namespace LLTrace F64Kilobytes getPerSec(const TraceType& stat); S32 getSampleCount(const TraceType& stat); - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); - - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); - // CountStatHandle accessors F64 getSum(const TraceType& stat); template -- cgit v1.2.3 From b3d42e9b99db7e14354338383239122ef4cbeade Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 20:22:20 -0700 Subject: BUILDFIX: missing header --- indra/llcommon/lltracerecording.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 085780198d..5cf7596966 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -32,6 +32,7 @@ #include "lltimer.h" #include "lltraceaccumulators.h" +#include "llpointer.h" class LLStopWatchControlsMixinCommon { -- cgit v1.2.3 From 754e8752a9b9a2e75d425a10cb8a0a6f85ad4bf5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 3 Oct 2013 14:30:34 -0700 Subject: added initial memory usage tracking for lltrace --- indra/llcommon/lltracerecording.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 5cf7596966..8bb0b1892f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -313,7 +313,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - F64Seconds mElapsedSeconds; + F64Seconds mElapsedSeconds; LLCopyOnWritePointer mBuffers; bool mInHandOff; @@ -324,6 +324,7 @@ namespace LLTrace { public: PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); + ~PeriodicRecording(); void nextPeriod(); S32 getNumRecordedPeriods() { return mNumPeriods; } -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/llcommon/lltracerecording.h | 166 +++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 8bb0b1892f..810f796666 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -113,7 +113,7 @@ private: namespace LLTrace { template - class TraceType; + class StatType; template class CountStatHandle; @@ -168,135 +168,135 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors - F64Seconds getSum(const TraceType& stat); - F64Seconds getSum(const TraceType& stat); - S32 getSum(const TraceType& stat); + F64Seconds getSum(const StatType& stat); + F64Seconds getSum(const StatType& stat); + S32 getSum(const StatType& stat); - F64Seconds getPerSec(const TraceType& stat); - F64Seconds getPerSec(const TraceType& stat); - F32 getPerSec(const TraceType& stat); + F64Seconds getPerSec(const StatType& stat); + F64Seconds getPerSec(const StatType& stat); + F32 getPerSec(const StatType& stat); // Memory accessors - bool hasValue(const TraceType& stat); + bool hasValue(const StatType& stat); - F64Kilobytes getMin(const TraceType& stat); - F64Kilobytes getMean(const TraceType& stat); - F64Kilobytes getMax(const TraceType& stat); - F64Kilobytes getStandardDeviation(const TraceType& stat); - F64Kilobytes getLastValue(const TraceType& stat); + F64Kilobytes getMin(const StatType& stat); + F64Kilobytes getMean(const StatType& stat); + F64Kilobytes getMax(const StatType& stat); + F64Kilobytes getStandardDeviation(const StatType& stat); + F64Kilobytes getLastValue(const StatType& stat); - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); + F64Kilobytes getSum(const StatType& stat); + F64Kilobytes getPerSec(const StatType& stat); + S32 getSampleCount(const StatType& stat); - F64Kilobytes getSum(const TraceType& stat); - F64Kilobytes getPerSec(const TraceType& stat); - S32 getSampleCount(const TraceType& stat); + F64Kilobytes getSum(const StatType& stat); + F64Kilobytes getPerSec(const StatType& stat); + S32 getSampleCount(const StatType& stat); // CountStatHandle accessors - F64 getSum(const TraceType& stat); + F64 getSum(const StatType& stat); template typename RelatedTypes::sum_t getSum(const CountStatHandle& stat) { - return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); + return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); } - F64 getPerSec(const TraceType& stat); + F64 getPerSec(const StatType& stat); template typename RelatedTypes::fractional_t getPerSec(const CountStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getPerSec(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getPerSec(static_cast&> (stat)); } - S32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const StatType& stat); // SampleStatHandle accessors - bool hasValue(const TraceType& stat); + bool hasValue(const StatType& stat); - F64 getMin(const TraceType& stat); + F64 getMin(const StatType& stat); template T getMin(const SampleStatHandle& stat) { - return (T)getMin(static_cast&> (stat)); + return (T)getMin(static_cast&> (stat)); } - F64 getMax(const TraceType& stat); + F64 getMax(const StatType& stat); template T getMax(const SampleStatHandle& stat) { - return (T)getMax(static_cast&> (stat)); + return (T)getMax(static_cast&> (stat)); } - F64 getMean(const TraceType& stat); + F64 getMean(const StatType& stat); template typename RelatedTypes::fractional_t getMean(SampleStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); } - F64 getStandardDeviation(const TraceType& stat); + F64 getStandardDeviation(const StatType& stat); template typename RelatedTypes::fractional_t getStandardDeviation(const SampleStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); } - F64 getLastValue(const TraceType& stat); + F64 getLastValue(const StatType& stat); template T getLastValue(const SampleStatHandle& stat) { - return (T)getLastValue(static_cast&> (stat)); + return (T)getLastValue(static_cast&> (stat)); } - S32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const StatType& stat); // EventStatHandle accessors - bool hasValue(const TraceType& stat); + bool hasValue(const StatType& stat); - F64 getSum(const TraceType& stat); + F64 getSum(const StatType& stat); template typename RelatedTypes::sum_t getSum(const EventStatHandle& stat) { - return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); + return (typename RelatedTypes::sum_t)getSum(static_cast&> (stat)); } - F64 getMin(const TraceType& stat); + F64 getMin(const StatType& stat); template T getMin(const EventStatHandle& stat) { - return (T)getMin(static_cast&> (stat)); + return (T)getMin(static_cast&> (stat)); } - F64 getMax(const TraceType& stat); + F64 getMax(const StatType& stat); template T getMax(const EventStatHandle& stat) { - return (T)getMax(static_cast&> (stat)); + return (T)getMax(static_cast&> (stat)); } - F64 getMean(const TraceType& stat); + F64 getMean(const StatType& stat); template typename RelatedTypes::fractional_t getMean(EventStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getMean(static_cast&> (stat)); } - F64 getStandardDeviation(const TraceType& stat); + F64 getStandardDeviation(const StatType& stat); template typename RelatedTypes::fractional_t getStandardDeviation(const EventStatHandle& stat) { - return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); + return (typename RelatedTypes::fractional_t)getStandardDeviation(static_cast&> (stat)); } - F64 getLastValue(const TraceType& stat); + F64 getLastValue(const StatType& stat); template T getLastValue(const EventStatHandle& stat) { - return (T)getLastValue(static_cast&> (stat)); + return (T)getLastValue(static_cast&> (stat)); } - S32 getSampleCount(const TraceType& stat); + S32 getSampleCount(const StatType& stat); F64Seconds getDuration() const { return mElapsedSeconds; } @@ -342,7 +342,7 @@ namespace LLTrace Recording snapshotCurRecording() const; template - S32 getSampleCount(const TraceType& stat, S32 num_periods = S32_MAX) + S32 getSampleCount(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -362,7 +362,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX) + typename T::value_t getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -379,28 +379,28 @@ namespace LLTrace template T getPeriodMin(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMin(static_cast&>(stat), num_periods)); + return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); template T getPeriodMin(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMin(static_cast&>(stat), num_periods)); + return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); template T getPeriodMin(const EventStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMin(static_cast&>(stat), num_periods)); + return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMin(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMinPerSec(const TraceType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -417,7 +417,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMinPerSec(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMinPerSec(static_cast&>(stat), num_periods)); } // @@ -426,7 +426,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX) + typename T::value_t getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -443,28 +443,28 @@ namespace LLTrace template T getPeriodMax(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMax(static_cast&>(stat), num_periods)); + return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); template T getPeriodMax(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMax(static_cast&>(stat), num_periods)); + return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); template T getPeriodMax(const EventStatHandle& stat, S32 num_periods = S32_MAX) { - return T(getPeriodMax(static_cast&>(stat), num_periods)); + return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMax(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMaxPerSec(const TraceType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -481,7 +481,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMaxPerSec(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMaxPerSec(static_cast&>(stat), num_periods)); } // @@ -490,7 +490,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename RelatedTypes::fractional_t getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -513,27 +513,27 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); template typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); template typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMean(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const TraceType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const StatType& stat, S32 num_periods = S32_MAX) { S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); @@ -557,29 +557,29 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); } // // PERIODIC STANDARD DEVIATION // - F64 getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); template typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64 getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); + F64 getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); template typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, S32 num_periods = S32_MAX) { - return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); + return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodStandardDeviation(const TraceType& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX); private: -- cgit v1.2.3 From 18aedf0241ba893e12140c0a3855f328d2b4eded Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 17 Oct 2013 19:18:53 -0700 Subject: fix for assert at runtime (reading stats from recording while it was active) fix for bad values returns from getPeriodMin and getPeriodMax on count stats when no counts recorded fix for gcc compile time error (typename ftw) --- indra/llcommon/lltracerecording.h | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 810f796666..4b7a5ef0da 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -168,6 +168,7 @@ namespace LLTrace void makeUnique() { mBuffers.makeUnique(); } // Timer accessors + bool hasValue(const StatType& stat); F64Seconds getSum(const StatType& stat); F64Seconds getSum(const StatType& stat); S32 getSum(const StatType& stat); @@ -178,22 +179,24 @@ namespace LLTrace // Memory accessors bool hasValue(const StatType& stat); - F64Kilobytes getMin(const StatType& stat); F64Kilobytes getMean(const StatType& stat); F64Kilobytes getMax(const StatType& stat); F64Kilobytes getStandardDeviation(const StatType& stat); F64Kilobytes getLastValue(const StatType& stat); + bool hasValue(const StatType& stat); F64Kilobytes getSum(const StatType& stat); F64Kilobytes getPerSec(const StatType& stat); S32 getSampleCount(const StatType& stat); + bool hasValue(const StatType& stat); F64Kilobytes getSum(const StatType& stat); F64Kilobytes getPerSec(const StatType& stat); S32 getSampleCount(const StatType& stat); // CountStatHandle accessors + bool hasValue(const StatType& stat); F64 getSum(const StatType& stat); template typename RelatedTypes::sum_t getSum(const CountStatHandle& stat) @@ -367,13 +370,21 @@ namespace LLTrace S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename T::value_t min_val = std::numeric_limits::max(); + bool has_value = false; + T::value_t min_val(std::numeric_limits::max()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); - min_val = llmin(min_val, recording.getSum(stat)); + if (recording.hasValue(stat)) + { + min_val = llmin(min_val, recording.getSum(stat)); + has_value = true; + } } - return min_val; + + return has_value + ? min_val + : T::getDefaultValue(); } template @@ -405,7 +416,7 @@ namespace LLTrace S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename RelatedTypes::fractional_t min_val = std::numeric_limits::max(); + typename RelatedTypes::fractional_t min_val(std::numeric_limits::max()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -431,13 +442,21 @@ namespace LLTrace S32 total_periods = mNumPeriods; num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); - typename T::value_t max_val = std::numeric_limits::min(); + bool has_value = false; + T::value_t max_val(std::numeric_limits::min()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); - max_val = llmax(max_val, recording.getSum(stat)); + if (recording.hasValue(stat)) + { + max_val = llmax(max_val, recording.getSum(stat)); + has_value = true; + } } - return max_val; + + return has_value + ? max_val + : T::getDefaultValue(); } template -- cgit v1.2.3 From 9f097380b85a307db472726175c3515fdeb5aed5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 Oct 2013 09:14:53 -0700 Subject: removed asserts in order to get testable builds again added unpause() behavior and changed pause() to do nothing when already stopped --- indra/llcommon/lltracerecording.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4b7a5ef0da..4e94c2110b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -46,16 +46,18 @@ public: STARTED }; - void start(); - void stop(); - void pause(); - void resume(); - void restart(); - void reset(); + void start(); // moves to started state, resetting if stopped + void stop(); // moves to stopped state + void pause(); // moves to paused state, unless stopped + void unpause(); // moves to started state if paused + void resume(); // moves to started state, without resetting + void restart(); // moves to started state, always resetting + void reset(); // resets bool isStarted() const { return mPlayState == STARTED; } bool isPaused() const { return mPlayState == PAUSED; } bool isStopped() const { return mPlayState == STOPPED; } + EPlayState getPlayState() const { return mPlayState; } // force play state to specific value by calling appropriate handle* methods void setPlayState(EPlayState state); @@ -66,11 +68,13 @@ protected: {} private: - // trigger active behavior (without reset) + // override these methods to provide started/stopped semantics + + // activate behavior (without reset) virtual void handleStart() = 0; - // stop active behavior + // deactivate behavior virtual void handleStop() = 0; - // clear accumulated state, can be called while started + // clear accumulated state, may be called while started virtual void handleReset() = 0; EPlayState mPlayState; -- cgit v1.2.3 From 8b93238b42fdd8b2b6d9b944d4ebb3099f119904 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 Oct 2013 10:04:29 -0700 Subject: BUILDFIX: forgot typename --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 4e94c2110b..eb94354189 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -375,7 +375,7 @@ namespace LLTrace num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); bool has_value = false; - T::value_t min_val(std::numeric_limits::max()); + typename T::value_t min_val(std::numeric_limits::max()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -447,7 +447,7 @@ namespace LLTrace num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); bool has_value = false; - T::value_t max_val(std::numeric_limits::min()); + typename T::value_t max_val(std::numeric_limits::min()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); -- cgit v1.2.3 From d2cf7ba42931bb7ecf637fbf4ff25c7837c3296f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 Oct 2013 13:34:25 -0700 Subject: more forgotten typenames --- indra/llcommon/lltracerecording.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index eb94354189..b045aafa11 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -375,7 +375,7 @@ namespace LLTrace num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); bool has_value = false; - typename T::value_t min_val(std::numeric_limits::max()); + typename T::value_t min_val(std::numeric_limits::max()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); @@ -447,7 +447,7 @@ namespace LLTrace num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); bool has_value = false; - typename T::value_t max_val(std::numeric_limits::min()); + typename T::value_t max_val(std::numeric_limits::min()); for (S32 i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); -- cgit v1.2.3 From 1dfba44b3dc14564c99333dedb7a380a160aee44 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 21 Oct 2013 14:22:21 -0700 Subject: fixed things so that trace recordings can be read from even while active --- indra/llcommon/lltracerecording.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index b045aafa11..93ac276e33 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -322,7 +322,7 @@ namespace LLTrace LLTimer mSamplingTimer; F64Seconds mElapsedSeconds; LLCopyOnWritePointer mBuffers; - bool mInHandOff; + AccumulatorBufferGroup* mActiveBuffers; }; -- cgit v1.2.3 From e6110bb1cc88c7d353caaeb698e4764e846d521f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 15 Nov 2013 22:06:41 -0800 Subject: fix for fast timer view having runaway time slot wasn't stopping recording when merging into fast timer view stream --- indra/llcommon/lltracerecording.h | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'indra/llcommon/lltracerecording.h') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 93ac276e33..d0b4a842a6 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -334,7 +334,11 @@ namespace LLTrace ~PeriodicRecording(); void nextPeriod(); - S32 getNumRecordedPeriods() { return mNumPeriods; } + S32 getNumRecordedPeriods() + { + // current period counts if not active + return mNumRecordedPeriods + (isStarted() ? 0 : 1); + } F64Seconds getDuration() const; @@ -351,8 +355,7 @@ namespace LLTrace template S32 getSampleCount(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); S32 num_samples = 0; for (S32 i = 1; i <= num_periods; i++) @@ -371,8 +374,7 @@ namespace LLTrace template typename T::value_t getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); bool has_value = false; typename T::value_t min_val(std::numeric_limits::max()); @@ -417,8 +419,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMinPerSec(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); typename RelatedTypes::fractional_t min_val(std::numeric_limits::max()); for (S32 i = 1; i <= num_periods; i++) @@ -443,8 +444,7 @@ namespace LLTrace template typename T::value_t getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); bool has_value = false; typename T::value_t max_val(std::numeric_limits::min()); @@ -489,8 +489,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMaxPerSec(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); F64 max_val = std::numeric_limits::min(); for (S32 i = 1; i <= num_periods; i++) @@ -515,8 +514,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); typename RelatedTypes::fractional_t mean(0); @@ -558,8 +556,7 @@ namespace LLTrace template typename RelatedTypes::fractional_t getPeriodMeanPerSec(const StatType& stat, S32 num_periods = S32_MAX) { - S32 total_periods = mNumPeriods; - num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + num_periods = llmin(num_periods, getNumRecordedPeriods()); typename RelatedTypes::fractional_t mean = 0; @@ -616,7 +613,7 @@ namespace LLTrace std::vector mRecordingPeriods; const bool mAutoResize; S32 mCurPeriod; - S32 mNumPeriods; + S32 mNumRecordedPeriods; }; PeriodicRecording& get_frame_recording(); -- cgit v1.2.3