diff options
author | Richard Linden <none@none> | 2012-10-12 20:17:52 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-10-12 20:17:52 -0700 |
commit | 041dfccd1ea5b59c1b3c4e37e9a5495cad342c8f (patch) | |
tree | 27f7785f0cf095ec69816c5ed877ff605dbf6789 /indra | |
parent | 0f58ca02cdec62711eadb82ba28fcff08faef2ee (diff) |
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
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llpointer.h | 2 | ||||
-rw-r--r-- | indra/llcommon/lltrace.h | 93 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 18 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.h | 69 | ||||
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/llunit.h | 130 | ||||
-rw-r--r-- | indra/llui/llstatbar.cpp | 25 | ||||
-rw-r--r-- | indra/llui/llstatbar.h | 2 | ||||
-rw-r--r-- | indra/llui/llstatgraph.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llstatgraph.h | 5 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 1 | ||||
-rwxr-xr-x | indra/newview/llviewerstats.cpp | 98 | ||||
-rwxr-xr-x | indra/newview/llviewerstats.h | 86 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 6 |
16 files changed, 243 insertions, 310 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 0fee4f0990..6a3bbeb768 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -207,7 +207,9 @@ public: using LLPointer<Type>::operator >; + operator Type*() { return mPointer; } operator const Type*() const { return mPointer; } + Type* operator->() { return mPointer; } const Type* operator->() const { return mPointer; } }; diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 0c618a2f4b..221c226ad1 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -91,6 +91,11 @@ namespace LLTrace return mStorage[index]; } + LL_FORCE_INLINE const ACCUMULATOR& operator[](size_t index) const + { + return mStorage[index]; + } + void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other) { llassert(mNextStorageSlot == other.mNextStorageSlot); @@ -178,7 +183,7 @@ namespace LLTrace } ACCUMULATOR& getAccumulator(AccumulatorBuffer<ACCUMULATOR>* buffer) { return (*buffer)[mAccumulatorIndex]; } - const ACCUMULATOR& getAccumulator(AccumulatorBuffer<ACCUMULATOR>* buffer) const { return (*buffer)[mAccumulatorIndex]; } + const ACCUMULATOR& getAccumulator(const AccumulatorBuffer<ACCUMULATOR>* buffer) const { return (*buffer)[mAccumulatorIndex]; } protected: std::string mName; @@ -213,9 +218,9 @@ namespace LLTrace { mMax = value; } - F32 old_mean = mMean; - mMean += ((F32)value - old_mean) / (F32)mNumSamples; - mVarianceSum += ((F32)value - old_mean) * ((F32)value - mMean); + F64 old_mean = mMean; + mMean += ((F64)value - old_mean) / (F64)mNumSamples; + mVarianceSum += ((F64)value - old_mean) * ((F64)value - mMean); mLastValue = value; } @@ -231,14 +236,14 @@ namespace LLTrace mMax = other.mMax; } mNumSamples += other.mNumSamples; - F32 weight = (F32)mNumSamples / (F32)(mNumSamples + other.mNumSamples); + F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); mMean = mMean * weight + other.mMean * (1.f - weight); - F32 n_1 = (F32)mNumSamples, - n_2 = (F32)other.mNumSamples; - F32 m_1 = mMean, + F64 n_1 = (F64)mNumSamples, + n_2 = (F64)other.mNumSamples; + F64 m_1 = mMean, m_2 = other.mMean; - F32 sd_1 = getStandardDeviation(), + F64 sd_1 = getStandardDeviation(), sd_2 = other.getStandardDeviation(); // combine variance (and hence standard deviation) of 2 different sized sample groups using // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm @@ -275,8 +280,8 @@ namespace LLTrace T getMin() const { return mMin; } T getMax() const { return mMax; } T getLastValue() const { return mLastValue; } - F32 getMean() const { return mMean; } - F32 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); } private: T mSum, @@ -284,17 +289,17 @@ namespace LLTrace mMax, mLastValue; - F32 mMean, + F64 mMean, mVarianceSum; U32 mNumSamples; }; template<typename T> - class LL_COMMON_API RateAccumulator + class LL_COMMON_API CountAccumulator { public: - RateAccumulator() + CountAccumulator() : mSum(0), mNumSamples(0) {} @@ -305,7 +310,7 @@ namespace LLTrace mSum += value; } - void addSamples(const RateAccumulator<T>& other) + void addSamples(const CountAccumulator<T>& other) { mSum += other.mSum; mNumSamples += other.mNumSamples; @@ -325,7 +330,7 @@ namespace LLTrace U32 mNumSamples; }; - template <typename T, typename IS_UNIT = void> + template <typename T = F64, typename IS_UNIT = void> class LL_COMMON_API Measurement : public TraceType<MeasurementAccumulator<T> >, public LLInstanceTracker<Measurement<T, IS_UNIT>, std::string> @@ -352,8 +357,8 @@ namespace LLTrace public: typedef typename T::storage_t storage_t; typedef typename T::base_unit_t base_unit_t; - typedef Measurement<typename T::value_t> base_measurement_t; + Measurement(const char* name, const char* description = NULL) : Measurement<typename T::value_t>(name) {} @@ -361,20 +366,20 @@ namespace LLTrace template<typename UNIT_T> void sample(UNIT_T value) { - base_measurement_t::sample(value.value()); + base_measurement_t::sample(((T)value).value()); } }; - template <typename T, typename IS_UNIT = void> - class LL_COMMON_API Rate - : public TraceType<RateAccumulator<T> >, - public LLInstanceTracker<Rate<T>, std::string> + template <typename T = F64, typename IS_UNIT = void> + class LL_COMMON_API Count + : public TraceType<CountAccumulator<T> >, + public LLInstanceTracker<Count<T>, std::string> { public: typedef T storage_t; typedef T base_unit_t; - Rate(const char* name, const char* description = NULL) + Count(const char* name, const char* description = NULL) : TraceType(name), LLInstanceTracker(name) {} @@ -386,53 +391,23 @@ namespace LLTrace }; template <typename T> - class LL_COMMON_API Rate <T, typename T::is_unit_t> - : public Rate<typename T::value_t> + class LL_COMMON_API Count <T, typename T::is_unit_t> + : public Count<typename T::value_t> { public: typedef typename T::storage_t storage_t; typedef typename T::base_unit_t base_unit_t; + typedef Count<typename T::value_t> base_count_t; - Rate(const char* name, const char* description = NULL) - : Rate<typename T::value_t>(name) + Count(const char* name, const char* description = NULL) + : Count<typename T::value_t>(name) {} template<typename UNIT_T> void add(UNIT_T value) { - getPrimaryAccumulator().add(value.value()); - } - }; - - template <typename T> - class LL_COMMON_API Count - { - public: - typedef typename Rate<T>::base_unit_t base_unit_t; - - Count(const char* name) - : mIncrease(name + "_increase"), - mDecrease(name + "_decrease"), - mTotal(name) - {} - - void count(T value) - { - if (value < 0) - { - mDecrease.add(value * -1); - } - else - { - mIncrease.add(value); - } - mTotal.add(value); + base_count_t::add(((T)value).value()); } - private: - friend LLTrace::Recording; - Rate<T> mIncrease; - Rate<T> mDecrease; - Rate<T> mTotal; }; class LL_COMMON_API TimerAccumulator diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 5d7b231b7d..9a769ff344 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -39,8 +39,8 @@ namespace LLTrace Recording::Recording() : mElapsedSeconds(0), - mRates(new AccumulatorBuffer<RateAccumulator<F32> >()), - mMeasurements(new AccumulatorBuffer<MeasurementAccumulator<F32> >()), + mCounts(new AccumulatorBuffer<CountAccumulator<F64> >()), + mMeasurements(new AccumulatorBuffer<MeasurementAccumulator<F64> >()), mStackTimers(new AccumulatorBuffer<TimerAccumulator>()) {} @@ -59,7 +59,7 @@ void Recording::update() void Recording::handleReset() { - mRates.write()->reset(); + mCounts.write()->reset(); mMeasurements.write()->reset(); mStackTimers.write()->reset(); @@ -88,21 +88,22 @@ void Recording::handleSplitTo(Recording& other) void Recording::makePrimary() { - mRates.write()->makePrimary(); + mCounts.write()->makePrimary(); mMeasurements.write()->makePrimary(); mStackTimers.write()->makePrimary(); } bool Recording::isPrimary() const { - return mRates->isPrimary(); + return mCounts->isPrimary(); } void Recording::mergeRecording( const Recording& other ) { - mRates.write()->addSamples(*other.mRates); + mCounts.write()->addSamples(*other.mCounts); mMeasurements.write()->addSamples(*other.mMeasurements); mStackTimers.write()->addSamples(*other.mStackTimers); + mElapsedSeconds += other.mElapsedSeconds; } /////////////////////////////////////////////////////////////////////// @@ -149,9 +150,9 @@ Recording& PeriodicRecording::getTotalRecording() if (!mTotalValid) { mTotalRecording.reset(); - for (S32 i = (mCurPeriod + 1) % mNumPeriods; i < mCurPeriod; i++) + for (S32 i = mCurPeriod + 1; i < mCurPeriod + mNumPeriods; i++) { - mTotalRecording.mergeRecording(mRecordingPeriods[i]); + mTotalRecording.mergeRecording(mRecordingPeriods[i % mNumPeriods]); } } mTotalValid = true; @@ -212,7 +213,6 @@ void ExtendableRecording::handleSplitTo( ExtendableRecording& other ) PeriodicRecording& get_frame_recording() { static PeriodicRecording sRecording(64); - sRecording.start(); return sRecording; } 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 T, typename IS_UNIT> - typename Rate<T, IS_UNIT>::base_unit_t getSum(const Rate<T, IS_UNIT>& stat) const + typename Count<T, IS_UNIT>::base_unit_t getSum(const Count<T, IS_UNIT>& stat) const { - return (typename Rate<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mRates).getSum(); + return (typename Count<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mCounts).getSum(); } template <typename T, typename IS_UNIT> - typename Rate<T, IS_UNIT>::base_unit_t getPerSec(const Rate<T, IS_UNIT>& stat) const + typename Count<T, IS_UNIT>::base_unit_t getPerSec(const Count<T, IS_UNIT>& stat) const { - return (typename Rate<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mRates).getSum() / mElapsedSeconds; + return (typename Count<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds; } // Measurement accessors @@ -135,7 +135,7 @@ namespace LLTrace template <typename T, typename IS_UNIT> typename Measurement<T, IS_UNIT>::base_unit_t getPerSec(const Measurement<T, IS_UNIT>& stat) const { - return (typename Rate<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; + return (typename Count<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds; } template <typename T, typename IS_UNIT> @@ -151,7 +151,7 @@ namespace LLTrace } template <typename T, typename IS_UNIT> - typename Measurement<T, IS_UNIT>::base_unit_t getMean(const Measurement<T, IS_UNIT>& stat) const + typename Measurement<T, IS_UNIT>::base_unit_t getMean(Measurement<T, IS_UNIT>& stat) const { return (typename Measurement<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mMeasurements).getMean(); } @@ -168,56 +168,7 @@ namespace LLTrace return (typename Measurement<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mMeasurements).getLastValue(); } - // Count accessors - template <typename T> - typename Count<T>::base_unit_t getSum(const Count<T>& stat) const - { - return getSum(stat.mTotal); - } - - template <typename T> - typename Count<T>::base_unit_t getPerSec(const Count<T>& stat) const - { - return getPerSec(stat.mTotal); - } - - template <typename T> - typename Count<T>::base_unit_t getIncrease(const Count<T>& stat) const - { - return getPerSec(stat.mTotal); - } - - template <typename T> - typename Count<T>::base_unit_t getIncreasePerSec(const Count<T>& stat) const - { - return getPerSec(stat.mIncrease); - } - - template <typename T> - typename Count<T>::base_unit_t getDecrease(const Count<T>& stat) const - { - return getPerSec(stat.mDecrease); - } - - template <typename T> - typename Count<T>::base_unit_t getDecreasePerSec(const Count<T>& stat) const - { - return getPerSec(stat.mDecrease); - } - - template <typename T> - typename Count<T>::base_unit_t getChurn(const Count<T>& stat) const - { - return getIncrease(stat) + getDecrease(stat); - } - - template <typename T> - typename Count<T>::base_unit_t getChurnPerSec(const Count<T>& 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<AccumulatorBuffer<RateAccumulator<F32> > > mRates; - LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F32> > > mMeasurements; + LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<F64> > > mCounts; + LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F64> > > mMeasurements; LLCopyOnWritePointer<AccumulatorBuffer<TimerAccumulator> > mStackTimers; LLTimer mSamplingTimer; diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 48aa1a42f2..02dc55771b 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -114,10 +114,10 @@ ThreadRecorder::ActiveRecording::ActiveRecording( Recording* target ) void ThreadRecorder::ActiveRecording::moveBaselineToTarget() { mTargetRecording->mMeasurements.write()->addSamples(*mBaseline.mMeasurements); - mTargetRecording->mRates.write()->addSamples(*mBaseline.mRates); + mTargetRecording->mCounts.write()->addSamples(*mBaseline.mCounts); mTargetRecording->mStackTimers.write()->addSamples(*mBaseline.mStackTimers); mBaseline.mMeasurements.write()->reset(); - mBaseline.mRates.write()->reset(); + mBaseline.mCounts.write()->reset(); mBaseline.mStackTimers.write()->reset(); } diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 2664bd77e9..090e42607e 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -51,7 +51,7 @@ struct LLUnitType : public BASE_UNIT value_t value() const { - return convertToDerived(mValue); + return convertToDerived(mBaseValue); } template<typename CONVERTED_TYPE> @@ -72,22 +72,22 @@ struct LLUnitType : public BASE_UNIT unit_t operator + (const unit_t other) const { - return unit_t(mValue + other.mValue); + return unit_t(mBaseValue + other.mBaseValue); } unit_t operator - (const unit_t other) const { - return unit_t(mValue - other.mValue); + return unit_t(mBaseValue - other.mBaseValue); } unit_t operator * (value_t multiplicand) const { - return unit_t(mValue * multiplicand); + return unit_t(mBaseValue * multiplicand); } unit_t operator / (value_t divisor) const { - return unit_t(mValue / divisor); + return unit_t(mBaseValue / divisor); } }; @@ -100,11 +100,11 @@ struct LLUnitType<STORAGE_TYPE, T, T> typedef void is_unit_t; LLUnitType() - : mValue() + : mBaseValue() {} explicit LLUnitType(value_t value) - : mValue(value) + : mBaseValue(value) {} unit_t& operator=(value_t value) @@ -118,7 +118,7 @@ struct LLUnitType<STORAGE_TYPE, T, T> return static_cast<unit_t&>(*this); } - value_t value() { return mValue; } + value_t value() const { return mBaseValue; } static value_t convertToBase(value_t derived_value) { @@ -132,73 +132,73 @@ struct LLUnitType<STORAGE_TYPE, T, T> unit_t operator + (const unit_t other) const { - return unit_t(mValue + other.mValue); + return unit_t(mBaseValue + other.mBaseValue); } void operator += (const unit_t other) { - mValue += other.mValue; + mBaseValue += other.mBaseValue; } unit_t operator - (const unit_t other) const { - return unit_t(mValue - other.mValue); + return unit_t(mBaseValue - other.mBaseValue); } void operator -= (const unit_t other) { - mValue -= other.mValue; + mBaseValue -= other.mBaseValue; } unit_t operator * (value_t multiplicand) const { - return unit_t(mValue * multiplicand); + return unit_t(mBaseValue * multiplicand); } void operator *= (value_t multiplicand) { - mValue *= multiplicand; + mBaseValue *= multiplicand; } unit_t operator / (value_t divisor) const { - return unit_t(mValue / divisor); + return unit_t(mBaseValue / divisor); } void operator /= (value_t divisor) { - mValue /= divisor; + mBaseValue /= divisor; } protected: void setBaseValue(value_t value) { - mValue = value; + mBaseValue = value; } - value_t mValue; + value_t mBaseValue; }; -#define LL_DECLARE_BASE_UNIT(unit_name) \ - template<typename STORAGE_TYPE> \ - struct unit_name : public LLUnitType<STORAGE_TYPE, unit_name<STORAGE_TYPE> > \ - { \ - typedef unit_name<STORAGE_TYPE> base_unit_t; \ - typedef STORAGE_TYPE storage_t; \ +#define LL_DECLARE_BASE_UNIT(unit_name) \ + struct unit_name : public LLUnitType<F64, unit_name> \ + { \ + typedef unit_name base_unit_t; \ + typedef LLUnitType<F64, unit_name> unit_t; \ + typedef F64 storage_t; \ \ - unit_name(STORAGE_TYPE value) \ + unit_name(F64 value) \ : LLUnitType(value) \ - {} \ - \ - unit_name() \ - {} \ - \ + {} \ + \ + unit_name() \ + {} \ + \ template <typename SOURCE_STORAGE_TYPE, typename SOURCE_TYPE> \ unit_name(const LLUnitType<SOURCE_STORAGE_TYPE, unit_name, SOURCE_TYPE>& source) \ - { \ - setBaseValue(source.unit_t::value()); \ - } \ - \ + { \ + setBaseValue((F64)source.unit_name::unit_t::value()); \ + } \ + \ using LLUnitType::operator +; \ using LLUnitType::operator +=; \ using LLUnitType::operator -; \ @@ -209,36 +209,36 @@ protected: using LLUnitType::operator /=; \ }; -#define LL_DECLARE_DERIVED_UNIT(base_unit, derived_unit, conversion_factor) \ - template<typename STORAGE_TYPE> \ - struct derived_unit : public LLUnitType<STORAGE_TYPE, base_unit<STORAGE_TYPE>, derived_unit<STORAGE_TYPE> > \ - { \ - typedef base_unit<STORAGE_TYPE> base_unit_t; \ - typedef STORAGE_TYPE storage_t; \ - \ - derived_unit(value_t value) \ - : LLUnitType(value) \ - {} \ - \ - derived_unit() \ - {} \ - \ - template <typename SOURCE_STORAGE_TYPE, typename SOURCE_TYPE> \ - derived_unit(const LLUnitType<SOURCE_STORAGE_TYPE, base_unit<STORAGE_TYPE>, SOURCE_TYPE>& source) \ - { \ - setBaseValue(source.base_unit_t::value()); \ - } \ - \ - static F32 conversionToBaseFactor() { return (F32)(conversion_factor); } \ - \ - using LLUnitType::operator +; \ - using LLUnitType::operator +=; \ - using LLUnitType::operator -; \ - using LLUnitType::operator -=; \ - using LLUnitType::operator *; \ - using LLUnitType::operator *=; \ - using LLUnitType::operator /; \ - using LLUnitType::operator /=; \ +#define LL_DECLARE_DERIVED_UNIT(base_unit, derived_unit, conversion_factor) \ + struct derived_unit : public LLUnitType<F64, base_unit, derived_unit> \ + { \ + typedef base_unit base_unit_t; \ + typedef LLUnitType<F64, base_unit, derived_unit> unit_t; \ + typedef F64 storage_t; \ + \ + derived_unit(value_t value) \ + : LLUnitType(value) \ + {} \ + \ + derived_unit() \ + {} \ + \ + template <typename SOURCE_STORAGE_TYPE, typename SOURCE_TYPE> \ + derived_unit(const LLUnitType<SOURCE_STORAGE_TYPE, base_unit, SOURCE_TYPE>& source) \ + { \ + setBaseValue((F64)source.base_unit::unit_t::value()); \ + } \ + \ + static F32 conversionToBaseFactor() { return (F32)(conversion_factor); } \ + \ + using LLUnitType::operator +; \ + using LLUnitType::operator +=; \ + using LLUnitType::operator -; \ + using LLUnitType::operator -=; \ + using LLUnitType::operator *; \ + using LLUnitType::operator *=; \ + using LLUnitType::operator /; \ + using LLUnitType::operator /=; \ }; namespace LLUnits @@ -248,7 +248,7 @@ namespace LLUnits LL_DECLARE_DERIVED_UNIT(Bytes, Megabytes, 1024 * 1024); LL_DECLARE_DERIVED_UNIT(Bytes, Gigabytes, 1024 * 1024 * 1024); LL_DECLARE_DERIVED_UNIT(Bytes, Bits, (1.f / 8.f)); - LL_DECLARE_DERIVED_UNIT(Bytes, Kilobit, (1024 / 8)); + LL_DECLARE_DERIVED_UNIT(Bytes, Kilobits, (1024 / 8)); LL_DECLARE_DERIVED_UNIT(Bytes, Megabits, (1024 / 8)); LL_DECLARE_DERIVED_UNIT(Bytes, Gigabits, (1024 * 1024 * 1024 / 8)); diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index b73007e107..c60e5431ae 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -47,7 +47,7 @@ LLStatBar::LLStatBar(const Params& p) mMinBar(p.bar_min), mMaxBar(p.bar_max), mStatp(LLStat::getInstance(p.stat)), - mFloatStatp(LLTrace::Rate<F32>::getInstance(p.stat)), + mNewStatp(LLTrace::Count<>::getInstance(p.stat)), mTickSpacing(p.tick_spacing), mLabelSpacing(p.label_spacing), mPrecision(p.precision), @@ -109,22 +109,25 @@ void LLStatBar::draw() mean = mStatp->getMean(); } } - else if (mFloatStatp) + else if (mNewStatp) { - LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod(); + LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod(); + LLTrace::Recording& windowed_frame_recording = frame_recording.getTotalRecording(); + if (mPerSec) { - current = recording.getPerSec(*mFloatStatp); - //min = recording->getMin(*mFloatStatp) / recording->getSampleTime(); - //max = recording->getMax(*mFloatStatp) / recording->getSampleTime(); - //mean = recording->getMean(*mFloatStatp) / recording->getSampleTime(); + current = last_frame_recording.getPerSec(*mNewStatp); + //min = frame_window_recording.getMin(*mNewStatp) / frame_window_recording.getDuration(); + //max = frame_window_recording.getMax(*mNewStatp) / frame_window_recording.getDuration(); + mean = windowed_frame_recording.getPerSec(*mNewStatp);//frame_window_recording.getMean(*mNewStatp) / frame_window_recording.getDuration(); } else { - current = recording.getSum(*mFloatStatp); - //min = recording->getMin(*mFloatStatp); - //max = recording->getMax(*mFloatStatp); - //mean = recording->getMean(*mFloatStatp); + current = last_frame_recording.getSum(*mNewStatp); + //min = last_frame_recording.getMin(*mNewStatp); + //max = last_frame_recording.getMax(*mNewStatp); + mean = windowed_frame_recording.getSum(*mNewStatp); } } diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index bfc49b9204..e4b0c61c42 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -99,7 +99,7 @@ private: LLTrace::PeriodicRecording* mFrameRecording; LLStat* mStatp; - LLTrace::Rate<F32>* mFloatStatp; + LLTrace::Count<>* mNewStatp; LLFrameTimer mUpdateTimer; LLUIString mLabel; diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 21b55c7c5a..be3baeea76 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -49,7 +49,7 @@ LLStatGraph::LLStatGraph(const Params& p) mPrecision(p.precision), mValue(p.value), mStatp(p.stat.legacy_stat), - mF32Statp(p.stat.rate_stat) + mNewStatp(p.stat.rate_stat) { setToolTip(p.name()); @@ -84,17 +84,17 @@ void LLStatGraph::draw() mValue = mStatp->getMean(); } } - else if (mF32Statp) + else if (mNewStatp) { LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod(); if (mPerSec) { - mValue = recording.getPerSec(*mF32Statp); + mValue = recording.getPerSec(*mNewStatp); } else { - mValue = recording.getSum(*mF32Statp); + mValue = recording.getSum(*mNewStatp); } } diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 69fc36ea52..54a959f49e 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -60,7 +60,7 @@ public: struct StatParams : public LLInitParam::ChoiceBlock<StatParams> { Alternative<LLStat*> legacy_stat; - Alternative<LLTrace::Rate<F32>* > rate_stat; + Alternative<LLTrace::Count<>* > rate_stat; }; struct Params : public LLInitParam::Block<Params, LLView::Params> @@ -106,8 +106,7 @@ public: private: LLStat* mStatp; - LLTrace::Rate<F32>* mF32Statp; - LLTrace::Rate<S32>* mS32Statp; + LLTrace::Count<>* mNewStatp; BOOL mPerSec; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 2ce5f95b54..f2caa01644 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2316,7 +2316,7 @@ S32 LLTextureFetch::update(F32 max_time_ms) if(mCurlGetRequest) { - LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bits<F32> >(mCurlGetRequest->getTotalReceivedBits()); + LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bits>(mCurlGetRequest->getTotalReceivedBits()); //gTextureList.sTextureBits += mCurlGetRequest->getTotalReceivedBits(); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 79ed093382..ec7d91ec4f 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4772,7 +4772,6 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) //LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value); break; case LL_SIM_STAT_FRAMEMS: - //LLStatViewer::SIM_.sample(stat_value); LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value); break; case LL_SIM_STAT_NETMS: diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index bed2dffb14..a3d04d655a 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -64,7 +64,7 @@ namespace LLStatViewer { -LLTrace::Rate<F32> FPS("fpsstat"), +LLTrace::Count<> FPS("fpsstat"), PACKETS_IN("packetsinstat"), PACKETS_LOST("packetsloststat"), PACKETS_OUT("packetsoutstat"), @@ -90,7 +90,7 @@ LLTrace::Rate<F32> FPS("fpsstat"), FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"), TEX_BAKES("texbakes"), TEX_REBAKES("texrebakes"); -LLTrace::Rate<LLUnits::Bytes<F32> > KBIT("kbitstat"), +LLTrace::Count<LLUnits::Kilobits> KBIT("kbitstat"), LAYERS_KBIT("layerskbitstat"), OBJECT_KBIT("objectkbitstat"), ASSET_KBIT("assetkbitstat"), @@ -98,17 +98,17 @@ LLTrace::Rate<LLUnits::Bytes<F32> > KBIT("kbitstat"), ACTUAL_IN_KBIT("actualinkbit"), ACTUAL_OUT_KBIT("actualoutkbit"); -LLTrace::Rate<LLUnits::Seconds<F32> > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"), - TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), - MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), - FPS_10_TIME("fps10time", "Seconds below 10 FPS"), - FPS_8_TIME("fps8time", "Seconds below 8 FPS"), - FPS_2_TIME("fps2time", "Seconds below 2 FPS"), - SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"), - SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"), - LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%"); - -LLTrace::Measurement<F32> SIM_TIME_DILATION("simtimedilation"), +LLTrace::Count<LLUnits::Seconds> AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"), + TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), + MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), + FPS_10_TIME("fps10time", "Seconds below 10 FPS"), + FPS_8_TIME("fps8time", "Seconds below 8 FPS"), + FPS_2_TIME("fps2time", "Seconds below 2 FPS"), + SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"), + SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"), + LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%"); + +LLTrace::Measurement<> SIM_TIME_DILATION("simtimedilation"), SIM_FPS("simfps"), SIM_PHYSICS_FPS("simphysicsfps"), SIM_AGENT_UPS("simagentups"), @@ -147,36 +147,36 @@ LLTrace::Measurement<F32> SIM_TIME_DILATION("simtimedilation"), WINDOW_WIDTH("windowwidth", "Window width"), WINDOW_HEIGHT("windowheight", "Window height"); -LLTrace::Measurement<LLUnits::Bytes<F32> > SIM_UNACKED_BYTES("simtotalunackedbytes"), - SIM_PHYSICS_MEM("physicsmemoryallocated"), - GL_TEX_MEM("gltexmemstat"), - GL_BOUND_MEM("glboundmemstat"), - RAW_MEM("rawmemstat"), - FORMATTED_MEM("formattedmemstat"); - - -LLTrace::Measurement<LLUnits::Seconds<F32> > SIM_PHYSICS_TIME("simsimphysicsmsec"), - SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec"), - SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec"), - SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec"), - SIM_AI_TIME("simsimaistepmsec"), - SIM_AGENTS_TIME("simagentmsec"), - SIM_IMAGES_TIME("simimagesmsec"), - SIM_SCRIPTS_TIME("simscriptmsec"), - SIM_SPARE_TIME("simsparemsec"), - SIM_SLEEP_TIME("simsleepmsec"), - SIM_PUMP_IO_TIME("simpumpiomsec"), - SIM_PING("simpingstat"), - FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), - FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), - LOGIN_SECONDS("loginseconds", "Time between LoginRequest and LoginReply"), - REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), - FRAME_STACKTIME("framestacktime", "FRAME_SECS"), - UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), - NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), - IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), - REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), - RENDER_STACKTIME("renderstacktime", "RENDER_SECS"); +LLTrace::Measurement<LLUnits::Bytes> SIM_UNACKED_BYTES("simtotalunackedbytes"), + SIM_PHYSICS_MEM("physicsmemoryallocated"), + GL_TEX_MEM("gltexmemstat"), + GL_BOUND_MEM("glboundmemstat"), + RAW_MEM("rawmemstat"), + FORMATTED_MEM("formattedmemstat"); + + +LLTrace::Measurement<LLUnits::Seconds> SIM_PHYSICS_TIME("simsimphysicsmsec"), + SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec"), + SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec"), + SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec"), + SIM_AI_TIME("simsimaistepmsec"), + SIM_AGENTS_TIME("simagentmsec"), + SIM_IMAGES_TIME("simimagesmsec"), + SIM_SCRIPTS_TIME("simscriptmsec"), + SIM_SPARE_TIME("simsparemsec"), + SIM_SLEEP_TIME("simsleepmsec"), + SIM_PUMP_IO_TIME("simpumpiomsec"), + SIM_PING("simpingstat"), + FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), + FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), + LOGIN_SECONDS("loginseconds", "Time between LoginRequest and LoginReply"), + REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), + FRAME_STACKTIME("framestacktime", "FRAME_SECS"), + UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), + NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), + IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), + REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), + RENDER_STACKTIME("renderstacktime", "RENDER_SECS"); } class StatAttributes @@ -266,6 +266,7 @@ LLViewerStats::LLViewerStats() : mAgentPositionSnaps.reset(); mRecording.start(); + LLTrace::get_frame_recording().start(); } LLViewerStats::~LLViewerStats() @@ -437,25 +438,28 @@ void update_statistics() LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost()); if (cdp) { + LLStatViewer::SIM_PING.sample<LLUnits::Seconds>(cdp->getPingDelay()); stats.mSimPingStat.addValue(cdp->getPingDelay()); gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1); gSimPingCount++; } else { + LLUnits::Seconds i(10000); + LLStatViewer::SIM_PING.sample(i);//<LLUnits::Seconds<U32> >(10000); stats.mSimPingStat.addValue(10000); } //stats.mFPSStat.addValue(1); LLStatViewer::FPS.add(1); F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); - LLStatViewer::LAYERS_KBIT.add<LLUnits::Bits<F32> >(layer_bits); + LLStatViewer::LAYERS_KBIT.add<LLUnits::Bits>(layer_bits); //stats.mLayersKBitStat.addValue(layer_bits/1024.f); - LLStatViewer::OBJECT_KBIT.add<LLUnits::Bits<F32> >(gObjectBits); + LLStatViewer::OBJECT_KBIT.add<LLUnits::Bits>(gObjectBits); //stats.mObjectKBitStat.addValue(gObjectBits/1024.f); //stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); LLStatViewer::SIM_PENDING_VFS_OPERATIONS.sample(LLVFile::getVFSThread()->getPending()); - LLStatViewer::ASSET_KBIT.add<LLUnits::Bits<F32> >(gTransferManager.getTransferBitsIn(LLTCT_ASSET)); + LLStatViewer::ASSET_KBIT.add<LLUnits::Bits>(gTransferManager.getTransferBitsIn(LLTCT_ASSET)); //stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); gTransferManager.resetTransferBitsIn(LLTCT_ASSET); @@ -493,7 +497,7 @@ void update_statistics() static LLFrameTimer texture_stats_timer; if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq) { - gTotalTextureBytes = LLUnits::Bytes<F32>(LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_KBIT)).value(); + gTotalTextureBytes = LLUnits::Bytes(LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_KBIT)).value(); texture_stats_timer.reset(); } } diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index a164a28a59..5412294cf2 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -34,7 +34,7 @@ namespace LLStatViewer { -extern LLTrace::Rate<F32> FPS, +extern LLTrace::Count<> FPS, PACKETS_IN, PACKETS_LOST, PACKETS_OUT, @@ -62,7 +62,7 @@ extern LLTrace::Rate<F32> FPS, TEX_REBAKES; -extern LLTrace::Rate<LLUnits::Bytes<F32> > KBIT, +extern LLTrace::Count<LLUnits::Kilobits> KBIT, LAYERS_KBIT, OBJECT_KBIT, ASSET_KBIT, @@ -70,17 +70,17 @@ extern LLTrace::Rate<LLUnits::Bytes<F32> > KBIT, ACTUAL_IN_KBIT, ACTUAL_OUT_KBIT; -extern LLTrace::Rate<LLUnits::Seconds<F32> > AVATAR_EDIT_TIME, - TOOLBOX_TIME, - MOUSELOOK_TIME, - FPS_10_TIME, - FPS_8_TIME, - FPS_2_TIME, - SIM_20_FPS_TIME, - SIM_PHYSICS_20_FPS_TIME, - LOSS_5_PERCENT_TIME; - -extern LLTrace::Measurement<F32> SIM_TIME_DILATION, +extern LLTrace::Count<LLUnits::Seconds> AVATAR_EDIT_TIME, + TOOLBOX_TIME, + MOUSELOOK_TIME, + FPS_10_TIME, + FPS_8_TIME, + FPS_2_TIME, + SIM_20_FPS_TIME, + SIM_PHYSICS_20_FPS_TIME, + LOSS_5_PERCENT_TIME; + +extern LLTrace::Measurement<> SIM_TIME_DILATION, SIM_FPS, SIM_PHYSICS_FPS, SIM_AGENT_UPS, @@ -119,36 +119,36 @@ extern LLTrace::Measurement<F32> SIM_TIME_DILATION, WINDOW_WIDTH, WINDOW_HEIGHT; -extern LLTrace::Measurement<LLUnits::Bytes<F32> > SIM_UNACKED_BYTES, - SIM_PHYSICS_MEM, - GL_TEX_MEM, - GL_BOUND_MEM, - RAW_MEM, - FORMATTED_MEM; - - -extern LLTrace::Measurement<LLUnits::Seconds<F32> > SIM_PHYSICS_TIME, - SIM_PHYSICS_STEP_TIME, - SIM_PHYSICS_SHAPE_UPDATE_TIME, - SIM_PHYSICS_OTHER_TIME, - SIM_AI_TIME, - SIM_AGENTS_TIME, - SIM_IMAGES_TIME, - SIM_SCRIPTS_TIME, - SIM_SPARE_TIME, - SIM_SLEEP_TIME, - SIM_PUMP_IO_TIME, - SIM_PING, - FRAMETIME_JITTER, - FRAMETIME_SLEW, - LOGIN_SECONDS, - REGION_CROSSING_TIME, - FRAME_STACKTIME, - UPDATE_STACKTIME, - NETWORK_STACKTIME, - IMAGE_STACKTIME, - REBUILD_STACKTIME, - RENDER_STACKTIME; +extern LLTrace::Measurement<LLUnits::Bytes> SIM_UNACKED_BYTES, + SIM_PHYSICS_MEM, + GL_TEX_MEM, + GL_BOUND_MEM, + RAW_MEM, + FORMATTED_MEM; + + +extern LLTrace::Measurement<LLUnits::Seconds> SIM_PHYSICS_TIME, + SIM_PHYSICS_STEP_TIME, + SIM_PHYSICS_SHAPE_UPDATE_TIME, + SIM_PHYSICS_OTHER_TIME, + SIM_AI_TIME, + SIM_AGENTS_TIME, + SIM_IMAGES_TIME, + SIM_SCRIPTS_TIME, + SIM_SPARE_TIME, + SIM_SLEEP_TIME, + SIM_PUMP_IO_TIME, + SIM_PING, + FRAMETIME_JITTER, + FRAMETIME_SLEW, + LOGIN_SECONDS, + REGION_CROSSING_TIME, + FRAME_STACKTIME, + UPDATE_STACKTIME, + NETWORK_STACKTIME, + IMAGE_STACKTIME, + REBUILD_STACKTIME, + RENDER_STACKTIME; } class LLViewerStats : public LLSingleton<LLViewerStats> diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index af28ea36eb..ccfedd8881 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1325,7 +1325,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d { received_size = msg->getReceiveSize() ; } - LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes<F32> >(received_size); + LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes>(received_size); LLStatViewer::TEXTURE_PACKETS.add(1); U8 codec; @@ -1399,7 +1399,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d received_size = msg->getReceiveSize() ; } - LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes<F32> >(received_size); + LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes>(received_size); LLStatViewer::TEXTURE_PACKETS.add(1); //llprintline("Start decode, image header..."); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 056132c165..9e495c46b1 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -703,11 +703,11 @@ void LLWorld::updateNetStats() S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits(); S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); - LLStatViewer::ACTUAL_IN_KBIT.add<LLUnits::Bits<F32> >(actual_in_bits); - LLStatViewer::ACTUAL_OUT_KBIT.add<LLUnits::Bits<F32> >(actual_out_bits); + LLStatViewer::ACTUAL_IN_KBIT.add<LLUnits::Bits>(actual_in_bits); + LLStatViewer::ACTUAL_OUT_KBIT.add<LLUnits::Bits>(actual_out_bits); //LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f); //LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f); - LLStatViewer::KBIT.add<LLUnits::Bits<F32> >(bits); + LLStatViewer::KBIT.add<LLUnits::Bits>(bits); //LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); LLStatViewer::PACKETS_IN.add(packets_in); LLStatViewer::PACKETS_OUT.add(packets_out); |