summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstats.h
diff options
context:
space:
mode:
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;