Add ODE avatar and prim collision numbers if extra stats collection is enabled.
parent
68946bffae
commit
0c0e575379
|
@ -147,6 +147,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS";
|
public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stat name for the number of avatar collisions with another entity.
|
||||||
|
/// </summary>
|
||||||
|
public const string ODEAvatarCollisionsStatName = "ODEAvatarCollisions";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stat name for the number of prim collisions with another entity.
|
||||||
|
/// </summary>
|
||||||
|
public const string ODEPrimCollisionsStatName = "ODEPrimCollisions";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to hold tick numbers for stat collection purposes.
|
/// Used to hold tick numbers for stat collection purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -157,6 +167,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool m_inCollisionTiming;
|
private bool m_inCollisionTiming;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A temporary holder for the number of avatar collisions in a frame, so we can work out how many object
|
||||||
|
/// collisions occured using the _perloopcontact if stats collection is enabled.
|
||||||
|
/// </summary>
|
||||||
|
private int m_tempAvatarCollisionsThisFrame;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used in calculating physics frame time dilation
|
/// Used in calculating physics frame time dilation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -473,7 +489,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Initialize the mesh plugin
|
// Initialize the mesh plugin
|
||||||
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
||||||
{
|
{
|
||||||
m_stats[ODENativeCollisionFrameMsStatName] = 0;
|
InitializeExtraStats();
|
||||||
|
|
||||||
mesher = meshmerizer;
|
mesher = meshmerizer;
|
||||||
m_config = config;
|
m_config = config;
|
||||||
|
@ -1455,7 +1471,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
|
//m_log.DebugFormat("[Collision]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
|
||||||
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
|
//m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1693,8 +1709,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (framecount % 55 == 0)
|
if (CollectStats)
|
||||||
// m_log.DebugFormat("Processed {0} collisions", _perloopContact.Count);
|
{
|
||||||
|
m_tempAvatarCollisionsThisFrame = _perloopContact.Count;
|
||||||
|
m_stats[ODEAvatarCollisionsStatName] += m_tempAvatarCollisionsThisFrame;
|
||||||
|
}
|
||||||
|
|
||||||
List<OdePrim> removeprims = null;
|
List<OdePrim> removeprims = null;
|
||||||
foreach (OdePrim chr in _activeprims)
|
foreach (OdePrim chr in _activeprims)
|
||||||
|
@ -1728,6 +1747,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CollectStats)
|
||||||
|
m_stats[ODEPrimCollisionsStatName] += _perloopContact.Count - m_tempAvatarCollisionsThisFrame;
|
||||||
|
|
||||||
if (removeprims != null)
|
if (removeprims != null)
|
||||||
{
|
{
|
||||||
foreach (OdePrim chr in removeprims)
|
foreach (OdePrim chr in removeprims)
|
||||||
|
@ -4063,10 +4085,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
returnStats = new Dictionary<string, float>(m_stats);
|
returnStats = new Dictionary<string, float>(m_stats);
|
||||||
|
|
||||||
m_stats[ODENativeCollisionFrameMsStatName] = 0;
|
InitializeExtraStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnStats;
|
return returnStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeExtraStats()
|
||||||
|
{
|
||||||
|
m_stats[ODENativeCollisionFrameMsStatName] = 0;
|
||||||
|
m_stats[ODEAvatarCollisionsStatName] = 0;
|
||||||
|
m_stats[ODEPrimCollisionsStatName] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue