Add total ODE frame time optional stat, as a sanity check on the main scene physics stat
parent
0f39f41317
commit
808bf12cd5
|
@ -142,6 +142,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, float> m_stats = new Dictionary<string, float>();
|
private Dictionary<string, float> m_stats = new Dictionary<string, float>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stat name for the total time spent in ODE frame processing.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// A sanity check for the main scene loop physics time.
|
||||||
|
/// </remarks>
|
||||||
|
public const string ODETotalFrameMsStatName = "ODETotalFrameMS";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stat name for recording the number of milliseconds that ODE spends in native collision code.
|
/// Stat name for recording the number of milliseconds that ODE spends in native collision code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -170,7 +178,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to hold tick numbers for stat collection purposes.
|
/// Used to hold tick numbers for stat collection purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int m_nativeCollisionTickRecorder;
|
private int m_nativeCollisionStartTick;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A messy way to tell if we need to avoid adding a collision time because this was already done in the callback.
|
/// A messy way to tell if we need to avoid adding a collision time because this was already done in the callback.
|
||||||
|
@ -845,7 +853,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
// We do this inside the lock so that we don't count any delay in acquiring it
|
// We do this inside the lock so that we don't count any delay in acquiring it
|
||||||
if (CollectStats)
|
if (CollectStats)
|
||||||
m_nativeCollisionTickRecorder = Util.EnvironmentTickCount();
|
m_nativeCollisionStartTick = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
count = d.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize);
|
count = d.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize);
|
||||||
}
|
}
|
||||||
|
@ -854,7 +862,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// negligable
|
// negligable
|
||||||
if (CollectStats)
|
if (CollectStats)
|
||||||
m_stats[ODENativeGeomCollisionFrameMsStatName]
|
m_stats[ODENativeGeomCollisionFrameMsStatName]
|
||||||
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder);
|
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -870,7 +878,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (CollectStats)
|
if (CollectStats)
|
||||||
{
|
{
|
||||||
m_inCollisionTiming = true;
|
m_inCollisionTiming = true;
|
||||||
m_nativeCollisionTickRecorder = Util.EnvironmentTickCount();
|
m_nativeCollisionStartTick = Util.EnvironmentTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SpaceCollide2(space1, space2, data, nearCallback);
|
d.SpaceCollide2(space1, space2, data, nearCallback);
|
||||||
|
@ -878,7 +886,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (CollectStats && m_inCollisionTiming)
|
if (CollectStats && m_inCollisionTiming)
|
||||||
{
|
{
|
||||||
m_stats[ODENativeSpaceCollisionFrameMsStatName]
|
m_stats[ODENativeSpaceCollisionFrameMsStatName]
|
||||||
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder);
|
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
|
||||||
m_inCollisionTiming = false;
|
m_inCollisionTiming = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -894,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (CollectStats && m_inCollisionTiming)
|
if (CollectStats && m_inCollisionTiming)
|
||||||
{
|
{
|
||||||
m_stats[ODENativeSpaceCollisionFrameMsStatName]
|
m_stats[ODENativeSpaceCollisionFrameMsStatName]
|
||||||
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder);
|
+= Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
|
||||||
m_inCollisionTiming = false;
|
m_inCollisionTiming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2822,6 +2830,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <returns>The number of frames simulated over that period.</returns>
|
/// <returns>The number of frames simulated over that period.</returns>
|
||||||
public override float Simulate(float timeStep)
|
public override float Simulate(float timeStep)
|
||||||
{
|
{
|
||||||
|
int startFrameTick = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
if (framecount >= int.MaxValue)
|
if (framecount >= int.MaxValue)
|
||||||
framecount = 0;
|
framecount = 0;
|
||||||
|
|
||||||
|
@ -3087,6 +3097,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
tickCountFrameRun = Util.EnvironmentTickCount();
|
tickCountFrameRun = Util.EnvironmentTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CollectStats)
|
||||||
|
m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCount() - startFrameTick;
|
||||||
|
|
||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4105,6 +4118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// No need to zero since this is calculated by addition
|
// No need to zero since this is calculated by addition
|
||||||
// m_stats[ODENativeCollisionFrameMsStatName] = 0;
|
// m_stats[ODENativeCollisionFrameMsStatName] = 0;
|
||||||
|
|
||||||
|
m_stats[ODETotalFrameMsStatName] = 0;
|
||||||
m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0;
|
m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0;
|
||||||
m_stats[ODENativeGeomCollisionFrameMsStatName] = 0;
|
m_stats[ODENativeGeomCollisionFrameMsStatName] = 0;
|
||||||
m_stats[ODEAvatarContactsStatsName] = 0;
|
m_stats[ODEAvatarContactsStatsName] = 0;
|
||||||
|
|
Loading…
Reference in New Issue