diff options
author | Melanie | 2012-02-01 10:08:45 +0000 |
---|---|---|
committer | Melanie | 2012-02-01 10:08:45 +0000 |
commit | 16aa00e944f73a0a8fd2bd4ae9577f5dfb210bbe (patch) | |
tree | 1ffd8f2989976713ea79bbc1017a58a8925f1793 /OpenSim/Region/ScriptEngine | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Small optimization to last commit (diff) | |
download | opensim-SC_OLD-16aa00e944f73a0a8fd2bd4ae9577f5dfb210bbe.zip opensim-SC_OLD-16aa00e944f73a0a8fd2bd4ae9577f5dfb210bbe.tar.gz opensim-SC_OLD-16aa00e944f73a0a8fd2bd4ae9577f5dfb210bbe.tar.bz2 opensim-SC_OLD-16aa00e944f73a0a8fd2bd4ae9577f5dfb210bbe.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 60 |
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 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Threading; | ||
31 | using System.Collections; | 29 | using System.Collections; |
32 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
33 | using System.Diagnostics; //for [DebuggerNonUserCode] | 31 | using System.Diagnostics; //for [DebuggerNonUserCode] |
32 | using System.Globalization; | ||
33 | using System.IO; | ||
34 | using System.Reflection; | ||
34 | using System.Security; | 35 | using System.Security; |
35 | using System.Security.Policy; | 36 | using System.Security.Policy; |
36 | using System.Reflection; | 37 | using System.Text; |
37 | using System.Globalization; | 38 | using System.Threading; |
38 | using System.Xml; | 39 | using System.Xml; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 41 | using 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) |