diff options
author | UbitUmarov | 2015-11-08 04:28:46 +0000 |
---|---|---|
committer | UbitUmarov | 2015-11-08 04:28:46 +0000 |
commit | 097c56330a410274410c87f4748156e08841c5cf (patch) | |
tree | 33ba1b303a9b4278b2b8988a83d3d1423c5c8d42 | |
parent | change maximum angular velocity to a value derived from heartbeat rate and N... (diff) | |
download | opensim-SC-097c56330a410274410c87f4748156e08841c5cf.zip opensim-SC-097c56330a410274410c87f4748156e08841c5cf.tar.gz opensim-SC-097c56330a410274410c87f4748156e08841c5cf.tar.bz2 opensim-SC-097c56330a410274410c87f4748156e08841c5cf.tar.xz |
rename MinFrameTime as FrameTime, since it is not a minimum but a target value; retune its value a bit so reported FPS is closer to integer value; change ode step size acording to reduce jitter in phys FPS; Make Statistics Scaling factor (fludge factor) configurable. (legacy default of 5.0 in code)
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 27 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 2 |
3 files changed, 29 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dddc31a..1952402 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -357,14 +357,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
357 | public uint MaintenanceRun { get; private set; } | 357 | public uint MaintenanceRun { get; private set; } |
358 | 358 | ||
359 | /// <summary> | 359 | /// <summary> |
360 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we | 360 | /// Frame time |
361 | /// will sleep for the remaining period. | ||
362 | /// </summary> | ||
363 | /// <remarks> | ||
364 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | ||
365 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | ||
366 | /// </remarks> | 361 | /// </remarks> |
367 | public float MinFrameTime { get; private set; } | 362 | public float FrameTime { get; private set; } |
363 | |||
364 | // statistics frame scale factor for viewer and scripts. | ||
365 | // see SimStatsReporter.cs | ||
366 | public float StatisticsFPSfactor { get; private set; } | ||
368 | 367 | ||
369 | /// <summary> | 368 | /// <summary> |
370 | /// The minimum length of time in seconds that will be taken for a scene frame. | 369 | /// The minimum length of time in seconds that will be taken for a scene frame. |
@@ -860,7 +859,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | : this(regInfo) | 859 | : this(regInfo) |
861 | { | 860 | { |
862 | m_config = config; | 861 | m_config = config; |
863 | MinFrameTime = 0.089f; | 862 | FrameTime = 0.0908f; |
863 | StatisticsFPSfactor = 5.0f; | ||
864 | MinMaintenanceTime = 1; | 864 | MinMaintenanceTime = 1; |
865 | SeeIntoRegion = true; | 865 | SeeIntoRegion = true; |
866 | 866 | ||
@@ -1100,7 +1100,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1100 | } | 1100 | } |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 1103 | FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); |
1104 | StatisticsFPSfactor = startupConfig.GetFloat( "StatisticsFPSfactor", StatisticsFPSfactor); | ||
1104 | 1105 | ||
1105 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); | 1106 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1106 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1107 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
@@ -1729,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1729 | if (Frame % m_update_physics == 0) | 1730 | if (Frame % m_update_physics == 0) |
1730 | { | 1731 | { |
1731 | if (PhysicsEnabled) | 1732 | if (PhysicsEnabled) |
1732 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1733 | physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); |
1733 | 1734 | ||
1734 | if (SynchronizeScene != null) | 1735 | if (SynchronizeScene != null) |
1735 | SynchronizeScene(this); | 1736 | SynchronizeScene(this); |
@@ -1861,7 +1862,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1861 | 1862 | ||
1862 | // estimate sleep time | 1863 | // estimate sleep time |
1863 | tmpMS2 = tmpMS - framestart; | 1864 | tmpMS2 = tmpMS - framestart; |
1864 | tmpMS2 = (double)MinFrameTime * 1000.0D - tmpMS2; | 1865 | tmpMS2 = (double)FrameTime * 1000.0D - tmpMS2; |
1865 | 1866 | ||
1866 | m_firstHeartbeat = false; | 1867 | m_firstHeartbeat = false; |
1867 | 1868 | ||
@@ -1882,12 +1883,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1882 | // Optionally warn if a frame takes double the amount of time that it should. | 1883 | // Optionally warn if a frame takes double the amount of time that it should. |
1883 | if (DebugUpdates | 1884 | if (DebugUpdates |
1884 | && Util.EnvironmentTickCountSubtract( | 1885 | && Util.EnvironmentTickCountSubtract( |
1885 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 1886 | m_lastFrameTick, previousFrameTick) > (int)(FrameTime * 1000 * 2)) |
1886 | 1887 | ||
1887 | m_log.WarnFormat( | 1888 | m_log.WarnFormat( |
1888 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1889 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1889 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1890 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1890 | MinFrameTime * 1000, | 1891 | FrameTime * 1000, |
1891 | 1892 | ||
1892 | RegionInfo.RegionName); | 1893 | RegionInfo.RegionName); |
1893 | } | 1894 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 5fe0551..bf65cab 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -185,11 +185,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
185 | /// Parameter to adjust reported scene fps | 185 | /// Parameter to adjust reported scene fps |
186 | /// </summary> | 186 | /// </summary> |
187 | /// <remarks> | 187 | /// <remarks> |
188 | /// Our scene loop runs slower than other server implementations, apparantly because we work somewhat differently. | 188 | /// The close we have to a frame rate as expected by viewers, users and scripts |
189 | /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might | 189 | /// is heartbeat rate. |
190 | /// affect clients and monitoring scripts/software. | 190 | /// heartbeat rate default value is very diferent from the expected one |
191 | /// and can be changed from region to region acording to its specific simulation needs | ||
192 | /// since this creates incompatibility with expected values, | ||
193 | /// this scale factor can be used to normalize values to a Virtual FPS. | ||
194 | /// original decision was to use a value of 55fps for all opensim | ||
195 | /// corresponding, with default heartbeat rate, to a value of 5. | ||
191 | /// </remarks> | 196 | /// </remarks> |
192 | private float m_reportedFpsCorrectionFactor = 1.0f; | 197 | private float m_statisticsFPSfactor = 5.0f; |
193 | 198 | ||
194 | // saved last reported value so there is something available for llGetRegionFPS | 199 | // saved last reported value so there is something available for llGetRegionFPS |
195 | private float lastReportedSimFPS; | 200 | private float lastReportedSimFPS; |
@@ -252,6 +257,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | m_scene = scene; | 257 | m_scene = scene; |
253 | 258 | ||
254 | ReportingRegion = scene.RegionInfo; | 259 | ReportingRegion = scene.RegionInfo; |
260 | m_statisticsFPSfactor = scene.StatisticsFPSfactor; | ||
255 | 261 | ||
256 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 262 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
257 | m_report.AutoReset = true; | 263 | m_report.AutoReset = true; |
@@ -266,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | 272 | ||
267 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | 273 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit |
268 | /// longer than ideal (which in itself is a concern). | 274 | /// longer than ideal (which in itself is a concern). |
269 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); | 275 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.FrameTime * 1000 * 1.2); |
270 | 276 | ||
271 | SlowFramesStat | 277 | SlowFramesStat |
272 | = new Stat( | 278 | = new Stat( |
@@ -351,10 +357,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
351 | float updateFactor = 1.0f / m_statsUpdateFactor; | 357 | float updateFactor = 1.0f / m_statsUpdateFactor; |
352 | 358 | ||
353 | // the nominal frame time, corrected by reporting multiplier | 359 | // the nominal frame time, corrected by reporting multiplier |
354 | float TargetFrameTime = 1000.0f * m_scene.MinFrameTime / m_reportedFpsCorrectionFactor; | 360 | float TargetFrameTime = 1000.0f * m_scene.FrameTime / m_statisticsFPSfactor; |
355 | 361 | ||
356 | // acumulated fps scaled by reporting multiplier | 362 | // acumulated fps scaled by reporting multiplier |
357 | float reportedFPS = (m_fps * m_reportedFpsCorrectionFactor); | 363 | float reportedFPS = (m_fps * m_statisticsFPSfactor); |
358 | if (reportedFPS <= 0) | 364 | if (reportedFPS <= 0) |
359 | reportedFPS = 1; | 365 | reportedFPS = 1; |
360 | 366 | ||
@@ -376,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | 382 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); |
377 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | 383 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); |
378 | 384 | ||
379 | float physfps = m_pfps * updateFactor; | 385 | float physfps = m_pfps * updateFactor * m_statisticsFPSfactor; |
380 | if (physfps < 0) | 386 | if (physfps < 0) |
381 | physfps = 0; | 387 | physfps = 0; |
382 | else if(physfps > reportedFPS) | 388 | else if(physfps > reportedFPS) |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index ebffda2..42bd849 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -495,7 +495,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | float heartbeat = 1/m_frameWorkScene.MinFrameTime; | 498 | float heartbeat = 1/m_frameWorkScene.FrameTime; |
499 | maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; | 499 | maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; |
500 | maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; | 500 | maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; |
501 | 501 | ||