diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e47aa9cf98..c61a23d42e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1904,14 +1904,17 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Returns the total execution time of all the scripts in the region since the last frame - /// (in milliseconds), and clears the value in preparation for the next frame. + /// Returns the total execution time of all the scripts in the region since the last call + /// (in milliseconds), and clears the value in preparation for the next call. /// /// Time in milliseconds - private long GetAndResetScriptExecutionTime() + + // Warning: this is now called from StatsReporter, and can't be shared + + public long GetAndResetScriptExecutionTime() { long ticks = Interlocked.Exchange(ref m_scriptExecutionTime, 0); - return (ticks * 1000) / Stopwatch.Frequency; + return (ticks * 1000L) / Stopwatch.Frequency; } public void AddGroupTarget(SceneObjectGroup grp) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 7f6a1cd73d..5fe055111c 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -412,6 +412,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_otherMS < 0) m_otherMS = 0; + float scriptTimeMS = m_scene.GetAndResetScriptExecutionTime(); + for (int i = 0; i < m_statisticViewerArraySize; i++) { sb[i] = new SimStatsPacket.StatBlock(); @@ -533,7 +535,7 @@ namespace OpenSim.Region.Framework.Scenes sb[36].StatValue = 0; sb[37].StatID = (uint)Stats.ScriptMS; - sb[37].StatValue = 0; + sb[37].StatValue = scriptTimeMS * perframefactor; for (int i = 0; i < m_statisticViewerArraySize; i++)