diff options
author | Melanie Thielker | 2015-11-12 21:13:44 +0100 |
---|---|---|
committer | Melanie Thielker | 2015-11-12 21:13:44 +0100 |
commit | 8c7f47574040aa116dfb57e8c380e1fad60e5d1a (patch) | |
tree | d2901476267c9c6a2b594a9a7c0102b66297d0e7 /OpenSim/Region | |
parent | Move a call to RequestModuleInterface to a new scene callback function (diff) | |
download | opensim-SC-8c7f47574040aa116dfb57e8c380e1fad60e5d1a.zip opensim-SC-8c7f47574040aa116dfb57e8c380e1fad60e5d1a.tar.gz opensim-SC-8c7f47574040aa116dfb57e8c380e1fad60e5d1a.tar.bz2 opensim-SC-8c7f47574040aa116dfb57e8c380e1fad60e5d1a.tar.xz |
Add some values to the SimulatorFeatures cap's OpenSimExtras section:
SimulatorFPS: The actual optimal FPS of the simulator, un-fudged
SimulatorFPSFactor: The fudge factor that is applied to the stats sent to the viewer
SimulatorFPSWarnPercent: The percentage below which a lag meter should go to amber
SimulatorFPSCritPercent: The percentage below which a lag meter should go to red
To display the real values, a viewer would divide the reported FPS by the SimulatorFPSFactor and use that to calculate the percentage of SimulatorFPS. E.g. reported is 55fps, SimulatorFPSFactor is 5.0 and SimulatorFPS is 11.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 32b45ac..2fcb78d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -39,6 +39,7 @@ using Nini.Config; | |||
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.Packets; | 40 | using OpenMetaverse.Packets; |
41 | using OpenMetaverse.Imaging; | 41 | using OpenMetaverse.Imaging; |
42 | using OpenMetaverse.StructuredData; | ||
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Monitoring; | 44 | using OpenSim.Framework.Monitoring; |
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
@@ -360,6 +361,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | /// Frame time | 361 | /// Frame time |
361 | /// </remarks> | 362 | /// </remarks> |
362 | public float FrameTime { get; private set; } | 363 | public float FrameTime { get; private set; } |
364 | public int FrameTimeWarnPercent { get; private set; } | ||
365 | public int FrameTimeCritPercent { get; private set; } | ||
363 | 366 | ||
364 | // Normalize the frame related stats to nominal 55fps for viewer and scripts option | 367 | // Normalize the frame related stats to nominal 55fps for viewer and scripts option |
365 | // see SimStatsReporter.cs | 368 | // see SimStatsReporter.cs |
@@ -860,6 +863,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | { | 863 | { |
861 | m_config = config; | 864 | m_config = config; |
862 | FrameTime = 0.0908f; | 865 | FrameTime = 0.0908f; |
866 | FrameTimeWarnPercent = 60; | ||
867 | FrameTimeCritPercent = 40; | ||
863 | Normalized55FPS = true; | 868 | Normalized55FPS = true; |
864 | MinMaintenanceTime = 1; | 869 | MinMaintenanceTime = 1; |
865 | SeeIntoRegion = true; | 870 | SeeIntoRegion = true; |
@@ -1101,6 +1106,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1101 | } | 1106 | } |
1102 | 1107 | ||
1103 | FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); | 1108 | FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); |
1109 | FrameTimeWarnPercent = startupConfig.GetInt( "FrameTimeWarnPercent", FrameTimeWarnPercent); | ||
1110 | FrameTimeCritPercent = startupConfig.GetInt( "FrameTimeCritPercent", FrameTimeCritPercent); | ||
1104 | Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); | 1111 | Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); |
1105 | 1112 | ||
1106 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); | 1113 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
@@ -1254,6 +1261,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1254 | 1261 | ||
1255 | if (dm != null) | 1262 | if (dm != null) |
1256 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 1263 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
1264 | |||
1265 | ISimulatorFeaturesModule fm = RequestModuleInterface<ISimulatorFeaturesModule>(); | ||
1266 | if (fm != null) | ||
1267 | { | ||
1268 | OSD openSimExtras; | ||
1269 | OSDMap openSimExtrasMap; | ||
1270 | |||
1271 | if (!fm.TryGetFeature("OpenSimExtras", out openSimExtras)) | ||
1272 | openSimExtras = new OSDMap(); | ||
1273 | |||
1274 | float statisticsFPSfactor = 1.0f; | ||
1275 | if(Normalized55FPS) | ||
1276 | statisticsFPSfactor = 55.0f * FrameTime; | ||
1277 | |||
1278 | openSimExtrasMap = (OSDMap)openSimExtras; | ||
1279 | openSimExtrasMap["SimulatorFPS"] = OSD.FromReal(1.0f / FrameTime); | ||
1280 | openSimExtrasMap["SimulatorFPSFactor"] = OSD.FromReal(statisticsFPSfactor); | ||
1281 | openSimExtrasMap["SimulatorFPSWarnPercent"] = OSD.FromInteger(FrameTimeWarnPercent); | ||
1282 | openSimExtrasMap["SimulatorFPSCritPercent"] = OSD.FromInteger(FrameTimeCritPercent); | ||
1283 | |||
1284 | fm.AddFeature("OpenSimExtras", openSimExtrasMap); | ||
1285 | } | ||
1257 | } | 1286 | } |
1258 | 1287 | ||
1259 | protected virtual void RegisterDefaultSceneEvents() | 1288 | protected virtual void RegisterDefaultSceneEvents() |