Add "show threadpool calls" command to show count of all labelled smartthreadpool calls
parent
965c53ebd7
commit
d3a550bc85
|
@ -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;
|
||||
|
|
|
@ -2086,14 +2086,28 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, int> GetFireAndForgetCallsMade()
|
||||
{
|
||||
return new Dictionary<string, int>(m_fireAndForgetCallsMade);
|
||||
}
|
||||
|
||||
private static Dictionary<string, int> m_fireAndForgetCallsMade = new Dictionary<string, int>();
|
||||
|
||||
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
|
||||
{
|
||||
FireAndForget(callback, obj, null);
|
||||
}
|
||||
|
||||
|
||||
public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context)
|
||||
{
|
||||
if (context != null)
|
||||
{
|
||||
if (!m_fireAndForgetCallsMade.ContainsKey(context))
|
||||
m_fireAndForgetCallsMade[context] = 1;
|
||||
else
|
||||
m_fireAndForgetCallsMade[context]++;
|
||||
}
|
||||
|
||||
WaitCallback realCallback;
|
||||
|
||||
bool loggingEnabled = LogThreadPool > 0;
|
||||
|
|
|
@ -390,6 +390,7 @@
|
|||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
|
|
Loading…
Reference in New Issue