From 752a1534f8cea6ad086b4e47ab96b8939664e55d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 13 Nov 2015 01:12:37 +0000
Subject: add the option Normalized55FPS. This is transition code ported from
avinationmerge branch. (configration file changes will be commited later)
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++
.../Region/Framework/Scenes/SimStatsReporter.cs | 40 ++++++++++++----------
2 files changed, 28 insertions(+), 18 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dce2247..cca8963 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 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
/// 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);
--
cgit v1.1
From 75befda6df8f0000122e440ad437338287c5d27c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 13 Nov 2015 02:12:13 +0000
Subject: Add some values to the SimulatorFeatures cap's OpenSimExtras section
relative to FPS statistics. This is transition code ported from
avinationmerge.
---
.../RegionModulesControllerPlugin.cs | 2 ++
OpenSim/Region/Framework/Scenes/Scene.cs | 41 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
index 17edb67..8f38a29 100644
--- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
@@ -509,6 +509,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
{
module.RegionLoaded(scene);
}
+
+ scene.AllModulesLoaded();
}
public void RemoveRegionFromModules (Scene scene)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cca8963..2fe6e22 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;
@@ -381,6 +382,9 @@ namespace OpenSim.Region.Framework.Scenes
}
private int m_minFrameTicks;
+ 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
public bool Normalized55FPS { get; private set; }
@@ -860,6 +864,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_config = config;
MinFrameTicks = 89;
+ FrameTimeWarnPercent = 60;
+ FrameTimeCritPercent = 40;
Normalized55FPS = true;
MinMaintenanceTicks = 1000;
SeeIntoRegion = true;
@@ -1088,6 +1094,8 @@ namespace OpenSim.Region.Framework.Scenes
if (startupConfig.Contains("MinFrameTime"))
MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000);
+ FrameTimeWarnPercent = startupConfig.GetInt( "FrameTimeWarnPercent", FrameTimeWarnPercent);
+ FrameTimeCritPercent = startupConfig.GetInt( "FrameTimeCritPercent", FrameTimeCritPercent);
Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS);
m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup);
@@ -1256,13 +1264,44 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGraph; }
}
- protected virtual void RegisterDefaultSceneEvents()
+ ///
+ /// Called by the module loader when all modules are loaded, after each module's
+ /// RegionLoaded hook is called. This is the earliest time where RequestModuleInterface
+ /// may be used.
+ ///
+ public void AllModulesLoaded()
{
IDialogModule dm = RequestModuleInterface();
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 FrameTime = MinFrameTicks / 1000.0f;
+ 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()
+ {
m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement;
}
--
cgit v1.1