diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 948930bf39..63b999ec29 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -150,6 +150,16 @@ namespace OpenSim.Region.Physics.OdePlugin /// public const string ODETotalFrameMsStatName = "ODETotalFrameMS"; + /// + /// Stat name for amount of time spent processing avatar taints per frame + /// + public const string ODEAvatarTaintMsStatName = "ODEAvatarTaintFrameMS"; + + /// + /// Stat name for amount of time spent processing prim taints per frame + /// + public const string ODEPrimTaintMsStatName = "ODEPrimTaintFrameMS"; + /// /// Stat name for the amount of time spent in native code that actually steps through the simulation. /// @@ -2848,7 +2858,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override float Simulate(float timeStep) { int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; - int tempTick = 0;; + int tempTick = 0, tempTick2 = 0; if (framecount >= int.MaxValue) framecount = 0; @@ -2926,6 +2936,9 @@ namespace OpenSim.Region.Physics.OdePlugin { try { + if (CollectStats) + tempTick = Util.EnvironmentTickCount(); + lock (_taintedActors) { foreach (OdeCharacter character in _taintedActors) @@ -2934,6 +2947,13 @@ namespace OpenSim.Region.Physics.OdePlugin _taintedActors.Clear(); } + if (CollectStats) + { + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODEAvatarTaintMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; + } + lock (_taintedPrims) { foreach (OdePrim prim in _taintedPrims) @@ -2964,6 +2984,13 @@ namespace OpenSim.Region.Physics.OdePlugin _taintedPrims.Clear(); } + if (CollectStats) + { + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODEPrimTaintMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; + } + // Move characters foreach (OdeCharacter actor in _characters) actor.Move(defects); @@ -3028,10 +3055,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (CollectStats) { - m_stats[ODECollisionNotificationFrameMsStatName] - += Util.EnvironmentTickCountSubtract(tempTick); - - tempTick = Util.EnvironmentTickCount(); + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODECollisionNotificationFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; } d.WorldQuickStep(world, ODE_STEPSIZE); @@ -3077,8 +3103,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (CollectStats) { - m_stats[ODEAvatarUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); - tempTick = Util.EnvironmentTickCount(); + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODEAvatarUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; } //if (timeStep < 0.2f) @@ -4153,6 +4180,8 @@ namespace OpenSim.Region.Physics.OdePlugin private void InitializeExtraStats() { m_stats[ODETotalFrameMsStatName] = 0; + m_stats[ODEAvatarTaintMsStatName] = 0; + m_stats[ODEPrimTaintMsStatName] = 0; m_stats[ODENativeStepFrameMsStatName] = 0; m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; m_stats[ODENativeGeomCollisionFrameMsStatName] = 0;