aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs28
1 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index d4c0b85..ab03696 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -143,6 +143,14 @@ namespace OpenSim.Region.Physics.OdePlugin
143 private Dictionary<string, float> m_stats = new Dictionary<string, float>(); 143 private Dictionary<string, float> m_stats = new Dictionary<string, float>();
144 144
145 /// <summary> 145 /// <summary>
146 /// Stat name for the total time spent in ODE frame processing.
147 /// </summary>
148 /// <remarks>
149 /// A sanity check for the main scene loop physics time.
150 /// </remarks>
151 public const string ODETotalFrameMsStatName = "ODETotalFrameMS";
152
153 /// <summary>
146 /// Stat name for recording the number of milliseconds that ODE spends in native collision code. 154 /// Stat name for recording the number of milliseconds that ODE spends in native collision code.
147 /// </summary> 155 /// </summary>
148 public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; 156 public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS";
@@ -170,7 +178,7 @@ namespace OpenSim.Region.Physics.OdePlugin
170 /// <summary> 178 /// <summary>
171 /// Used to hold tick numbers for stat collection purposes. 179 /// Used to hold tick numbers for stat collection purposes.
172 /// </summary> 180 /// </summary>
173 private int m_nativeCollisionTickRecorder; 181 private int m_nativeCollisionStartTick;
174 182
175 /// <summary> 183 /// <summary>
176 /// A messy way to tell if we need to avoid adding a collision time because this was already done in the callback. 184 /// 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
845 { 853 {
846 // We do this inside the lock so that we don't count any delay in acquiring it 854 // We do this inside the lock so that we don't count any delay in acquiring it
847 if (CollectStats) 855 if (CollectStats)
848 m_nativeCollisionTickRecorder = Util.EnvironmentTickCount(); 856 m_nativeCollisionStartTick = Util.EnvironmentTickCount();
849 857
850 count = d.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize); 858 count = d.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize);
851 } 859 }
@@ -854,7 +862,7 @@ namespace OpenSim.Region.Physics.OdePlugin
854 // negligable 862 // negligable
855 if (CollectStats) 863 if (CollectStats)
856 m_stats[ODENativeGeomCollisionFrameMsStatName] 864 m_stats[ODENativeGeomCollisionFrameMsStatName]
857 += Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder); 865 += Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
858 866
859 return count; 867 return count;
860 } 868 }
@@ -870,7 +878,7 @@ namespace OpenSim.Region.Physics.OdePlugin
870 if (CollectStats) 878 if (CollectStats)
871 { 879 {
872 m_inCollisionTiming = true; 880 m_inCollisionTiming = true;
873 m_nativeCollisionTickRecorder = Util.EnvironmentTickCount(); 881 m_nativeCollisionStartTick = Util.EnvironmentTickCount();
874 } 882 }
875 883
876 d.SpaceCollide2(space1, space2, data, nearCallback); 884 d.SpaceCollide2(space1, space2, data, nearCallback);
@@ -878,7 +886,7 @@ namespace OpenSim.Region.Physics.OdePlugin
878 if (CollectStats && m_inCollisionTiming) 886 if (CollectStats && m_inCollisionTiming)
879 { 887 {
880 m_stats[ODENativeSpaceCollisionFrameMsStatName] 888 m_stats[ODENativeSpaceCollisionFrameMsStatName]
881 += Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder); 889 += Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
882 m_inCollisionTiming = false; 890 m_inCollisionTiming = false;
883 } 891 }
884 } 892 }
@@ -894,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
894 if (CollectStats && m_inCollisionTiming) 902 if (CollectStats && m_inCollisionTiming)
895 { 903 {
896 m_stats[ODENativeSpaceCollisionFrameMsStatName] 904 m_stats[ODENativeSpaceCollisionFrameMsStatName]
897 += Util.EnvironmentTickCountSubtract(m_nativeCollisionTickRecorder); 905 += Util.EnvironmentTickCountSubtract(m_nativeCollisionStartTick);
898 m_inCollisionTiming = false; 906 m_inCollisionTiming = false;
899 } 907 }
900 908
@@ -2822,6 +2830,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2822 /// <returns>The number of frames simulated over that period.</returns> 2830 /// <returns>The number of frames simulated over that period.</returns>
2823 public override float Simulate(float timeStep) 2831 public override float Simulate(float timeStep)
2824 { 2832 {
2833 int startFrameTick = Util.EnvironmentTickCount();
2834
2825 if (framecount >= int.MaxValue) 2835 if (framecount >= int.MaxValue)
2826 framecount = 0; 2836 framecount = 0;
2827 2837
@@ -3087,6 +3097,9 @@ namespace OpenSim.Region.Physics.OdePlugin
3087 tickCountFrameRun = Util.EnvironmentTickCount(); 3097 tickCountFrameRun = Util.EnvironmentTickCount();
3088 } 3098 }
3089 3099
3100 if (CollectStats)
3101 m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCount() - startFrameTick;
3102
3090 return fps; 3103 return fps;
3091 } 3104 }
3092 3105
@@ -4089,7 +4102,7 @@ namespace OpenSim.Region.Physics.OdePlugin
4089 lock (OdeLock) 4102 lock (OdeLock)
4090 { 4103 {
4091 returnStats = new Dictionary<string, float>(m_stats); 4104 returnStats = new Dictionary<string, float>(m_stats);
4092 4105
4093 returnStats[ODENativeCollisionFrameMsStatName] 4106 returnStats[ODENativeCollisionFrameMsStatName]
4094 = returnStats[ODENativeSpaceCollisionFrameMsStatName] 4107 = returnStats[ODENativeSpaceCollisionFrameMsStatName]
4095 + returnStats[ODENativeGeomCollisionFrameMsStatName]; 4108 + returnStats[ODENativeGeomCollisionFrameMsStatName];
@@ -4105,6 +4118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
4105 // No need to zero since this is calculated by addition 4118 // No need to zero since this is calculated by addition
4106 // m_stats[ODENativeCollisionFrameMsStatName] = 0; 4119 // m_stats[ODENativeCollisionFrameMsStatName] = 0;
4107 4120
4121 m_stats[ODETotalFrameMsStatName] = 0;
4108 m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; 4122 m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0;
4109 m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; 4123 m_stats[ODENativeGeomCollisionFrameMsStatName] = 0;
4110 m_stats[ODEAvatarContactsStatsName] = 0; 4124 m_stats[ODEAvatarContactsStatsName] = 0;