aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorOren Hurvitz2015-08-06 09:54:20 +0300
committerOren Hurvitz2015-08-11 08:44:27 +0100
commita568f06b7faea807149205d0e47454e4883e4836 (patch)
tree7233a00fb1f726519c94a2a0cd6e1aaac4ead8e4 /OpenSim/Region/ScriptEngine
parentShow Script Time in the statistics panel (diff)
downloadopensim-SC-a568f06b7faea807149205d0e47454e4883e4836.zip
opensim-SC-a568f06b7faea807149205d0e47454e4883e4836.tar.gz
opensim-SC-a568f06b7faea807149205d0e47454e4883e4836.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs16
18 files changed, 95 insertions, 49 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 30e99b0..0f65877 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Diagnostics;
29using System.Threading; 30using System.Threading;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -45,7 +46,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
45 /// <param name='host'>/param> 46 /// <param name='host'>/param>
46 /// <param name='item'>/param> 47 /// <param name='item'>/param>
47 /// <param name='coopSleepHandle'>/param> 48 /// <param name='coopSleepHandle'>/param>
49 /// <param name="executionTimer">The timer used to measure how long the script has executed</param>
48 void Initialize( 50 void Initialize(
49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle); 51 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle,
52 Stopwatch executionTimer);
50 } 53 }
51} \ No newline at end of file 54} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fa762a6..7521ea6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -104,6 +104,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
104 WaitHandle m_coopSleepHandle; 104 WaitHandle m_coopSleepHandle;
105 105
106 /// <summary> 106 /// <summary>
107 /// The timer used by the ScriptInstance to measure how long the script has executed.
108 /// </summary>
109 private Stopwatch m_executionTimer;
110
111 /// <summary>
107 /// The item that hosts this script 112 /// The item that hosts this script
108 /// </summary> 113 /// </summary>
109 protected TaskInventoryItem m_item; 114 protected TaskInventoryItem m_item;
@@ -262,12 +267,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
262 }; 267 };
263 268
264 public void Initialize( 269 public void Initialize(
265 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 270 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle,
271 Stopwatch executionTimer)
266 { 272 {
267 m_ScriptEngine = scriptEngine; 273 m_ScriptEngine = scriptEngine;
268 m_host = host; 274 m_host = host;
269 m_item = item; 275 m_item = item;
270 m_coopSleepHandle = coopSleepHandle; 276 m_coopSleepHandle = coopSleepHandle;
277 m_executionTimer = executionTimer;
271 278
272 LoadConfig(); 279 LoadConfig();
273 280
@@ -406,10 +413,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
406 413
407 protected virtual void Sleep(int delay) 414 protected virtual void Sleep(int delay)
408 { 415 {
409 if (m_coopSleepHandle == null) 416 if (m_executionTimer != null)
410 System.Threading.Thread.Sleep(delay); 417 m_executionTimer.Stop(); // sleep time doesn't count as execution time, since it doesn't use the CPU
411 else 418
412 CheckForCoopTermination(delay); 419 try
420 {
421 if (m_coopSleepHandle == null)
422 System.Threading.Thread.Sleep(delay);
423 else
424 CheckForCoopTermination(delay);
425 }
426 finally
427 {
428 if (m_executionTimer != null)
429 m_executionTimer.Start();
430 }
413 } 431 }
414 432
415 /// <summary> 433 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 3406aea..9bb12d3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -51,6 +51,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
54using System.Diagnostics;
54 55
55namespace OpenSim.Region.ScriptEngine.Shared.Api 56namespace OpenSim.Region.ScriptEngine.Shared.Api
56{ 57{
@@ -63,7 +64,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
63 internal IScriptModuleComms m_comms = null; 64 internal IScriptModuleComms m_comms = null;
64 65
65 public void Initialize( 66 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 67 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle,
68 Stopwatch executionTimer)
67 { 69 {
68 m_ScriptEngine = scriptEngine; 70 m_ScriptEngine = scriptEngine;
69 m_host = host; 71 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 92dd813..39505e1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -51,6 +51,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
54using System.Diagnostics;
54 55
55namespace OpenSim.Region.ScriptEngine.Shared.Api 56namespace OpenSim.Region.ScriptEngine.Shared.Api
56{ 57{
@@ -66,7 +67,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
66 internal IScriptModuleComms m_comms = null; 67 internal IScriptModuleComms m_comms = null;
67 68
68 public void Initialize( 69 public void Initialize(
69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 70 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle,
71 Stopwatch executionTimer)
70 { 72 {
71 m_ScriptEngine = scriptEngine; 73 m_ScriptEngine = scriptEngine;
72 m_host = host; 74 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 123f8ca..4bb0b74 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -41,6 +41,7 @@ using OpenMetaverse.StructuredData;
41using Nini.Config; 41using Nini.Config;
42using OpenSim; 42using OpenSim;
43using OpenSim.Framework; 43using OpenSim.Framework;
44using System.Diagnostics;
44 45
45using OpenSim.Framework.Console; 46using OpenSim.Framework.Console;
46using OpenSim.Region.Framework.Interfaces; 47using OpenSim.Region.Framework.Interfaces;
@@ -142,14 +143,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
142 internal float m_ScriptDistanceFactor = 1.0f; 143 internal float m_ScriptDistanceFactor = 1.0f;
143 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); 144 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
144 145
146 /// <summary>
147 /// The timer used by the ScriptInstance to measure how long the script has executed.
148 /// </summary>
149 private Stopwatch m_executionTimer;
150
145 protected IUrlModule m_UrlModule = null; 151 protected IUrlModule m_UrlModule = null;
146 152
147 public void Initialize( 153 public void Initialize(
148 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 154 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle,
155 Stopwatch executionTimer)
149 { 156 {
150 m_ScriptEngine = scriptEngine; 157 m_ScriptEngine = scriptEngine;
151 m_host = host; 158 m_host = host;
152 m_item = item; 159 m_item = item;
160 m_executionTimer = executionTimer;
153 161
154 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 162 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
155 163
@@ -432,7 +440,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
432 delay = (int)((float)delay * m_ScriptDelayFactor); 440 delay = (int)((float)delay * m_ScriptDelayFactor);
433 if (delay == 0) 441 if (delay == 0)
434 return; 442 return;
435 System.Threading.Thread.Sleep(delay); 443
444 if (m_executionTimer != null)
445 m_executionTimer.Stop(); // sleep time doesn't count as execution time, since it doesn't use the CPU
446
447 try
448 {
449 System.Threading.Thread.Sleep(delay);
450 }
451 finally
452 {
453 if (m_executionTimer != null)
454 m_executionTimer.Start();
455 }
436 } 456 }
437 457
438 public LSL_Integer osSetTerrainHeight(int x, int y, double val) 458 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
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 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
index 8170e9b..06494b0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
95 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); 95 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f);
96 96
97 LSL_Api apiGrp1 = new LSL_Api(); 97 LSL_Api apiGrp1 = new LSL_Api();
98 apiGrp1.Initialize(m_engine, part, null, null); 98 apiGrp1.Initialize(m_engine, part, null, null, null);
99 99
100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
101 101
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index e35de9c..c3672d8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
107 m_lslApi = new LSL_Api(); 107 m_lslApi = new LSL_Api();
108 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null); 108 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null, null);
109 } 109 }
110 110
111 [TearDown] 111 [TearDown]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 3ff4c6b..96e0356 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId); 94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
95 95
96 LSL_Api api = new LSL_Api(); 96 LSL_Api api = new LSL_Api();
97 api.Initialize(m_engine, so1.RootPart, null, null); 97 api.Initialize(m_engine, so1.RootPart, null, null, null);
98 98
99 // Create a second object 99 // Create a second object
100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); 100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
128 m_scene.AddSceneObject(so1); 128 m_scene.AddSceneObject(so1);
129 LSL_Api api = new LSL_Api(); 129 LSL_Api api = new LSL_Api();
130 api.Initialize(m_engine, so1.RootPart, null, null); 130 api.Initialize(m_engine, so1.RootPart, null, null, null);
131 131
132 // Create an object embedded inside the first 132 // Create an object embedded inside the first
133 UUID itemId = TestHelpers.ParseTail(0x20); 133 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); 137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
138 m_scene.AddSceneObject(so2); 138 m_scene.AddSceneObject(so2);
139 LSL_Api api2 = new LSL_Api(); 139 LSL_Api api2 = new LSL_Api();
140 api2.Initialize(m_engine, so2.RootPart, null, null); 140 api2.Initialize(m_engine, so2.RootPart, null, null, null);
141 141
142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** 142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); 143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
@@ -184,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
184 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 184 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
185 m_scene.AddSceneObject(so1); 185 m_scene.AddSceneObject(so1);
186 LSL_Api api = new LSL_Api(); 186 LSL_Api api = new LSL_Api();
187 api.Initialize(m_engine, so1.RootPart, null, null); 187 api.Initialize(m_engine, so1.RootPart, null, null, null);
188 188
189 // Create an object embedded inside the first 189 // Create an object embedded inside the first
190 UUID itemId = TestHelpers.ParseTail(0x20); 190 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
218 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 218 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
219 m_scene.AddSceneObject(so1); 219 m_scene.AddSceneObject(so1);
220 LSL_Api api = new LSL_Api(); 220 LSL_Api api = new LSL_Api();
221 api.Initialize(m_engine, so1.RootPart, null, null); 221 api.Initialize(m_engine, so1.RootPart, null, null, null);
222 222
223 // Create an object embedded inside the first 223 // Create an object embedded inside the first
224 UUID itemId = TestHelpers.ParseTail(0x20); 224 UUID itemId = TestHelpers.ParseTail(0x20);
@@ -250,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id); 250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id);
251 m_scene.AddSceneObject(sourceSo); 251 m_scene.AddSceneObject(sourceSo);
252 LSL_Api api = new LSL_Api(); 252 LSL_Api api = new LSL_Api();
253 api.Initialize(m_engine, sourceSo.RootPart, null, null); 253 api.Initialize(m_engine, sourceSo.RootPart, null, null, null);
254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World"); 254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
255 255
256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id); 256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index b6f5e09..4323be0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
104 m_scene.AddSceneObject(grp2); 104 m_scene.AddSceneObject(grp2);
105 105
106 LSL_Api apiGrp1 = new LSL_Api(); 106 LSL_Api apiGrp1 = new LSL_Api();
107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null, null);
108 108
109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); 109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
110 110
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
132 132
133 LSL_Api apiGrp1 = new LSL_Api(); 133 LSL_Api apiGrp1 = new LSL_Api();
134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null, null);
135 135
136 apiGrp1.llBreakLink(2); 136 apiGrp1.llBreakLink(2);
137 137
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
161 161
162 LSL_Api apiGrp1 = new LSL_Api(); 162 LSL_Api apiGrp1 = new LSL_Api();
163 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 163 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null, null);
164 164
165 apiGrp1.llBreakAllLinks(); 165 apiGrp1.llBreakAllLinks();
166 166
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
index 0b1ae60..6bbc7bb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
67 engine.AddRegion(scene); 67 engine.AddRegion(scene);
68 68
69 m_lslApi = new LSL_Api(); 69 m_lslApi = new LSL_Api();
70 m_lslApi.Initialize(engine, part, null, null); 70 m_lslApi.Initialize(engine, part, null, null, null);
71 } 71 }
72 72
73 [Test] 73 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index 2ac12cb..97d79e7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
68 m_lslApi = new LSL_Api(); 68 m_lslApi = new LSL_Api();
69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null); 69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null, null);
70 } 70 }
71 71
72 [Test] 72 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
index caf2b05..b644814 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
89 m_scene.AddSceneObject(grp1); 89 m_scene.AddSceneObject(grp1);
90 90
91 LSL_Api apiGrp1 = new LSL_Api(); 91 LSL_Api apiGrp1 = new LSL_Api();
92 apiGrp1.Initialize(m_engine, grp1.RootPart, null, null); 92 apiGrp1.Initialize(m_engine, grp1.RootPart, null, null, null);
93 93
94 // Check simple 1 prim case 94 // Check simple 1 prim case
95 { 95 {
@@ -167,7 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
167 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); 167 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
168 168
169 LSL_Api apiGrp1 = new LSL_Api(); 169 LSL_Api apiGrp1 = new LSL_Api();
170 apiGrp1.Initialize(m_engine, part1, null, null); 170 apiGrp1.Initialize(m_engine, part1, null, null, null);
171 171
172 // Note that prim hollow check is passed with the other prim params in order to allow the 172 // Note that prim hollow check is passed with the other prim params in order to allow the
173 // specification of a different check value from the prim param. A cylinder, prism, sphere, 173 // specification of a different check value from the prim param. A cylinder, prism, sphere,
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 1b7aa63..f9907b6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
65 engine.AddRegion(scene); 65 engine.AddRegion(scene);
66 66
67 m_lslApi = new LSL_Api(); 67 m_lslApi = new LSL_Api();
68 m_lslApi.Initialize(engine, part, null, null); 68 m_lslApi.Initialize(engine, part, null, null, null);
69 } 69 }
70 70
71 [Test] 71 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
index 40082b5..e2546ad 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part); 71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
72 72
73 LSL_Api apiGrp1 = new LSL_Api(); 73 LSL_Api apiGrp1 = new LSL_Api();
74 apiGrp1.Initialize(m_engine, part, scriptItem, null); 74 apiGrp1.Initialize(m_engine, part, scriptItem, null, null);
75 75
76 // Initially long timeout to test cache 76 // Initially long timeout to test cache
77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000; 77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index 4c31969..f452646 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
93 m_scene.AddSceneObject(so); 93 m_scene.AddSceneObject(so);
94 94
95 OSSL_Api osslApi = new OSSL_Api(); 95 OSSL_Api osslApi = new OSSL_Api();
96 osslApi.Initialize(m_engine, part, null, null); 96 osslApi.Initialize(m_engine, part, null, null, null);
97 97
98 string notecardName = "appearanceNc"; 98 string notecardName = "appearanceNc";
99 99
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
134 m_scene.AddSceneObject(so); 134 m_scene.AddSceneObject(so);
135 135
136 OSSL_Api osslApi = new OSSL_Api(); 136 OSSL_Api osslApi = new OSSL_Api();
137 osslApi.Initialize(m_engine, part, null, null); 137 osslApi.Initialize(m_engine, part, null, null, null);
138 138
139 string notecardName = "appearanceNc"; 139 string notecardName = "appearanceNc";
140 140
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index 2fe558a..418f168 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -98,9 +98,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
100 100
101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
102 OSSL_Api osslApi = new OSSL_Api(); 102 OSSL_Api osslApi = new OSSL_Api();
103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
104 104
105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); 105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
106 106
@@ -144,9 +144,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
146 146
147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
148 OSSL_Api osslApi = new OSSL_Api(); 148 OSSL_Api osslApi = new OSSL_Api();
149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
150 150
151 // Create an object embedded inside the first 151 // Create an object embedded inside the first
152 TaskInventoryHelpers.AddNotecard( 152 TaskInventoryHelpers.AddNotecard(
@@ -192,9 +192,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart); 193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
194 194
195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
196 OSSL_Api osslApi = new OSSL_Api(); 196 OSSL_Api osslApi = new OSSL_Api();
197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null, null);
198 198
199 // Create an object embedded inside the first 199 // Create an object embedded inside the first
200 TaskInventoryHelpers.AddSceneObject( 200 TaskInventoryHelpers.AddSceneObject(
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 398ccbe..2b7d70e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
99 m_scene.AddSceneObject(so); 99 m_scene.AddSceneObject(so);
100 100
101 OSSL_Api osslApi = new OSSL_Api(); 101 OSSL_Api osslApi = new OSSL_Api();
102 osslApi.Initialize(m_engine, part, null, null); 102 osslApi.Initialize(m_engine, part, null, null, null);
103 103
104 string notecardName = "appearanceNc"; 104 string notecardName = "appearanceNc";
105 osslApi.osOwnerSaveAppearance(notecardName); 105 osslApi.osOwnerSaveAppearance(notecardName);
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
125 m_scene.AddSceneObject(so); 125 m_scene.AddSceneObject(so);
126 126
127 OSSL_Api osslApi = new OSSL_Api(); 127 OSSL_Api osslApi = new OSSL_Api();
128 osslApi.Initialize(m_engine, so.RootPart, null, null); 128 osslApi.Initialize(m_engine, so.RootPart, null, null, null);
129 129
130 bool gotExpectedException = false; 130 bool gotExpectedException = false;
131 try 131 try
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
160 m_scene.AddSceneObject(so); 160 m_scene.AddSceneObject(so);
161 161
162 OSSL_Api osslApi = new OSSL_Api(); 162 OSSL_Api osslApi = new OSSL_Api();
163 osslApi.Initialize(m_engine, part, null, null); 163 osslApi.Initialize(m_engine, part, null, null, null);
164 164
165 string notecardName = "appearanceNc"; 165 string notecardName = "appearanceNc";
166 osslApi.osOwnerSaveAppearance(notecardName); 166 osslApi.osOwnerSaveAppearance(notecardName);
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
195 m_scene.AddSceneObject(so); 195 m_scene.AddSceneObject(so);
196 196
197 OSSL_Api osslApi = new OSSL_Api(); 197 OSSL_Api osslApi = new OSSL_Api();
198 osslApi.Initialize(m_engine, part, null, null); 198 osslApi.Initialize(m_engine, part, null, null, null);
199 199
200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
201 201
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
233 m_scene.AddSceneObject(so); 233 m_scene.AddSceneObject(so);
234 234
235 OSSL_Api osslApi = new OSSL_Api(); 235 OSSL_Api osslApi = new OSSL_Api();
236 osslApi.Initialize(m_engine, part, null, null); 236 osslApi.Initialize(m_engine, part, null, null, null);
237 237
238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
239 239
@@ -285,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
285 m_scene.AddSceneObject(otherSo); 285 m_scene.AddSceneObject(otherSo);
286 286
287 OSSL_Api osslApi = new OSSL_Api(); 287 OSSL_Api osslApi = new OSSL_Api();
288 osslApi.Initialize(m_engine, part, null, null); 288 osslApi.Initialize(m_engine, part, null, null, null);
289 289
290 OSSL_Api otherOsslApi = new OSSL_Api(); 290 OSSL_Api otherOsslApi = new OSSL_Api();
291 otherOsslApi.Initialize(m_engine, otherPart, null, null); 291 otherOsslApi.Initialize(m_engine, otherPart, null, null, null);
292 292
293 string notecardName = "appearanceNc"; 293 string notecardName = "appearanceNc";
294 osslApi.osOwnerSaveAppearance(notecardName); 294 osslApi.osOwnerSaveAppearance(notecardName);
@@ -332,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
332 m_scene.AddSceneObject(so); 332 m_scene.AddSceneObject(so);
333 333
334 OSSL_Api osslApi = new OSSL_Api(); 334 OSSL_Api osslApi = new OSSL_Api();
335 osslApi.Initialize(m_engine, part, null, null); 335 osslApi.Initialize(m_engine, part, null, null, null);
336 336
337 string notecardName = "appearanceNc"; 337 string notecardName = "appearanceNc";
338 osslApi.osOwnerSaveAppearance(notecardName); 338 osslApi.osOwnerSaveAppearance(notecardName);