diff options
author | Richard Linden <none@none> | 2013-09-19 15:21:46 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-09-19 15:21:46 -0700 |
commit | 0dfc08d22a21728ec670bd75e6fd0ed60c97bf06 (patch) | |
tree | 96c67d4b22b00ac38104182e97d174efaee21e30 /indra/llcommon | |
parent | 02dc270620bab6d3bd8035294af4be5b35894b1c (diff) |
BUILDFIX: more bad merge stuff
also added ability for statbar to show memtrackable info
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lltrace.h | 26 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 102 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.h | 15 |
3 files changed, 136 insertions, 7 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 3b4370f947..f677e4349e 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -512,12 +512,17 @@ public: return value; } + const size_t& memClaim(const size_t& size) + { + claim_mem(sMemStat, size); + mMemFootprint += size; + return size; + } - template<typename AMOUNT_T> - AMOUNT_T& memClaimAmount(AMOUNT_T& size) + size_t& memClaim(size_t& size) { - MemStatAccumulator& accumulator = sMemStat.getCurrentAccumulator(); - mMemFootprint += (size_t)size; + claim_mem(sMemStat, size); + mMemFootprint += size; return size; } @@ -536,10 +541,17 @@ public: return value; } - template<typename AMOUNT_T> - AMOUNT_T& memDisclaimAmount(AMOUNT_T& size) + const size_t& memDisclaim(const size_t& size) + { + disclaim_mem(sMemStat, size); + mMemFootprint -= size; + return size; + } + + size_t& memDisclaim(size_t& size) { - disclaim_mem(size); + disclaim_mem(sMemStat, size); + mMemFootprint -= size; return size; } diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index c278901bc0..7155cfa40a 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -168,6 +168,16 @@ F32 Recording::getPerSec(const TraceType<TimeBlockAccumulator::CallCountFacet>& return (F32)mBuffers->mStackTimers[stat.getIndex()].mCalls / mElapsedSeconds.value(); } +bool Recording::hasValue(const TraceType<MemStatAccumulator>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mSize.hasValue(); +} + +bool Recording::hasValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat) +{ + return mBuffers->mMemStats[stat.getIndex()].mShadowSize.hasValue(); +} + F64Bytes Recording::getMin(const TraceType<MemStatAccumulator>& stat) { return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mSize.getMin()); @@ -707,6 +717,98 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const TraceType<SampleAccumul : NaN; } + +F64Bytes PeriodicRecording::getPeriodMin( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +{ + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + + F64Bytes min_val(std::numeric_limits<F64>::max()); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + min_val = llmin(min_val, recording.getMin(stat)); + } + + return min_val; +} + +F64Bytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, size_t num_periods) +{ + return getPeriodMin(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); +} + +F64Bytes PeriodicRecording::getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/) +{ + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + + F64Bytes max_val(0.0); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + max_val = llmax(max_val, recording.getMax(stat)); + } + + return max_val; +} + +F64Bytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, size_t num_periods) +{ + return getPeriodMax(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); +} + +F64Bytes PeriodicRecording::getPeriodMean( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +{ + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + + F64Bytes mean(0); + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + mean += recording.getMean(stat); + } + + return mean / F64(num_periods); +} + +F64Bytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, size_t num_periods) +{ + return getPeriodMean(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); +} + +F64Bytes PeriodicRecording::getPeriodStandardDeviation( const TraceType<MemStatAccumulator>& stat, size_t num_periods /*= U32_MAX*/ ) +{ + size_t total_periods = mRecordingPeriods.size(); + num_periods = llmin(num_periods, isStarted() ? total_periods - 1 : total_periods); + + F64Bytes period_mean = getPeriodMean(stat, num_periods); + S32 valid_period_count = 0; + F64 sum_of_squares = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + F64Bytes delta = recording.getMean(stat) - period_mean; + sum_of_squares += delta.value() * delta.value(); + valid_period_count++; + } + } + + return F64Bytes(valid_period_count + ? sqrt(sum_of_squares / (F64)valid_period_count) + : NaN); +} + +F64Bytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods) +{ + return getPeriodStandardDeviation(static_cast<const TraceType<MemStatAccumulator>&>(stat), num_periods); +} + /////////////////////////////////////////////////////////////////////// // ExtendableRecording /////////////////////////////////////////////////////////////////////// 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<TimeBlockAccumulator::CallCountFacet>& stat); // Memory accessors + bool hasValue(const TraceType<MemStatAccumulator>& stat);
+ bool hasValue(const TraceType<MemStatAccumulator::ShadowMemFacet>& stat); + F64Bytes getMin(const TraceType<MemStatAccumulator>& stat); F64Bytes getMean(const TraceType<MemStatAccumulator>& stat); F64Bytes getMax(const TraceType<MemStatAccumulator>& stat); @@ -392,6 +395,9 @@ namespace LLTrace return T(getPeriodMin(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } + F64Bytes getPeriodMin(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) { @@ -453,6 +459,9 @@ namespace LLTrace return T(getPeriodMax(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } + F64Bytes getPeriodMax(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) { @@ -519,6 +528,9 @@ namespace LLTrace return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } + F64Bytes getPeriodMean(const TraceType<MemStatAccumulator>& stat, size_t num_periods = U32_MAX); + F64Bytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = U32_MAX); + template <typename T> typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const TraceType<T>& stat, size_t num_periods = U32_MAX) { @@ -566,6 +578,9 @@ namespace LLTrace return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const TraceType<EventAccumulator>&>(stat), num_periods)); } + F64Bytes getPeriodStandardDeviation(const TraceType<MemStatAccumulator>& 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(); |