Add "show threadpool calls" command to show count of all labelled smartthreadpool calls

This commit is contained in:
Justin Clark-Casey (justincc)
2014-11-03 23:49:11 +00:00
parent 8c9f82b035
commit 72cb1cc7d6
3 changed files with 37 additions and 1 deletions

View File

@@ -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;
@@ -291,6 +292,12 @@ namespace OpenSim.Framework.Servers
+ " 3 = full stack trace, including common threads\n",
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",
@@ -354,6 +361,20 @@ namespace OpenSim.Framework.Servers
Notice("serialosdreq is now {0}", setSerializeOsdRequests);
}
private void HandleShowThreadpoolCalls(string module, string[] args)
{
List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsMade().ToList();
calls.Sort((kvp1, kvp2) => kvp2.Value.CompareTo(kvp1.Value));
ConsoleDisplayList cdl = new ConsoleDisplayList();
foreach (KeyValuePair<string, int> kvp in calls)
{
cdl.AddRow(kvp.Key, kvp.Value);
}
MainConsole.Instance.Output(cdl.ToString());
}
private void HandleDebugThreadpoolStatus(string module, string[] args)
{
int workerThreads, iocpThreads;