diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-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 c9bbf0e..f11987e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -26,14 +26,15 @@ | |||
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; |
31 | using System.Globalization; | ||
32 | using System.IO; | ||
33 | using System.Reflection; | ||
33 | using System.Security; | 34 | using System.Security; |
34 | using System.Security.Policy; | 35 | using System.Security.Policy; |
35 | using System.Reflection; | 36 | using System.Text; |
36 | using System.Globalization; | 37 | using System.Threading; |
37 | using System.Xml; | 38 | using System.Xml; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
@@ -273,6 +274,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
273 | } | 274 | } |
274 | 275 | ||
275 | MainConsole.Instance.Commands.AddCommand( | 276 | MainConsole.Instance.Commands.AddCommand( |
277 | "scripts", false, "xengine status", "xengine status", "Show status information", | ||
278 | "Show status information on the script engine.", | ||
279 | HandleShowStatus); | ||
280 | |||
281 | MainConsole.Instance.Commands.AddCommand( | ||
276 | "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", | 282 | "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", |
277 | "Show information on all scripts known to the script engine." | 283 | "Show information on all scripts known to the script engine." |
278 | + "If a <script-item-uuid> is given then only information on that script will be shown.", | 284 | + "If a <script-item-uuid> is given then only information on that script will be shown.", |
@@ -318,6 +324,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
318 | /// <returns>true if we're okay to proceed, false if not.</returns> | 324 | /// <returns>true if we're okay to proceed, false if not.</returns> |
319 | private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action) | 325 | private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action) |
320 | { | 326 | { |
327 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) | ||
328 | return; | ||
329 | |||
321 | lock (m_Scripts) | 330 | lock (m_Scripts) |
322 | { | 331 | { |
323 | string rawItemId; | 332 | string rawItemId; |
@@ -359,8 +368,32 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
359 | } | 368 | } |
360 | } | 369 | } |
361 | 370 | ||
371 | private void HandleShowStatus(string module, string[] cmdparams) | ||
372 | { | ||
373 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) | ||
374 | return; | ||
375 | |||
376 | StringBuilder sb = new StringBuilder(); | ||
377 | sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); | ||
378 | |||
379 | lock (m_Scripts) | ||
380 | sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count); | ||
381 | |||
382 | sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); | ||
383 | sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); | ||
384 | sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); | ||
385 | sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); | ||
386 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); | ||
387 | // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); | ||
388 | |||
389 | MainConsole.Instance.OutputFormat(sb.ToString()); | ||
390 | } | ||
391 | |||
362 | public void HandleShowScripts(string module, string[] cmdparams) | 392 | public void HandleShowScripts(string module, string[] cmdparams) |
363 | { | 393 | { |
394 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) | ||
395 | return; | ||
396 | |||
364 | if (cmdparams.Length == 2) | 397 | if (cmdparams.Length == 2) |
365 | { | 398 | { |
366 | lock (m_Scripts) | 399 | lock (m_Scripts) |
@@ -395,10 +428,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
395 | status = "running"; | 428 | status = "running"; |
396 | } | 429 | } |
397 | 430 | ||
398 | MainConsole.Instance.OutputFormat( | 431 | StringBuilder sb = new StringBuilder(); |
399 | "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", | 432 | Queue eq = instance.EventQueue; |
400 | instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, | 433 | |
401 | sop.AbsolutePosition, status); | 434 | sb.AppendFormat("Script name : {0}\n", instance.ScriptName); |
435 | sb.AppendFormat("Status : {0}\n", status); | ||
436 | |||
437 | lock (eq) | ||
438 | sb.AppendFormat("Queued events : {0}\n", eq.Count); | ||
439 | |||
440 | sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); | ||
441 | sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); | ||
442 | sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); | ||
443 | sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition); | ||
444 | |||
445 | MainConsole.Instance.OutputFormat(sb.ToString()); | ||
402 | } | 446 | } |
403 | 447 | ||
404 | private void HandleSuspendScript(IScriptInstance instance) | 448 | private void HandleSuspendScript(IScriptInstance instance) |