summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstats.h
diff options
context:
space:
mode:
authorAnkur Ahlawat <anchor@lindenlab.com>2018-01-17 15:53:56 -0800
committerAnkur Ahlawat <anchor@lindenlab.com>2018-01-17 15:53:56 -0800
commit5a12a88f7b53bb99a6b302c35d891a8ecee59855 (patch)
treedd52f7a9f76ac5d696a517f351371ceb619b7d30 /indra/newview/llviewerstats.h
parentd4ce47b09122d1f76601ba402c2b9ad6bb504950 (diff)
parent7acbd8ed8d73c507675d45360df07d232c431a8b (diff)
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/newview/llviewerstats.h')
-rw-r--r--indra/newview/llviewerstats.h86
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;