aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs60
1 files changed, 52 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 23531a9..084ef48 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -26,15 +26,16 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
30using System.Threading;
31using System.Collections; 29using System.Collections;
32using System.Collections.Generic; 30using System.Collections.Generic;
33using System.Diagnostics; //for [DebuggerNonUserCode] 31using System.Diagnostics; //for [DebuggerNonUserCode]
32using System.Globalization;
33using System.IO;
34using System.Reflection;
34using System.Security; 35using System.Security;
35using System.Security.Policy; 36using System.Security.Policy;
36using System.Reflection; 37using System.Text;
37using System.Globalization; 38using System.Threading;
38using System.Xml; 39using System.Xml;
39using OpenMetaverse; 40using OpenMetaverse;
40using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
@@ -341,6 +342,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
341 } 342 }
342 343
343 MainConsole.Instance.Commands.AddCommand( 344 MainConsole.Instance.Commands.AddCommand(
345 "scripts", false, "xengine status", "xengine status", "Show status information",
346 "Show status information on the script engine.",
347 HandleShowStatus);
348
349 MainConsole.Instance.Commands.AddCommand(
344 "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", 350 "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
345 "Show information on all scripts known to the script engine." 351 "Show information on all scripts known to the script engine."
346 + "If a <script-item-uuid> is given then only information on that script will be shown.", 352 + "If a <script-item-uuid> is given then only information on that script will be shown.",
@@ -386,6 +392,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
386 /// <returns>true if we're okay to proceed, false if not.</returns> 392 /// <returns>true if we're okay to proceed, false if not.</returns>
387 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action) 393 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action)
388 { 394 {
395 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
396 return;
397
389 lock (m_Scripts) 398 lock (m_Scripts)
390 { 399 {
391 string rawItemId; 400 string rawItemId;
@@ -427,8 +436,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine
427 } 436 }
428 } 437 }
429 438
439 private void HandleShowStatus(string module, string[] cmdparams)
440 {
441 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
442 return;
443
444 StringBuilder sb = new StringBuilder();
445 sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
446
447 lock (m_Scripts)
448 sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count);
449
450 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
451 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
452 sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads);
453 sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
454 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
455// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
456
457 MainConsole.Instance.OutputFormat(sb.ToString());
458 }
459
430 public void HandleShowScripts(string module, string[] cmdparams) 460 public void HandleShowScripts(string module, string[] cmdparams)
431 { 461 {
462 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
463 return;
464
432 if (cmdparams.Length == 2) 465 if (cmdparams.Length == 2)
433 { 466 {
434 lock (m_Scripts) 467 lock (m_Scripts)
@@ -463,10 +496,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
463 status = "running"; 496 status = "running";
464 } 497 }
465 498
466 MainConsole.Instance.OutputFormat( 499 StringBuilder sb = new StringBuilder();
467 "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", 500 Queue eq = instance.EventQueue;
468 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, 501
469 sop.AbsolutePosition, status); 502 sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
503 sb.AppendFormat("Status : {0}\n", status);
504
505 lock (eq)
506 sb.AppendFormat("Queued events : {0}\n", eq.Count);
507
508 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
509 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
510 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
511 sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition);
512
513 MainConsole.Instance.OutputFormat(sb.ToString());
470 } 514 }
471 515
472 private void HandleSuspendScript(IScriptInstance instance) 516 private void HandleSuspendScript(IScriptInstance instance)