From 097c56330a410274410c87f4748156e08841c5cf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 8 Nov 2015 04:28:46 +0000 Subject: 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) --- OpenSim/Region/Framework/Scenes/Scene.cs | 27 +++++++++++----------- .../Region/Framework/Scenes/SimStatsReporter.cs | 22 +++++++++++------- 2 files changed, 28 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework') 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 public uint MaintenanceRun { get; private set; } /// - /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we - /// will sleep for the remaining period. - /// - /// - /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations - /// occur too quickly (viewer 1) or with even more slide (viewer 2). + /// Frame time /// - public float MinFrameTime { get; private set; } + public float FrameTime { get; private set; } + + // statistics frame scale factor for viewer and scripts. + // see SimStatsReporter.cs + public float StatisticsFPSfactor { get; private set; } /// /// The minimum length of time in seconds that will be taken for a scene frame. @@ -860,7 +859,8 @@ namespace OpenSim.Region.Framework.Scenes : this(regInfo) { m_config = config; - MinFrameTime = 0.089f; + FrameTime = 0.0908f; + StatisticsFPSfactor = 5.0f; MinMaintenanceTime = 1; SeeIntoRegion = true; @@ -1100,7 +1100,8 @@ namespace OpenSim.Region.Framework.Scenes } } - MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); + FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); + StatisticsFPSfactor = startupConfig.GetFloat( "StatisticsFPSfactor", StatisticsFPSfactor); m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); @@ -1729,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_physics == 0) { if (PhysicsEnabled) - physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); + physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); if (SynchronizeScene != null) SynchronizeScene(this); @@ -1861,7 +1862,7 @@ namespace OpenSim.Region.Framework.Scenes // estimate sleep time tmpMS2 = tmpMS - framestart; - tmpMS2 = (double)MinFrameTime * 1000.0D - tmpMS2; + tmpMS2 = (double)FrameTime * 1000.0D - tmpMS2; m_firstHeartbeat = false; @@ -1882,12 +1883,12 @@ namespace OpenSim.Region.Framework.Scenes // Optionally warn if a frame takes double the amount of time that it should. if (DebugUpdates && Util.EnvironmentTickCountSubtract( - m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) + m_lastFrameTick, previousFrameTick) > (int)(FrameTime * 1000 * 2)) m_log.WarnFormat( "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), - MinFrameTime * 1000, + FrameTime * 1000, RegionInfo.RegionName); } 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 /// Parameter to adjust reported scene fps /// /// - /// Our scene loop runs slower than other server implementations, apparantly because we work somewhat differently. - /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might - /// affect clients and monitoring scripts/software. + /// The close we have to a frame rate as expected by viewers, users and scripts + /// is heartbeat rate. + /// heartbeat rate default value is very diferent from the expected one + /// and can be changed from region to region acording to its specific simulation needs + /// since this creates incompatibility with expected values, + /// this scale factor can be used to normalize values to a Virtual FPS. + /// original decision was to use a value of 55fps for all opensim + /// corresponding, with default heartbeat rate, to a value of 5. /// - private float m_reportedFpsCorrectionFactor = 1.0f; + private float m_statisticsFPSfactor = 5.0f; // saved last reported value so there is something available for llGetRegionFPS private float lastReportedSimFPS; @@ -252,6 +257,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; ReportingRegion = scene.RegionInfo; + m_statisticsFPSfactor = scene.StatisticsFPSfactor; m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; @@ -266,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit /// longer than ideal (which in itself is a concern). - SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); + SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.FrameTime * 1000 * 1.2); SlowFramesStat = new Stat( @@ -351,10 +357,10 @@ namespace OpenSim.Region.Framework.Scenes float updateFactor = 1.0f / m_statsUpdateFactor; // the nominal frame time, corrected by reporting multiplier - float TargetFrameTime = 1000.0f * m_scene.MinFrameTime / m_reportedFpsCorrectionFactor; + float TargetFrameTime = 1000.0f * m_scene.FrameTime / m_statisticsFPSfactor; // acumulated fps scaled by reporting multiplier - float reportedFPS = (m_fps * m_reportedFpsCorrectionFactor); + float reportedFPS = (m_fps * m_statisticsFPSfactor); if (reportedFPS <= 0) reportedFPS = 1; @@ -376,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); - float physfps = m_pfps * updateFactor; + float physfps = m_pfps * updateFactor * m_statisticsFPSfactor; if (physfps < 0) physfps = 0; else if(physfps > reportedFPS) -- cgit v1.1