From 72cb1cc7d6b1dc69e959581817c70e92435d002f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 3 Nov 2014 23:49:11 +0000 Subject: Add "show threadpool calls" command to show count of all labelled smartthreadpool calls --- OpenSim/Framework/Servers/ServerBase.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index fd56587..379e224 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; @@ -292,6 +293,12 @@ namespace OpenSim.Framework.Servers HandleDebugThreadpoolLevel); m_console.Commands.AddCommand( + "Debug", false, "show threadpool calls", + "show threadpool calls", + "Show the number of labelled threadpool calls.", + HandleShowThreadpoolCalls); + + m_console.Commands.AddCommand( "Debug", false, "force gc", "force gc", "Manually invoke runtime garbage collection. For debugging purposes", @@ -354,6 +361,20 @@ namespace OpenSim.Framework.Servers Notice("serialosdreq is now {0}", setSerializeOsdRequests); } + private void HandleShowThreadpoolCalls(string module, string[] args) + { + List> calls = Util.GetFireAndForgetCallsMade().ToList(); + calls.Sort((kvp1, kvp2) => kvp2.Value.CompareTo(kvp1.Value)); + + ConsoleDisplayList cdl = new ConsoleDisplayList(); + foreach (KeyValuePair kvp in calls) + { + cdl.AddRow(kvp.Key, kvp.Value); + } + + MainConsole.Instance.Output(cdl.ToString()); + } + private void HandleDebugThreadpoolStatus(string module, string[] args) { int workerThreads, iocpThreads; -- cgit v1.1