aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
authorMelanie Thielker2015-08-17 21:46:30 +0200
committerMelanie Thielker2015-08-17 21:46:30 +0200
commitc53f732163b391e4bcd33c8acb917deb7598e0a8 (patch)
tree6b396d1678db3ddbdecef28099666461452cf81c /OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
parentRevert "When scripts are sleeping, don't count that as execution time" (diff)
downloadopensim-SC-c53f732163b391e4bcd33c8acb917deb7598e0a8.zip
opensim-SC-c53f732163b391e4bcd33c8acb917deb7598e0a8.tar.gz
opensim-SC-c53f732163b391e4bcd33c8acb917deb7598e0a8.tar.bz2
opensim-SC-c53f732163b391e4bcd33c8acb917deb7598e0a8.tar.xz
Change the IScriptApi back to it's original form, removing XEngine
specific additions that should not have been there in the first place. Sleeping and time measurement are now completely internal to XEngine
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs20
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 }