Implement "xengine status" console command to show various xengine stats

iar_mods
Justin Clark-Casey (justincc) 2012-02-01 00:07:06 +00:00
parent f028dca711
commit 437de6743c
1 changed files with 28 additions and 4 deletions

View File

@ -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;
@ -272,6 +273,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
OnObjectRemoved += m_XmlRpcRouter.ObjectRemoved;
}
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 [<script-item-uuid>]", "Show script information",
"Show information on all scripts known to the script engine."
@ -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)