diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e95b1d7a28..299d0da1ae 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 4c9c59d385..70287fc341 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
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7d3badb9b5..9df318c434 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4842,11 +4842,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (double)World.TimeDilation;
}
+ ///
+ /// Returns the value reported in the client Statistics window
+ ///
public LSL_Float llGetRegionFPS()
{
m_host.AddScriptLPS(1);
- //TODO: return actual FPS
- return 10.0f;
+ return World.SimulatorFPS;
}
/* particle system rules should be coming into this routine as doubles, that is