diff options
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 47 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 40 |
2 files changed, 68 insertions, 19 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 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 2174e51..3effee7 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -176,11 +176,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
176 | /// Parameter to adjust reported scene fps | 176 | /// Parameter to adjust reported scene fps |
177 | /// </summary> | 177 | /// </summary> |
178 | /// <remarks> | 178 | /// <remarks> |
179 | /// Our scene loop runs slower than other server implementations, apparantly because we work somewhat differently. | 179 | /// The close we have to a frame rate as expected by viewers, users and scripts |
180 | /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might | 180 | /// is heartbeat rate. |
181 | /// affect clients and monitoring scripts/software. | 181 | /// heartbeat rate default value is very diferent from the expected one |
182 | /// and can be changed from region to region acording to its specific simulation needs | ||
183 | /// since this creates incompatibility with expected values, | ||
184 | /// this scale factor can be used to normalize values to a Virtual FPS. | ||
185 | /// original decision was to use a value of 55fps for all opensim | ||
186 | /// corresponding, with default heartbeat rate, to a value of 5. | ||
182 | /// </remarks> | 187 | /// </remarks> |
183 | private float m_reportedFpsCorrectionFactor = 5; | 188 | private float m_statisticsFPSfactor = 5.0f; |
184 | 189 | ||
185 | // saved last reported value so there is something available for llGetRegionFPS | 190 | // saved last reported value so there is something available for llGetRegionFPS |
186 | private float lastReportedSimFPS; | 191 | private float lastReportedSimFPS; |
@@ -278,10 +283,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | m_usersLoggingIn = 0; | 283 | m_usersLoggingIn = 0; |
279 | 284 | ||
280 | m_scene = scene; | 285 | m_scene = scene; |
281 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; | 286 | |
282 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 287 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
283 | ReportingRegion = scene.RegionInfo; | 288 | ReportingRegion = scene.RegionInfo; |
284 | 289 | ||
290 | if(scene.Normalized55FPS) | ||
291 | m_statisticsFPSfactor = 55.0f * m_scene.MinFrameTicks / 1000.0f; | ||
292 | else | ||
293 | m_statisticsFPSfactor = 1.0f; | ||
294 | |||
285 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 295 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
286 | m_report.AutoReset = true; | 296 | m_report.AutoReset = true; |
287 | m_report.Interval = m_statsUpdatesEveryMS; | 297 | m_report.Interval = m_statsUpdatesEveryMS; |
@@ -381,13 +391,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | 391 | ||
382 | #region various statistic googly moogly | 392 | #region various statistic googly moogly |
383 | 393 | ||
384 | // ORIGINAL code commented out until we have time to add our own | 394 | int reportedFPS = (int)(m_fps * m_statisticsFPSfactor); |
385 | // statistics to the statistics window, this will be done as a | ||
386 | // new section given the title of our current project | ||
387 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | ||
388 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | ||
389 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | ||
390 | int reportedFPS = m_fps; | ||
391 | 395 | ||
392 | // save the reported value so there is something available for llGetRegionFPS | 396 | // save the reported value so there is something available for llGetRegionFPS |
393 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 397 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
@@ -395,7 +399,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
395 | // ORIGINAL code commented out until we have time to add our own | 399 | // ORIGINAL code commented out until we have time to add our own |
396 | // statistics to the statistics window | 400 | // statistics to the statistics window |
397 | //float physfps = ((m_pfps / 1000)); | 401 | //float physfps = ((m_pfps / 1000)); |
398 | float physfps = m_numberPhysicsFrames; | 402 | float physfps = m_numberPhysicsFrames * m_statisticsFPSfactor; |
399 | 403 | ||
400 | //if (physfps > 600) | 404 | //if (physfps > 600) |
401 | //physfps = physfps - (physfps - 600); | 405 | //physfps = physfps - (physfps - 600); |
@@ -429,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | 433 | ||
430 | uint thisFrame = m_scene.Frame; | 434 | uint thisFrame = m_scene.Frame; |
431 | uint numFrames = thisFrame - m_lastUpdateFrame; | 435 | uint numFrames = thisFrame - m_lastUpdateFrame; |
432 | float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; | 436 | float framesUpdated = (float)numFrames * m_statisticsFPSfactor; |
433 | m_lastUpdateFrame = thisFrame; | 437 | m_lastUpdateFrame = thisFrame; |
434 | 438 | ||
435 | // Avoid div-by-zero if somehow we've not updated any frames. | 439 | // Avoid div-by-zero if somehow we've not updated any frames. |
@@ -502,22 +506,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
502 | // statistics to the statistics window | 506 | // statistics to the statistics window |
503 | sb[8].StatID = (uint)Stats.FrameMS; | 507 | sb[8].StatID = (uint)Stats.FrameMS; |
504 | //sb[8].StatValue = m_frameMS / framesUpdated; | 508 | //sb[8].StatValue = m_frameMS / framesUpdated; |
505 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; | 509 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; |
506 | 510 | ||
507 | sb[9].StatID = (uint)Stats.NetMS; | 511 | sb[9].StatID = (uint)Stats.NetMS; |
508 | //sb[9].StatValue = m_netMS / framesUpdated; | 512 | //sb[9].StatValue = m_netMS / framesUpdated; |
509 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; | 513 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; |
510 | 514 | ||
511 | sb[10].StatID = (uint)Stats.PhysicsMS; | 515 | sb[10].StatID = (uint)Stats.PhysicsMS; |
512 | //sb[10].StatValue = m_physicsMS / framesUpdated; | 516 | //sb[10].StatValue = m_physicsMS / framesUpdated; |
513 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; | 517 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; |
514 | 518 | ||
515 | sb[11].StatID = (uint)Stats.ImageMS ; | 519 | sb[11].StatID = (uint)Stats.ImageMS ; |
516 | sb[11].StatValue = m_imageMS / framesUpdated; | 520 | sb[11].StatValue = m_imageMS / framesUpdated; |
517 | 521 | ||
518 | sb[12].StatID = (uint)Stats.OtherMS; | 522 | sb[12].StatID = (uint)Stats.OtherMS; |
519 | //sb[12].StatValue = m_otherMS / framesUpdated; | 523 | //sb[12].StatValue = m_otherMS / framesUpdated; |
520 | sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; | 524 | sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored / m_statisticsFPSfactor; |
521 | 525 | ||
522 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 526 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
523 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); | 527 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |