diff options
author | Justin Clark-Casey (justincc) | 2012-06-01 01:58:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-01 01:58:28 +0100 |
commit | 5cc9b820e5b0a9490e6499ee5151c5e698c3e110 (patch) | |
tree | 6c5fa1143b3a1a7d821a032941ec9eac811dd7ac /OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |
parent | Add total ODE frame time optional stat, as a sanity check on the main scene p... (diff) | |
download | opensim-SC_OLD-5cc9b820e5b0a9490e6499ee5151c5e698c3e110.zip opensim-SC_OLD-5cc9b820e5b0a9490e6499ee5151c5e698c3e110.tar.gz opensim-SC_OLD-5cc9b820e5b0a9490e6499ee5151c5e698c3e110.tar.bz2 opensim-SC_OLD-5cc9b820e5b0a9490e6499ee5151c5e698c3e110.tar.xz |
Add option native step frame ms stat
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index ab03696..04c4722 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -151,6 +151,11 @@ 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. | ||
155 | /// </summary> | ||
156 | public const string ODENativeStepFrameMsStatName = "ODENativeStepFrameMS"; | ||
157 | |||
158 | /// <summary> | ||
154 | /// Stat name for recording the number of milliseconds that ODE spends in native collision code. | 159 | /// Stat name for recording the number of milliseconds that ODE spends in native collision code. |
155 | /// </summary> | 160 | /// </summary> |
156 | public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; | 161 | public const string ODENativeCollisionFrameMsStatName = "ODENativeCollisionFrameMS"; |
@@ -2821,23 +2826,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2821 | 2826 | ||
2822 | /// <summary> | 2827 | /// <summary> |
2823 | /// This is our main simulate loop | 2828 | /// This is our main simulate loop |
2829 | /// </summary> | ||
2830 | /// <remarks> | ||
2824 | /// It's thread locked by a Mutex in the scene. | 2831 | /// It's thread locked by a Mutex in the scene. |
2825 | /// It holds Collisions, it instructs ODE to step through the physical reactions | 2832 | /// It holds Collisions, it instructs ODE to step through the physical reactions |
2826 | /// It moves the objects around in memory | 2833 | /// It moves the objects around in memory |
2827 | /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup) | 2834 | /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup) |
2828 | /// </summary> | 2835 | /// </remarks> |
2829 | /// <param name="timeStep"></param> | 2836 | /// <param name="timeStep"></param> |
2830 | /// <returns>The number of frames simulated over that period.</returns> | 2837 | /// <returns>The number of frames simulated over that period.</returns> |
2831 | public override float Simulate(float timeStep) | 2838 | public override float Simulate(float timeStep) |
2832 | { | 2839 | { |
2833 | int startFrameTick = Util.EnvironmentTickCount(); | 2840 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; |
2841 | int quickStepTick = 0; | ||
2834 | 2842 | ||
2835 | if (framecount >= int.MaxValue) | 2843 | if (framecount >= int.MaxValue) |
2836 | framecount = 0; | 2844 | framecount = 0; |
2837 | 2845 | ||
2838 | //if (m_worldOffset != Vector3.Zero) | ||
2839 | // return 0; | ||
2840 | |||
2841 | framecount++; | 2846 | framecount++; |
2842 | 2847 | ||
2843 | float fps = 0; | 2848 | float fps = 0; |
@@ -2845,7 +2850,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2845 | float timeLeft = timeStep; | 2850 | float timeLeft = timeStep; |
2846 | 2851 | ||
2847 | //m_log.Info(timeStep.ToString()); | 2852 | //m_log.Info(timeStep.ToString()); |
2848 | // step_time += timeStep; | 2853 | // step_time += timeSte |
2849 | // | 2854 | // |
2850 | // // If We're loaded down by something else, | 2855 | // // If We're loaded down by something else, |
2851 | // // or debugging with the Visual Studio project on pause | 2856 | // // or debugging with the Visual Studio project on pause |
@@ -3007,9 +3012,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3007 | // "[PHYSICS]: Collision contacts to process this frame = {0}", m_global_contactcount); | 3012 | // "[PHYSICS]: Collision contacts to process this frame = {0}", m_global_contactcount); |
3008 | 3013 | ||
3009 | m_global_contactcount = 0; | 3014 | m_global_contactcount = 0; |
3010 | 3015 | ||
3016 | if (CollectStats) | ||
3017 | quickStepTick = Util.EnvironmentTickCount(); | ||
3018 | |||
3011 | d.WorldQuickStep(world, ODE_STEPSIZE); | 3019 | d.WorldQuickStep(world, ODE_STEPSIZE); |
3012 | 3020 | ||
3021 | if (CollectStats) | ||
3022 | m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(quickStepTick); | ||
3023 | |||
3013 | d.JointGroupEmpty(contactgroup); | 3024 | d.JointGroupEmpty(contactgroup); |
3014 | } | 3025 | } |
3015 | catch (Exception e) | 3026 | catch (Exception e) |
@@ -3077,7 +3088,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3077 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); | 3088 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); |
3078 | } | 3089 | } |
3079 | 3090 | ||
3080 | latertickcount = Util.EnvironmentTickCount() - tickCountFrameRun; | 3091 | latertickcount = Util.EnvironmentTickCountSubtract(tickCountFrameRun); |
3081 | 3092 | ||
3082 | // OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics | 3093 | // OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics |
3083 | // has a max of 100 ms to run theoretically. | 3094 | // has a max of 100 ms to run theoretically. |
@@ -3098,7 +3109,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3098 | } | 3109 | } |
3099 | 3110 | ||
3100 | if (CollectStats) | 3111 | if (CollectStats) |
3101 | m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCount() - startFrameTick; | 3112 | m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCountSubtract(startFrameTick); |
3102 | 3113 | ||
3103 | return fps; | 3114 | return fps; |
3104 | } | 3115 | } |
@@ -4119,6 +4130,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4119 | // m_stats[ODENativeCollisionFrameMsStatName] = 0; | 4130 | // m_stats[ODENativeCollisionFrameMsStatName] = 0; |
4120 | 4131 | ||
4121 | m_stats[ODETotalFrameMsStatName] = 0; | 4132 | m_stats[ODETotalFrameMsStatName] = 0; |
4133 | m_stats[ODENativeStepFrameMsStatName] = 0; | ||
4122 | m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; | 4134 | m_stats[ODENativeSpaceCollisionFrameMsStatName] = 0; |
4123 | m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; | 4135 | m_stats[ODENativeGeomCollisionFrameMsStatName] = 0; |
4124 | m_stats[ODEAvatarContactsStatsName] = 0; | 4136 | m_stats[ODEAvatarContactsStatsName] = 0; |