diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 32b45ac85f..2fcb78d9b9 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -39,6 +39,7 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.Packets; using OpenMetaverse.Imaging; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using OpenSim.Services.Interfaces; @@ -360,6 +361,8 @@ namespace OpenSim.Region.Framework.Scenes /// Frame time /// public float FrameTime { get; private set; } + public int FrameTimeWarnPercent { get; private set; } + public int FrameTimeCritPercent { get; private set; } // Normalize the frame related stats to nominal 55fps for viewer and scripts option // see SimStatsReporter.cs @@ -860,6 +863,8 @@ namespace OpenSim.Region.Framework.Scenes { m_config = config; FrameTime = 0.0908f; + FrameTimeWarnPercent = 60; + FrameTimeCritPercent = 40; Normalized55FPS = true; MinMaintenanceTime = 1; SeeIntoRegion = true; @@ -1101,6 +1106,8 @@ namespace OpenSim.Region.Framework.Scenes } FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); + FrameTimeWarnPercent = startupConfig.GetInt( "FrameTimeWarnPercent", FrameTimeWarnPercent); + FrameTimeCritPercent = startupConfig.GetInt( "FrameTimeCritPercent", FrameTimeCritPercent); Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); @@ -1254,6 +1261,28 @@ namespace OpenSim.Region.Framework.Scenes if (dm != null) m_eventManager.OnPermissionError += dm.SendAlertToUser; + + ISimulatorFeaturesModule fm = RequestModuleInterface(); + if (fm != null) + { + OSD openSimExtras; + OSDMap openSimExtrasMap; + + if (!fm.TryGetFeature("OpenSimExtras", out openSimExtras)) + openSimExtras = new OSDMap(); + + float statisticsFPSfactor = 1.0f; + if(Normalized55FPS) + statisticsFPSfactor = 55.0f * FrameTime; + + openSimExtrasMap = (OSDMap)openSimExtras; + openSimExtrasMap["SimulatorFPS"] = OSD.FromReal(1.0f / FrameTime); + openSimExtrasMap["SimulatorFPSFactor"] = OSD.FromReal(statisticsFPSfactor); + openSimExtrasMap["SimulatorFPSWarnPercent"] = OSD.FromInteger(FrameTimeWarnPercent); + openSimExtrasMap["SimulatorFPSCritPercent"] = OSD.FromInteger(FrameTimeCritPercent); + + fm.AddFeature("OpenSimExtras", openSimExtrasMap); + } } protected virtual void RegisterDefaultSceneEvents() diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index fadd359ca2..1481fca653 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -174,7 +174,7 @@ ; Adicionaly they are scaled to values they whould have on a system running at a nominal 55 frames per second rate ; The scale factor it 55 * FrameTime, corresponding to 5 with default configuration ; You can choose to not apply this scale factor setting Normalized55FPS to false. - ; Normalized55FPS = false + ; Normalized55FPS = true ; Main Frame time ; This defines the rate of several simulation events. @@ -185,6 +185,14 @@ ; changing this value, you need to change some of the following *EveryNFrames so their actions timing remains the same FrameTime = 0.0909 + ; The values below represent the percentage of the target frame time that, + ; when underrun, should trigger yellow or red in the lag meter. + ; Less than 60% of FPS is amber by default, less then 40% is red. + ; These values are advisory. Viewers may choose to not use them but it is + ; encouraged that they do. + ; FrameTimeWarnPercent = 60; + ; FrameTimeCritPercent = 40; + ; Send scheduled updates to objects in the scene ; This must be a whole number UpdateObjectsEveryNFrames = 1;