aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs39
1 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 25b3266..864cdc2 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -148,6 +148,16 @@ namespace OpenSim.Region.Physics.OdePlugin
148 public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; 148 public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS";
149 149
150 /// <summary> 150 /// <summary>
151 /// Stat name for the number of avatar collisions with another entity.
152 /// </summary>
153 public const string ODEAvatarCollisionsStatName = "ODEAvatarCollisions";
154
155 /// <summary>
156 /// Stat name for the number of prim collisions with another entity.
157 /// </summary>
158 public const string ODEPrimCollisionsStatName = "ODEPrimCollisions";
159
160 /// <summary>
151 /// Used to hold tick numbers for stat collection purposes. 161 /// Used to hold tick numbers for stat collection purposes.
152 /// </summary> 162 /// </summary>
153 private int m_nativeCollisionTickRecorder; 163 private int m_nativeCollisionTickRecorder;
@@ -158,6 +168,12 @@ namespace OpenSim.Region.Physics.OdePlugin
158 private bool m_inCollisionTiming; 168 private bool m_inCollisionTiming;
159 169
160 /// <summary> 170 /// <summary>
171 /// A temporary holder for the number of avatar collisions in a frame, so we can work out how many object
172 /// collisions occured using the _perloopcontact if stats collection is enabled.
173 /// </summary>
174 private int m_tempAvatarCollisionsThisFrame;
175
176 /// <summary>
161 /// Used in calculating physics frame time dilation 177 /// Used in calculating physics frame time dilation
162 /// </summary> 178 /// </summary>
163 private int tickCountFrameRun; 179 private int tickCountFrameRun;
@@ -473,7 +489,7 @@ namespace OpenSim.Region.Physics.OdePlugin
473 // Initialize the mesh plugin 489 // Initialize the mesh plugin
474 public override void Initialise(IMesher meshmerizer, IConfigSource config) 490 public override void Initialise(IMesher meshmerizer, IConfigSource config)
475 { 491 {
476 m_stats[ODENativeCollisionFrameMsStatName] = 0; 492 InitializeExtraStats();
477 493
478 mesher = meshmerizer; 494 mesher = meshmerizer;
479 m_config = config; 495 m_config = config;
@@ -1455,7 +1471,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1455 break; 1471 break;
1456 } 1472 }
1457 } 1473 }
1458 //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); 1474 //m_log.DebugFormat("[Collision]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
1459 //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)); 1475 //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));
1460 } 1476 }
1461 } 1477 }
@@ -1693,8 +1709,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1693 //} 1709 //}
1694 } 1710 }
1695 1711
1696// if (framecount % 55 == 0) 1712 if (CollectStats)
1697// m_log.DebugFormat("Processed {0} collisions", _perloopContact.Count); 1713 {
1714 m_tempAvatarCollisionsThisFrame = _perloopContact.Count;
1715 m_stats[ODEAvatarCollisionsStatName] += m_tempAvatarCollisionsThisFrame;
1716 }
1698 1717
1699 List<OdePrim> removeprims = null; 1718 List<OdePrim> removeprims = null;
1700 foreach (OdePrim chr in _activeprims) 1719 foreach (OdePrim chr in _activeprims)
@@ -1728,6 +1747,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1728 } 1747 }
1729 } 1748 }
1730 1749
1750 if (CollectStats)
1751 m_stats[ODEPrimCollisionsStatName] += _perloopContact.Count - m_tempAvatarCollisionsThisFrame;
1752
1731 if (removeprims != null) 1753 if (removeprims != null)
1732 { 1754 {
1733 foreach (OdePrim chr in removeprims) 1755 foreach (OdePrim chr in removeprims)
@@ -4063,10 +4085,17 @@ namespace OpenSim.Region.Physics.OdePlugin
4063 { 4085 {
4064 returnStats = new Dictionary<string, float>(m_stats); 4086 returnStats = new Dictionary<string, float>(m_stats);
4065 4087
4066 m_stats[ODENativeCollisionFrameMsStatName] = 0; 4088 InitializeExtraStats();
4067 } 4089 }
4068 4090
4069 return returnStats; 4091 return returnStats;
4070 } 4092 }
4093
4094 private void InitializeExtraStats()
4095 {
4096 m_stats[ODENativeCollisionFrameMsStatName] = 0;
4097 m_stats[ODEAvatarCollisionsStatName] = 0;
4098 m_stats[ODEPrimCollisionsStatName] = 0;
4099 }
4071 } 4100 }
4072} \ No newline at end of file 4101} \ No newline at end of file