diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dce2247..2fe6e22 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; |
@@ -381,6 +382,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | } | 382 | } |
382 | private int m_minFrameTicks; | 383 | private int m_minFrameTicks; |
383 | 384 | ||
385 | public int FrameTimeWarnPercent { get; private set; } | ||
386 | public int FrameTimeCritPercent { get; private set; } | ||
387 | |||
388 | // Normalize the frame related stats to nominal 55fps for viewer and scripts option | ||
389 | // see SimStatsReporter.cs | ||
390 | public bool Normalized55FPS { get; private set; } | ||
391 | |||
384 | /// <summary> | 392 | /// <summary> |
385 | /// The minimum length of time in seconds that will be taken for a scene frame. | 393 | /// The minimum length of time in seconds that will be taken for a scene frame. |
386 | /// </summary> | 394 | /// </summary> |
@@ -856,6 +864,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
856 | { | 864 | { |
857 | m_config = config; | 865 | m_config = config; |
858 | MinFrameTicks = 89; | 866 | MinFrameTicks = 89; |
867 | FrameTimeWarnPercent = 60; | ||
868 | FrameTimeCritPercent = 40; | ||
869 | Normalized55FPS = true; | ||
859 | MinMaintenanceTicks = 1000; | 870 | MinMaintenanceTicks = 1000; |
860 | SeeIntoRegion = true; | 871 | SeeIntoRegion = true; |
861 | 872 | ||
@@ -1083,6 +1094,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1083 | 1094 | ||
1084 | if (startupConfig.Contains("MinFrameTime")) | 1095 | if (startupConfig.Contains("MinFrameTime")) |
1085 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); | 1096 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); |
1097 | FrameTimeWarnPercent = startupConfig.GetInt( "FrameTimeWarnPercent", FrameTimeWarnPercent); | ||
1098 | FrameTimeCritPercent = startupConfig.GetInt( "FrameTimeCritPercent", FrameTimeCritPercent); | ||
1099 | Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS); | ||
1086 | 1100 | ||
1087 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); | 1101 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1088 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1102 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
@@ -1250,13 +1264,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
1250 | get { return m_sceneGraph; } | 1264 | get { return m_sceneGraph; } |
1251 | } | 1265 | } |
1252 | 1266 | ||
1253 | protected virtual void RegisterDefaultSceneEvents() | 1267 | /// <summary> |
1268 | /// Called by the module loader when all modules are loaded, after each module's | ||
1269 | /// RegionLoaded hook is called. This is the earliest time where RequestModuleInterface | ||
1270 | /// may be used. | ||
1271 | /// </summary> | ||
1272 | public void AllModulesLoaded() | ||
1254 | { | 1273 | { |
1255 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); | 1274 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); |
1256 | 1275 | ||
1257 | if (dm != null) | 1276 | if (dm != null) |
1258 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 1277 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
1259 | 1278 | ||
1279 | ISimulatorFeaturesModule fm = RequestModuleInterface<ISimulatorFeaturesModule>(); | ||
1280 | if (fm != null) | ||
1281 | { | ||
1282 | OSD openSimExtras; | ||
1283 | OSDMap openSimExtrasMap; | ||
1284 | |||
1285 | if (!fm.TryGetFeature("OpenSimExtras", out openSimExtras)) | ||
1286 | openSimExtras = new OSDMap(); | ||
1287 | |||
1288 | float FrameTime = MinFrameTicks / 1000.0f; | ||
1289 | float statisticsFPSfactor = 1.0f; | ||
1290 | if(Normalized55FPS) | ||
1291 | statisticsFPSfactor = 55.0f * FrameTime; | ||
1292 | |||
1293 | openSimExtrasMap = (OSDMap)openSimExtras; | ||
1294 | openSimExtrasMap["SimulatorFPS"] = OSD.FromReal(1.0f / FrameTime); | ||
1295 | openSimExtrasMap["SimulatorFPSFactor"] = OSD.FromReal(statisticsFPSfactor); | ||
1296 | openSimExtrasMap["SimulatorFPSWarnPercent"] = OSD.FromInteger(FrameTimeWarnPercent); | ||
1297 | openSimExtrasMap["SimulatorFPSCritPercent"] = OSD.FromInteger(FrameTimeCritPercent); | ||
1298 | |||
1299 | fm.AddFeature("OpenSimExtras", openSimExtrasMap); | ||
1300 | } | ||
1301 | } | ||
1302 | |||
1303 | protected virtual void RegisterDefaultSceneEvents() | ||
1304 | { | ||
1260 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; | 1305 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; |
1261 | } | 1306 | } |
1262 | 1307 | ||