Collection optional avatar and prim taint frame millisecond times

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-01 03:03:48 +01:00
parent 2eb563b3bb
commit 627382f702
1 changed files with 36 additions and 7 deletions

View File

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