diff options
author | Rider Linden <rider@lindenlab.com> | 2017-07-28 14:07:25 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2017-07-28 14:07:25 -0700 |
commit | 57d5744f2c064ccb7bf8dd3dca2a24f6755297ac (patch) | |
tree | cef79679961afaf2ef43f21c6f4901ed3f536fb0 /indra/newview/llviewerstats.h | |
parent | b46697fcc155d026b5a951256d53581e7af20036 (diff) |
MAINT-7634: Move StatsAccumulator into llcommon, collect data sent and error codes from core.
Diffstat (limited to 'indra/newview/llviewerstats.h')
-rw-r--r-- | indra/newview/llviewerstats.h | 86 |
1 files changed, 3 insertions, 83 deletions
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 97a060d95e..d8d92d61d3 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -30,7 +30,7 @@ #include "lltextureinfo.h" #include "lltracerecording.h" #include "lltrace.h" - +#include "llstatsaccumulator.h" enum ESimStatID { @@ -256,89 +256,9 @@ public: void addToMessage(LLSD &body); - struct StatsAccumulator - { - S32 mCount; - F32 mSum; - F32 mSumOfSquares; - F32 mMinValue; - F32 mMaxValue; - U32 mCountOfNextUpdatesToIgnore; - - inline StatsAccumulator() - { - reset(); - } - - inline void push( F32 val ) - { - if ( mCountOfNextUpdatesToIgnore > 0 ) - { - mCountOfNextUpdatesToIgnore--; - return; - } - - mCount++; - mSum += val; - mSumOfSquares += val * val; - if (mCount == 1 || val > mMaxValue) - { - mMaxValue = val; - } - if (mCount == 1 || val < mMinValue) - { - mMinValue = val; - } - } - - inline F32 getMean() const - { - return (mCount == 0) ? 0.f : ((F32)mSum)/mCount; - } - - inline F32 getMinValue() const - { - return mMinValue; - } - - inline F32 getMaxValue() const - { - return mMaxValue; - } - - inline F32 getStdDev() const - { - const F32 mean = getMean(); - return (mCount < 2) ? 0.f : sqrt(llmax(0.f,mSumOfSquares/mCount - (mean * mean))); - } - - inline U32 getCount() const - { - return mCount; - } - - inline void reset() - { - mCount = 0; - mSum = mSumOfSquares = 0.f; - mMinValue = 0.0f; - mMaxValue = 0.0f; - mCountOfNextUpdatesToIgnore = 0; - } - - inline LLSD asLLSD() const - { - LLSD data; - data["mean"] = getMean(); - data["std_dev"] = getStdDev(); - data["count"] = (S32)mCount; - data["min"] = getMinValue(); - data["max"] = getMaxValue(); - return data; - } - }; + typedef LLStatsAccumulator StatsAccumulator; - // Phase tracking (originally put in for avatar rezzing), tracking + // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. typedef std::map<std::string,LLTimer> phase_map_t; typedef std::map<std::string,StatsAccumulator> phase_stats_t; |