aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs51
1 files changed, 39 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 0460f22..965101a 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Globalization; 31using System.Globalization;
32using System.IO; 32using System.IO;
33using System.Linq;
33using System.Reflection; 34using System.Reflection;
34using System.Security; 35using System.Security;
35using System.Security.Policy; 36using System.Security.Policy;
@@ -377,9 +378,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
377 /// </summary> 378 /// </summary>
378 /// <param name="cmdparams"></param> 379 /// <param name="cmdparams"></param>
379 /// <param name="instance"></param> 380 /// <param name="instance"></param>
380 /// <returns>true if we're okay to proceed, false if not.</returns> 381 /// <param name="comparer">Basis on which to sort output. Can be null if no sort needs to take place</param>
381 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action) 382 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action)
382 { 383 {
384 HandleScriptsAction<object>(cmdparams, action, null);
385 }
386
387 /// <summary>
388 /// Parse the raw item id into a script instance from the command params if it's present.
389 /// </summary>
390 /// <param name="cmdparams"></param>
391 /// <param name="instance"></param>
392 /// <param name="keySelector">Basis on which to sort output. Can be null if no sort needs to take place</param>
393 private void HandleScriptsAction<TKey>(
394 string[] cmdparams, Action<IScriptInstance> action, Func<IScriptInstance, TKey> keySelector)
395 {
383 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) 396 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
384 return; 397 return;
385 398
@@ -390,7 +403,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
390 403
391 if (cmdparams.Length == 2) 404 if (cmdparams.Length == 2)
392 { 405 {
393 foreach (IScriptInstance instance in m_Scripts.Values) 406 IEnumerable<IScriptInstance> scripts = m_Scripts.Values;
407
408 if (keySelector != null)
409 scripts = scripts.OrderBy<IScriptInstance, TKey>(keySelector);
410
411 foreach (IScriptInstance instance in scripts)
394 action(instance); 412 action(instance);
395 413
396 return; 414 return;
@@ -437,9 +455,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
437 StringBuilder sb = new StringBuilder(); 455 StringBuilder sb = new StringBuilder();
438 sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); 456 sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
439 457
458 long scriptsLoaded, eventsQueued = 0, eventsProcessed = 0;
459
440 lock (m_Scripts) 460 lock (m_Scripts)
441 sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count); 461 {
462 scriptsLoaded = m_Scripts.Count;
442 463
464 foreach (IScriptInstance si in m_Scripts.Values)
465 {
466 eventsQueued += si.EventsQueued;
467 eventsProcessed += si.EventsProcessed;
468 }
469 }
470
471 sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded);
443 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); 472 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
444 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); 473 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
445 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); 474 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
@@ -448,6 +477,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
448 sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); 477 sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
449 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); 478 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
450// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); 479// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
480 sb.AppendFormat("Events queued : {0}\n", eventsQueued);
481 sb.AppendFormat("Events processed : {0}\n", eventsProcessed);
451 482
452 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); 483 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
453 sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0); 484 sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0);
@@ -478,7 +509,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
478 } 509 }
479 } 510 }
480 511
481 HandleScriptsAction(cmdparams, HandleShowScript); 512 HandleScriptsAction<long>(cmdparams, HandleShowScript, si => si.EventsProcessed);
482 } 513 }
483 514
484 private void HandleShowScript(IScriptInstance instance) 515 private void HandleShowScript(IScriptInstance instance)
@@ -508,10 +539,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
508 539
509 sb.AppendFormat("Script name : {0}\n", instance.ScriptName); 540 sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
510 sb.AppendFormat("Status : {0}\n", status); 541 sb.AppendFormat("Status : {0}\n", status);
511 542 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
512 lock (eq) 543 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed);
513 sb.AppendFormat("Queued events : {0}\n", eq.Count);
514
515 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); 544 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
516 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); 545 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
517 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); 546 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
@@ -1018,8 +1047,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1018 1047
1019 string assembly = ""; 1048 string assembly = "";
1020 1049
1021 CultureInfo USCulture = new CultureInfo("en-US"); 1050 Culture.SetCurrentCulture();
1022 Thread.CurrentThread.CurrentCulture = USCulture;
1023 1051
1024 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 1052 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
1025 1053
@@ -1415,8 +1443,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1415 /// <returns></returns> 1443 /// <returns></returns>
1416 private object ProcessEventHandler(object parms) 1444 private object ProcessEventHandler(object parms)
1417 { 1445 {
1418 CultureInfo USCulture = new CultureInfo("en-US"); 1446 Culture.SetCurrentCulture();
1419 Thread.CurrentThread.CurrentCulture = USCulture;
1420 1447
1421 IScriptInstance instance = (ScriptInstance) parms; 1448 IScriptInstance instance = (ScriptInstance) parms;
1422 1449