diff options
author | Justin Clark-Casey (justincc) | 2012-06-01 02:25:42 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-01 02:25:42 +0100 |
commit | 5f44be99ef63f2f5ef7bcf73f61c29318d657e59 (patch) | |
tree | 3651bdf5888f283dfcb9f116ea6979f385586e22 | |
parent | Add option native step frame ms stat (diff) | |
download | opensim-SC-5f44be99ef63f2f5ef7bcf73f61c29318d657e59.zip opensim-SC-5f44be99ef63f2f5ef7bcf73f61c29318d657e59.tar.gz opensim-SC-5f44be99ef63f2f5ef7bcf73f61c29318d657e59.tar.bz2 opensim-SC-5f44be99ef63f2f5ef7bcf73f61c29318d657e59.tar.xz |
Add avatar and prim update milliseconds per frame optional stats
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 04c4722..f1fa38e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -151,26 +151,36 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
151 | public const string ODETotalFrameMsStatName = "ODETotalFrameMS"; | 151 | public const string ODETotalFrameMsStatName = "ODETotalFrameMS"; |
152 | 152 | ||
153 | /// <summary> | 153 | /// <summary> |
154 | /// The amount of time spent in native code that actually steps through the simulation. | 154 | /// Stat name for the amount of time spent in native code that actually steps through the simulation. |
155 | /// </summary> | 155 | /// </summary> |
156 | public const string ODENativeStepFrameMsStatName = "ODENativeStepFrameMS"; | 156 | public const string ODENativeStepFrameMsStatName = "ODENativeStepFrameMS"; |
157 | 157 | ||
158 | /// <summary> | 158 | /// <summary> |
159 | /// Stat name for recording the number of milliseconds that ODE spends in native collision code. | 159 | /// Stat name for the number of milliseconds that ODE spends in native collision code. |
160 | /// </summary> | 160 | /// </summary> |
161 | public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; | 161 | public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; |
162 | 162 | ||
163 | /// <summary> | 163 | /// <summary> |
164 | /// Stat name for recording the number of milliseconds that ODE spends in native space collision code. | 164 | /// Stat name for the number of milliseconds that ODE spends in native space collision code. |
165 | /// </summary> | 165 | /// </summary> |
166 | public const string ODENativeSpaceCollisionFrameMsStatName = "ODENativeSpaceCollisionFrameMS"; | 166 | public const string ODENativeSpaceCollisionFrameMsStatName = "ODENativeSpaceCollisionFrameMS"; |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Stat name for recording the number of milliseconds that ODE spends in native geom collision code. | 169 | /// Stat name for the number of milliseconds that ODE spends in native geom collision code. |
170 | /// </summary> | 170 | /// </summary> |
171 | public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS"; | 171 | public const string ODENativeGeomCollisionFrameMsStatName = "ODENativeGeomCollisionFrameMS"; |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// Stat name for the milliseconds spent updating avatar position and velocity | ||
175 | /// </summary> | ||
176 | public const string ODEAvatarUpdateFrameMsStatName = "ODEAvatarUpdateFrameMS"; | ||
177 | |||
178 | /// <summary> | ||
179 | /// Stat name for the milliseconds spent updating prim position and velocity | ||
180 | /// </summary> | ||
181 | public const string ODEPrimUpdateFrameMsStatName = "ODEPrimUpdateFrameMS"; | ||
182 | |||
183 | /// <summary> | ||
174 | /// Stat name for the number of avatar collisions with another entity. | 184 | /// Stat name for the number of avatar collisions with another entity. |
175 | /// </summary> | 185 | /// </summary> |
176 | public const string ODEAvatarContactsStatsName = "ODEAvatarContacts"; | 186 | public const string ODEAvatarContactsStatsName = "ODEAvatarContacts"; |
@@ -2838,7 +2848,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2838 | public override float Simulate(float timeStep) | 2848 | public override float Simulate(float timeStep) |
2839 | { | 2849 | { |
2840 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; | 2850 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; |
2841 | int quickStepTick = 0; | 2851 | int tempTick = 0;; |
2842 | 2852 | ||
2843 | if (framecount >= int.MaxValue) | 2853 | if (framecount >= int.MaxValue) |
2844 | framecount = 0; | 2854 | framecount = 0; |
@@ -3014,12 +3024,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3014 | m_global_contactcount = 0; | 3024 | m_global_contactcount = 0; |
3015 | 3025 | ||
3016 | if (CollectStats) | 3026 | if (CollectStats) |
3017 | quickStepTick = Util.EnvironmentTickCount(); | 3027 | tempTick = Util.EnvironmentTickCount(); |
3018 | 3028 | ||
3019 | d.WorldQuickStep(world, ODE_STEPSIZE); | 3029 | d.WorldQuickStep(world, ODE_STEPSIZE); |
3020 | 3030 | ||
3021 | if (CollectStats) | 3031 | if (CollectStats) |
3022 | m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(quickStepTick); | 3032 | m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); |
3023 | 3033 | ||
3024 | d.JointGroupEmpty(contactgroup); | 3034 | d.JointGroupEmpty(contactgroup); |
3025 | } | 3035 | } |
@@ -3031,6 +3041,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3031 | timeLeft -= ODE_STEPSIZE; | 3041 | timeLeft -= ODE_STEPSIZE; |
3032 | } | 3042 | } |
3033 | 3043 | ||
3044 | if (CollectStats) | ||
3045 | tempTick = Util.EnvironmentTickCount(); | ||
3046 | |||
3034 | foreach (OdeCharacter actor in _characters) | 3047 | foreach (OdeCharacter actor in _characters) |
3035 | { | 3048 | { |
3036 | if (actor.bad) | 3049 | if (actor.bad) |
@@ -3054,6 +3067,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3054 | defects.Clear(); | 3067 | defects.Clear(); |
3055 | } | 3068 | } |
3056 | 3069 | ||
3070 | if (CollectStats) | ||
3071 | { | ||
3072 | m_stats[ODEAvatarUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); | ||
3073 | tempTick = Util.EnvironmentTickCount(); | ||
3074 | } | ||
3075 | |||
3057 | //if (timeStep < 0.2f) | 3076 | //if (timeStep < 0.2f) |
3058 | 3077 | ||
3059 | foreach (OdePrim prim in _activeprims) | 3078 | foreach (OdePrim prim in _activeprims) |
@@ -3067,6 +3086,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3067 | } | 3086 | } |
3068 | } | 3087 | } |
3069 | 3088 | ||
3089 | if (CollectStats) | ||
3090 | m_stats[ODEPrimUpdateFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); | ||
3091 | |||
3070 | //DumpJointInfo(); | 3092 | //DumpJointInfo(); |
3071 | 3093 | ||
3072 | // Finished with all sim stepping. If requested, dump world state to file for debugging. | 3094 | // Finished with all sim stepping. If requested, dump world state to file for debugging. |
@@ -4135,6 +4157,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4135 | m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; | 4157 | m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; |
4136 | m_stats[ODEAvatarContactsStatsName] = 0; | 4158 | m_stats[ODEAvatarContactsStatsName] = 0; |
4137 | m_stats[ODEPrimContactsStatName] = 0; | 4159 | m_stats[ODEPrimContactsStatName] = 0; |
4160 | m_stats[ODEAvatarUpdateFrameMsStatName] = 0; | ||
4161 | m_stats[ODEPrimUpdateFrameMsStatName] = 0; | ||
4138 | } | 4162 | } |
4139 | } | 4163 | } |
4140 | } \ No newline at end of file | 4164 | } \ No newline at end of file |