From 67892343350a8af916ec4c16d341ad843550d54e Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 16 Oct 2008 13:17:31 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2405 * Implement llGetRegionFPS() * Thanks idb --- OpenSim/Region/Environment/Scenes/Scene.cs | 8 ++++++++ OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 12 ++++++++++++ 2 files changed, 20 insertions(+) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e95b1d7..299d0da 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -196,6 +196,14 @@ namespace OpenSim.Region.Environment.Scenes get { return m_timedilation; } } + /// + /// This is for llGetRegionFPS + /// + public float SimulatorFPS + { + get { return m_statsReporter.getLastReportedSimFPS(); } + } + public int TimePhase { get { return m_timePhase; } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 4c9c59d..70287fc 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -73,6 +73,8 @@ namespace OpenSim.Region.Environment.Scenes private float statsUpdateFactor = 0; private float m_timeDilation = 0; private int m_fps = 0; + // saved last reported value so there is something available for llGetRegionFPS + private float lastReportedSimFPS = 0; private float m_pfps = 0; private int m_agentUpdates = 0; @@ -155,6 +157,8 @@ namespace OpenSim.Region.Environment.Scenes // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there // 0-50 is pretty close to 0-45 float simfps = (int) ((m_fps * 5)); + // save the reported value so there is something available for llGetRegionFPS + lastReportedSimFPS = (float)simfps / statsUpdateFactor; //if (simfps > 45) //simfps = simfps - (simfps - 45); @@ -397,6 +401,14 @@ namespace OpenSim.Region.Environment.Scenes objectCapacity = objects; } + /// + /// This is for llGetRegionFPS + /// + public float getLastReportedSimFPS() + { + return lastReportedSimFPS; + } + #endregion } } -- cgit v1.1