summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstats.h
diff options
context:
space:
mode:
authorMatthew Breindel (Falcon) <falcon@lindenlab.com>2010-07-13 17:16:05 -0700
committerMatthew Breindel (Falcon) <falcon@lindenlab.com>2010-07-13 17:16:05 -0700
commita884f5c0c794777f33012a5ca318fd98bab32667 (patch)
tree5f237d4a60bcd057232439989c29847e66a4d40f /indra/newview/llviewerstats.h
parentadf597e4c4a0fd2f8c7ddaad630fda646831b366 (diff)
Added AgentPositionSnaps data to ViewerStats to measure frequency and scale of interpolation failures.
Diffstat (limited to 'indra/newview/llviewerstats.h')
-rw-r--r--indra/newview/llviewerstats.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 13d73000d2..b5cea9d6a8 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -197,6 +197,60 @@ public:
void addToMessage(LLSD &body) const;
+ struct StatsAccumulator
+ {
+ S32 mCount;
+ F32 mSum;
+ F32 mSumOfSquares;
+ U32 mCountOfNextUpdatesToIgnore;
+
+ inline void push( F32 val )
+ {
+ if ( mCountOfNextUpdatesToIgnore > 0 )
+ {
+ mCountOfNextUpdatesToIgnore--;
+ return;
+ }
+
+ mCount++;
+ mSum += val;
+ mSumOfSquares += val * val;
+ }
+
+ inline F32 getMean() const
+ {
+ return (mCount == 0) ? 0.f : ((F32)mSum)/mCount;
+ }
+
+ inline F32 getStdDev() const
+ {
+ const F32 mean = getMean();
+ return (mCount == 0) ? 0.f : sqrt( mSumOfSquares/mCount - (mean * mean) );
+ }
+
+ inline U32 getCount() const
+ {
+ return mCount;
+ }
+
+ inline void reset()
+ {
+ mCount = mSum = mSumOfSquares = 0;
+ mCountOfNextUpdatesToIgnore = 0;
+ }
+
+ inline LLSD getData() const
+ {
+ LLSD data;
+ data["mean"] = getMean();
+ data["std_dev"] = getStdDev();
+ data["count"] = (S32)mCount;
+ return data;
+ }
+ };
+
+ StatsAccumulator mAgentPositionSnaps;
+
private:
F64 mStats[ST_COUNT];