Add optional stat that records milliseconds spent notifying collision listeners in physics frames

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-01 02:33:44 +01:00
parent e8059b74f8
commit 54a23f14d5
1 changed files with 14 additions and 0 deletions

View File

@ -170,6 +170,11 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary> /// </summary>
public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS"; public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS";
/// <summary>
/// Stat name for time spent notifying listeners of collisions
/// </summary>
public const string ODECollisionNotificationFrameMsStatName = "ODECollisionNotificationFrameMS";
/// <summary> /// <summary>
/// Stat name for the milliseconds spent updating avatar position and velocity /// Stat name for the milliseconds spent updating avatar position and velocity
/// </summary> /// </summary>
@ -2998,6 +3003,9 @@ namespace OpenSim.Region.Physics.OdePlugin
collision_optimized(); collision_optimized();
if (CollectStats)
tempTick = Util.EnvironmentTickCount();
foreach (PhysicsActor obj in _collisionEventPrim.Values) foreach (PhysicsActor obj in _collisionEventPrim.Values)
{ {
// m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID);
@ -3024,7 +3032,12 @@ namespace OpenSim.Region.Physics.OdePlugin
m_global_contactcount = 0; m_global_contactcount = 0;
if (CollectStats) if (CollectStats)
{
m_stats[ODECollisionNotificationFrameMsStatName]
+= Util.EnvironmentTickCountSubtract(tempTick);
tempTick = Util.EnvironmentTickCount(); tempTick = Util.EnvironmentTickCount();
}
d.WorldQuickStep(world, ODE_STEPSIZE); d.WorldQuickStep(world, ODE_STEPSIZE);
@ -4155,6 +4168,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_stats[ODENativeStepFrameMsStatName] = 0; m_stats[ODENativeStepFrameMsStatName] = 0;
m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0;
m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; m_stats[ODENativeGeomCollisionFrameMsStatName] = 0;
m_stats[ODECollisionNotificationFrameMsStatName] = 0;
m_stats[ODEAvatarContactsStatsName] = 0; m_stats[ODEAvatarContactsStatsName] = 0;
m_stats[ODEPrimContactsStatName] = 0; m_stats[ODEPrimContactsStatName] = 0;
m_stats[ODEAvatarUpdateFrameMsStatName] = 0; m_stats[ODEAvatarUpdateFrameMsStatName] = 0;