summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llagent.cpp3
-rw-r--r--indra/newview/llviewerobject.cpp7
-rw-r--r--indra/newview/llviewerstats.cpp8
-rw-r--r--indra/newview/llviewerstats.h54
4 files changed, 72 insertions, 0 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 4e5fdb1219..72d51540ef 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3406,6 +3406,9 @@ void LLAgent::setTeleportState(ETeleportState state)
}
else if(mTeleportState == TELEPORT_ARRIVING)
{
+ // First two position updates after a teleport tend to be weird
+ LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
+
// Let the interested parties know we've teleported.
LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal());
}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 6d93de2383..15bdf126c5 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -79,6 +79,7 @@
#include "llviewerparceloverlay.h"
#include "llviewerpartsource.h"
#include "llviewerregion.h"
+#include "llviewerstats.h"
#include "llviewertextureanim.h"
#include "llviewerwindow.h" // For getSpinAxis
#include "llvoavatar.h"
@@ -1916,6 +1917,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
avatar->clampAttachmentPositions();
}
+
+ // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps
+ if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) )
+ {
+ LLViewerStats::getInstance()->mAgentPositionSnaps.push( diff.length() );
+ }
}
if (new_rot != mLastRot
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index bdc34d0f18..a706e77f19 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -280,6 +280,8 @@ LLViewerStats::LLViewerStats() :
{
mStats[ST_HAS_BAD_TIMER] = 1.0;
}
+
+ mAgentPositionSnaps.reset();
}
LLViewerStats::~LLViewerStats()
@@ -299,6 +301,8 @@ void LLViewerStats::resetStats()
LLViewerStats::getInstance()->mPacketsOutStat.reset();
LLViewerStats::getInstance()->mFPSStat.reset();
LLViewerStats::getInstance()->mTexturePacketsStat.reset();
+
+ LLViewerStats::getInstance()->mAgentPositionSnaps.reset();
}
@@ -393,6 +397,10 @@ void LLViewerStats::addToMessage(LLSD &body) const
<< llendl;
}
}
+
+ body["AgentPositionSnaps"] = mAgentPositionSnaps.getData();
+ llinfos << "STAT: AgentPositionSnaps: Mean = " << mAgentPositionSnaps.getMean() << "; StdDev = " << mAgentPositionSnaps.getStdDev()
+ << "; Count = " << mAgentPositionSnaps.getCount() << llendl;
}
// static
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];