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.
avinationmerge
Melanie Thielker 2015-11-12 21:13:44 +01:00
parent d3911606ef
commit 8c7f475740
2 changed files with 38 additions and 1 deletions

View File

@ -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
/// </remarks>
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<ISimulatorFeaturesModule>();
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()

View File

@ -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;