diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 8a744c3..fa6e6fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -100,6 +100,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
100 | 100 | ||
101 | public int DebugLevel { get; set; } | 101 | public int DebugLevel { get; set; } |
102 | 102 | ||
103 | public WaitHandle CoopWaitHandle { get; private set; } | ||
104 | public Stopwatch ExecutionTimer { get; private set; } | ||
105 | |||
103 | public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } | 106 | public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } |
104 | 107 | ||
105 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); | 108 | private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); |
@@ -234,6 +237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
234 | { | 237 | { |
235 | State = "default"; | 238 | State = "default"; |
236 | EventQueue = new Queue(32); | 239 | EventQueue = new Queue(32); |
240 | ExecutionTimer = new Stopwatch(); | ||
237 | 241 | ||
238 | Engine = engine; | 242 | Engine = engine; |
239 | Part = part; | 243 | Part = part; |
@@ -286,12 +290,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
286 | m_stateSource = stateSource; | 290 | m_stateSource = stateSource; |
287 | m_coopTermination = coopTermination; | 291 | m_coopTermination = coopTermination; |
288 | 292 | ||
293 | if (m_coopTermination) | ||
294 | CoopWaitHandle = coopSleepHandle; | ||
295 | else | ||
296 | CoopWaitHandle = null; | ||
297 | |||
289 | ApiManager am = new ApiManager(); | 298 | ApiManager am = new ApiManager(); |
290 | 299 | ||
291 | foreach (string api in am.GetApis()) | 300 | foreach (string api in am.GetApis()) |
292 | { | 301 | { |
293 | m_Apis[api] = am.CreateApi(api); | 302 | m_Apis[api] = am.CreateApi(api); |
294 | m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); | 303 | m_Apis[api].Initialize(Engine, Part, ScriptTask); |
295 | } | 304 | } |
296 | 305 | ||
297 | try | 306 | try |
@@ -766,8 +775,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
766 | if (Suspended) | 775 | if (Suspended) |
767 | return 0; | 776 | return 0; |
768 | 777 | ||
769 | Stopwatch timer = new Stopwatch(); | 778 | ExecutionTimer.Restart(); |
770 | timer.Start(); | ||
771 | 779 | ||
772 | try | 780 | try |
773 | { | 781 | { |
@@ -775,9 +783,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
775 | } | 783 | } |
776 | finally | 784 | finally |
777 | { | 785 | { |
778 | timer.Stop(); | 786 | ExecutionTimer.Stop(); |
779 | ExecutionTime.AddSample(timer); | 787 | ExecutionTime.AddSample(ExecutionTimer); |
780 | Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks); | 788 | Part.ParentGroup.Scene.AddScriptExecutionTime(ExecutionTimer.ElapsedTicks); |
781 | } | 789 | } |
782 | } | 790 | } |
783 | } | 791 | } |