From 437de6743c98b9ab217ac56ca6646883ca44c240 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Feb 2012 00:07:06 +0000 Subject: Implement "xengine status" console command to show various xengine stats --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 32 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c9bbf0e..c9fb722 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -26,14 +26,15 @@ */ using System; -using System.IO; -using System.Threading; using System.Collections; using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Reflection; using System.Security; using System.Security.Policy; -using System.Reflection; -using System.Globalization; +using System.Text; +using System.Threading; using System.Xml; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -273,6 +274,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine } MainConsole.Instance.Commands.AddCommand( + "scripts", false, "xengine status", "xengine status", "Show status information", + "Show status information on the script engine.", + HandleShowStatus); + + MainConsole.Instance.Commands.AddCommand( "scripts", false, "scripts show", "scripts show []", "Show script information", "Show information on all scripts known to the script engine." + "If a is given then only information on that script will be shown.", @@ -359,6 +365,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } + private void HandleShowStatus(string module, string[] cmdparams) + { + StringBuilder sb = new StringBuilder(); + sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); + + lock (m_Scripts) + sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count); + + sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); + sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); + sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); + sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); + sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); +// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); + + MainConsole.Instance.OutputFormat(sb.ToString()); + } + public void HandleShowScripts(string module, string[] cmdparams) { if (cmdparams.Length == 2) -- cgit v1.1