From 5f44be99ef63f2f5ef7bcf73f61c29318d657e59 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Jun 2012 02:25:42 +0100 Subject: Add avatar and prim update milliseconds per frame optional stats --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 38 +++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 04c4722..f1fa38e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -151,26 +151,36 @@ namespace OpenSim.Region.Physics.OdePlugin public const string ODETotalFrameMsStatName = "ODETotalFrameMS"; /// - /// The amount of time spent in native code that actually steps through the simulation. + /// Stat name for the amount of time spent in native code that actually steps through the simulation. /// public const string ODENativeStepFrameMsStatName = "ODENativeStepFrameMS"; /// - /// Stat name for recording the number of milliseconds that ODE spends in native collision code. + /// Stat name for the number of milliseconds that ODE spends in native collision code. /// public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; /// - /// Stat name for recording the number of milliseconds that ODE spends in native space collision code. + /// Stat name for the number of milliseconds that ODE spends in native space collision code. /// public const string ODENativeSpaceCollisionFrameMsStatName = "ODENativeSpaceCollisionFrameMS"; /// - /// Stat name for recording the number of milliseconds that ODE spends in native geom collision code. + /// Stat name for the number of milliseconds that ODE spends in native geom collision code. /// public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS"; /// + /// Stat name for the milliseconds spent updating avatar position and velocity + /// + public const string ODEAvatarUpdateFrameMsStatName = "ODEAvatarUpdateFrameMS"; + + /// + /// Stat name for the milliseconds spent updating prim position and velocity + /// + public const string ODEPrimUpdateFrameMsStatName = "ODEPrimUpdateFrameMS"; + + /// /// Stat name for the number of avatar collisions with another entity. /// public const string ODEAvatarContactsStatsName = "ODEAvatarContacts"; @@ -2838,7 +2848,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override float Simulate(float timeStep) { int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; - int quickStepTick = 0; + int tempTick = 0;; if (framecount >= int.MaxValue) framecount = 0; @@ -3014,12 +3024,12 @@ namespace OpenSim.Region.Physics.OdePlugin m_global_contactcount = 0; if (CollectStats) - quickStepTick = Util.EnvironmentTickCount(); + tempTick = Util.EnvironmentTickCount(); d.WorldQuickStep(world, ODE_STEPSIZE); if (CollectStats) - m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(quickStepTick); + m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); d.JointGroupEmpty(contactgroup); } @@ -3031,6 +3041,9 @@ namespace OpenSim.Region.Physics.OdePlugin timeLeft -= ODE_STEPSIZE; } + if (CollectStats) + tempTick = Util.EnvironmentTickCount(); + foreach (OdeCharacter actor in _characters) { if (actor.bad) @@ -3054,6 +3067,12 @@ namespace OpenSim.Region.Physics.OdePlugin defects.Clear(); } + if (CollectStats) + { + m_stats[ODEAvatarUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); + tempTick = Util.EnvironmentTickCount(); + } + //if (timeStep < 0.2f) foreach (OdePrim prim in _activeprims) @@ -3067,6 +3086,9 @@ namespace OpenSim.Region.Physics.OdePlugin } } + if (CollectStats) + m_stats[ODEPrimUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); + //DumpJointInfo(); // Finished with all sim stepping. If requested, dump world state to file for debugging. @@ -4135,6 +4157,8 @@ namespace OpenSim.Region.Physics.OdePlugin m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; m_stats[ODEAvatarContactsStatsName] = 0; m_stats[ODEPrimContactsStatName] = 0; + m_stats[ODEAvatarUpdateFrameMsStatName] = 0; + m_stats[ODEPrimUpdateFrameMsStatName] = 0; } } } \ No newline at end of file -- cgit v1.1