diff options
author | Oren Hurvitz | 2015-08-06 09:54:20 +0300 |
---|---|---|
committer | Oren Hurvitz | 2015-08-11 08:44:27 +0100 |
commit | a568f06b7faea807149205d0e47454e4883e4836 (patch) | |
tree | 7233a00fb1f726519c94a2a0cd6e1aaac4ead8e4 /OpenSim/Region/ScriptEngine/Shared/Instance | |
parent | Show Script Time in the statistics panel (diff) | |
download | opensim-SC_OLD-a568f06b7faea807149205d0e47454e4883e4836.zip opensim-SC_OLD-a568f06b7faea807149205d0e47454e4883e4836.tar.gz opensim-SC_OLD-a568f06b7faea807149205d0e47454e4883e4836.tar.bz2 opensim-SC_OLD-a568f06b7faea807149205d0e47454e4883e4836.tar.xz |
When scripts are sleeping, don't count that as execution time
Sleeping doesn't use the CPU.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 042c30c..c6512ba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -207,6 +207,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
207 | 207 | ||
208 | private EventWaitHandle m_coopSleepHandle; | 208 | private EventWaitHandle m_coopSleepHandle; |
209 | 209 | ||
210 | private Stopwatch executionTimer = new Stopwatch(); | ||
211 | |||
210 | public void ClearQueue() | 212 | public void ClearQueue() |
211 | { | 213 | { |
212 | m_TimerQueued = false; | 214 | m_TimerQueued = false; |
@@ -278,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
278 | foreach (string api in am.GetApis()) | 280 | foreach (string api in am.GetApis()) |
279 | { | 281 | { |
280 | m_Apis[api] = am.CreateApi(api); | 282 | m_Apis[api] = am.CreateApi(api); |
281 | m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); | 283 | m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle, executionTimer); |
282 | } | 284 | } |
283 | 285 | ||
284 | try | 286 | try |
@@ -753,8 +755,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
753 | if (Suspended) | 755 | if (Suspended) |
754 | return 0; | 756 | return 0; |
755 | 757 | ||
756 | Stopwatch timer = new Stopwatch(); | 758 | executionTimer.Restart(); |
757 | timer.Start(); | ||
758 | 759 | ||
759 | try | 760 | try |
760 | { | 761 | { |
@@ -762,9 +763,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
762 | } | 763 | } |
763 | finally | 764 | finally |
764 | { | 765 | { |
765 | timer.Stop(); | 766 | executionTimer.Stop(); |
766 | ExecutionTime.AddSample(timer); | 767 | ExecutionTime.AddSample(executionTimer); |
767 | Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks); | 768 | Part.ParentGroup.Scene.AddScriptExecutionTime(executionTimer.ElapsedTicks); |
768 | } | 769 | } |
769 | } | 770 | } |
770 | } | 771 | } |