From d34b84b53137f5516f790563588676ac5fbf0e49 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Jun 2012 03:23:19 +0100 Subject: Add avatar forces calculation, prim force and raycasting per frame millisecond optional stats --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 53 ++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 63b999e..e44375b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -151,17 +151,32 @@ namespace OpenSim.Region.Physics.OdePlugin public const string ODETotalFrameMsStatName = "ODETotalFrameMS"; /// - /// Stat name for amount of time spent processing avatar taints per frame + /// Stat name for time spent processing avatar taints per frame /// public const string ODEAvatarTaintMsStatName = "ODEAvatarTaintFrameMS"; /// - /// Stat name for amount of time spent processing prim taints per frame + /// Stat name for 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. + /// Stat name for time spent calculating avatar forces per frame. + /// + public const string ODEAvatarForcesFrameMsStatName = "ODEAvatarForcesFrameMS"; + + /// + /// Stat name for time spent calculating prim forces per frame + /// + public const string ODEPrimForcesFrameMsStatName = "ODEPrimForcesFrameMS"; + + /// + /// Stat name for time spent fulfilling raycasting requests per frame + /// + public const string ODERaycastingFrameMsStatName = "ODERaycastingFrameMS"; + + /// + /// Stat name for time spent in native code that actually steps through the simulation. /// public const string ODENativeStepFrameMsStatName = "ODENativeStepFrameMS"; @@ -171,7 +186,7 @@ namespace OpenSim.Region.Physics.OdePlugin public const string ODENativeSpaceCollisionFrameMsStatName = "ODENativeSpaceCollisionFrameMS"; /// - /// Stat name for the number of milliseconds that ODE spends in native geom collision code. + /// Stat name for milliseconds that ODE spends in native geom collision code. /// public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS"; @@ -181,7 +196,7 @@ namespace OpenSim.Region.Physics.OdePlugin public const string ODECollisionNotificationFrameMsStatName = "ODECollisionNotificationFrameMS"; /// - /// Stat name for the milliseconds spent updating avatar position and velocity + /// Stat name for milliseconds spent updating avatar position and velocity /// public const string ODEAvatarUpdateFrameMsStatName = "ODEAvatarUpdateFrameMS"; @@ -191,12 +206,12 @@ namespace OpenSim.Region.Physics.OdePlugin public const string ODEPrimUpdateFrameMsStatName = "ODEPrimUpdateFrameMS"; /// - /// Stat name for the number of avatar collisions with another entity. + /// Stat name for avatar collisions with another entity. /// public const string ODEAvatarContactsStatsName = "ODEAvatarContacts"; /// - /// Stat name for the number of prim collisions with another entity. + /// Stat name for prim collisions with another entity. /// public const string ODEPrimContactsStatName = "ODEPrimContacts"; @@ -3010,6 +3025,13 @@ namespace OpenSim.Region.Physics.OdePlugin defects.Clear(); } + if (CollectStats) + { + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODEAvatarForcesFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; + } + // Move other active objects foreach (OdePrim prim in _activeprims) { @@ -3017,12 +3039,26 @@ namespace OpenSim.Region.Physics.OdePlugin prim.Move(timeStep); } + if (CollectStats) + { + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODEPrimForcesFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; + } + //if ((framecount % m_randomizeWater) == 0) // randomizeWater(waterlevel); //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); m_rayCastManager.ProcessQueuedRequests(); + if (CollectStats) + { + tempTick2 = Util.EnvironmentTickCount(); + m_stats[ODERaycastingFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick2, tempTick); + tempTick = tempTick2; + } + collision_optimized(); if (CollectStats) @@ -4182,6 +4218,9 @@ namespace OpenSim.Region.Physics.OdePlugin m_stats[ODETotalFrameMsStatName] = 0; m_stats[ODEAvatarTaintMsStatName] = 0; m_stats[ODEPrimTaintMsStatName] = 0; + m_stats[ODEAvatarForcesFrameMsStatName] = 0; + m_stats[ODEPrimForcesFrameMsStatName] = 0; + m_stats[ODERaycastingFrameMsStatName] = 0; m_stats[ODENativeStepFrameMsStatName] = 0; m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; -- cgit v1.1