From ee7debcca69d31573562dafead1f21d50931f632 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 17 Aug 2015 18:11:45 +0200 Subject: Revert "When scripts are sleeping, don't count that as execution time" The approach is good but the way it is written breaks the architecture. Rewrite follows. This reverts commit a568f06b7faea807149205d0e47454e4883e4836. --- .../Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance') diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 8033c90..8a744c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -220,8 +220,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance private EventWaitHandle m_coopSleepHandle; - private Stopwatch executionTimer = new Stopwatch(); - public void ClearQueue() { m_TimerQueued = false; @@ -293,7 +291,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance foreach (string api in am.GetApis()) { m_Apis[api] = am.CreateApi(api); - m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle, executionTimer); + m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); } try @@ -768,7 +766,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (Suspended) return 0; - executionTimer.Restart(); + Stopwatch timer = new Stopwatch(); + timer.Start(); try { @@ -776,9 +775,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance } finally { - executionTimer.Stop(); - ExecutionTime.AddSample(executionTimer); - Part.ParentGroup.Scene.AddScriptExecutionTime(executionTimer.ElapsedTicks); + timer.Stop(); + ExecutionTime.AddSample(timer); + Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks); } } } -- cgit v1.1