diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dce2247dc5..cca8963aa9 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -381,6 +381,10 @@ namespace OpenSim.Region.Framework.Scenes } private int m_minFrameTicks; + // Normalize the frame related stats to nominal 55fps for viewer and scripts option + // see SimStatsReporter.cs + public bool Normalized55FPS { get; private set; } + /// /// The minimum length of time in seconds that will be taken for a scene frame. /// @@ -856,6 +860,7 @@ namespace OpenSim.Region.Framework.Scenes { m_config = config; MinFrameTicks = 89; + Normalized55FPS = true; MinMaintenanceTicks = 1000; SeeIntoRegion = true; @@ -1083,6 +1088,7 @@ namespace OpenSim.Region.Framework.Scenes if (startupConfig.Contains("MinFrameTime")) MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); + Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 2174e5157a..3effee7ab2 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -176,11 +176,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 = 5; + private float m_statisticsFPSfactor = 5.0f; // saved last reported value so there is something available for llGetRegionFPS private float lastReportedSimFPS; @@ -278,10 +283,15 @@ namespace OpenSim.Region.Framework.Scenes m_usersLoggingIn = 0; m_scene = scene; - m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; + m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); ReportingRegion = scene.RegionInfo; + if(scene.Normalized55FPS) + m_statisticsFPSfactor = 55.0f * m_scene.MinFrameTicks / 1000.0f; + else + m_statisticsFPSfactor = 1.0f; + m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; m_report.Interval = m_statsUpdatesEveryMS; @@ -381,13 +391,7 @@ namespace OpenSim.Region.Framework.Scenes #region various statistic googly moogly - // ORIGINAL code commented out until we have time to add our own - // statistics to the statistics window, this will be done as a - // new section given the title of our current project - // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently - // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. - //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); - int reportedFPS = m_fps; + int reportedFPS = (int)(m_fps * m_statisticsFPSfactor); // save the reported value so there is something available for llGetRegionFPS lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; @@ -395,7 +399,7 @@ namespace OpenSim.Region.Framework.Scenes // ORIGINAL code commented out until we have time to add our own // statistics to the statistics window //float physfps = ((m_pfps / 1000)); - float physfps = m_numberPhysicsFrames; + float physfps = m_numberPhysicsFrames * m_statisticsFPSfactor; //if (physfps > 600) //physfps = physfps - (physfps - 600); @@ -429,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes uint thisFrame = m_scene.Frame; uint numFrames = thisFrame - m_lastUpdateFrame; - float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; + float framesUpdated = (float)numFrames * m_statisticsFPSfactor; m_lastUpdateFrame = thisFrame; // Avoid div-by-zero if somehow we've not updated any frames. @@ -502,22 +506,22 @@ namespace OpenSim.Region.Framework.Scenes // statistics to the statistics window sb[8].StatID = (uint)Stats.FrameMS; //sb[8].StatValue = m_frameMS / framesUpdated; - sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; + sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; sb[9].StatID = (uint)Stats.NetMS; //sb[9].StatValue = m_netMS / framesUpdated; - sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; + sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; sb[10].StatID = (uint)Stats.PhysicsMS; //sb[10].StatValue = m_physicsMS / framesUpdated; - sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; + sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; sb[11].StatID = (uint)Stats.ImageMS ; sb[11].StatValue = m_imageMS / framesUpdated; sb[12].StatID = (uint)Stats.OtherMS; //sb[12].StatValue = m_otherMS / framesUpdated; - sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; + sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; sb[13].StatID = (uint)Stats.InPacketsPerSecond; sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);