Add "show threadpool calls" command to show count of all labelled smartthreadpool calls
parent
8c9f82b035
commit
72cb1cc7d6
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
@ -291,6 +292,12 @@ namespace OpenSim.Framework.Servers
|
||||||
+ " 3 = full stack trace, including common threads\n",
|
+ " 3 = full stack trace, including common threads\n",
|
||||||
HandleDebugThreadpoolLevel);
|
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(
|
m_console.Commands.AddCommand(
|
||||||
"Debug", false, "force gc",
|
"Debug", false, "force gc",
|
||||||
"force gc",
|
"force gc",
|
||||||
|
@ -354,6 +361,20 @@ namespace OpenSim.Framework.Servers
|
||||||
Notice("serialosdreq is now {0}", setSerializeOsdRequests);
|
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)
|
private void HandleDebugThreadpoolStatus(string module, string[] args)
|
||||||
{
|
{
|
||||||
int workerThreads, iocpThreads;
|
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)
|
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
|
||||||
{
|
{
|
||||||
FireAndForget(callback, obj, null);
|
FireAndForget(callback, obj, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context)
|
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;
|
WaitCallback realCallback;
|
||||||
|
|
||||||
bool loggingEnabled = LogThreadPool > 0;
|
bool loggingEnabled = LogThreadPool > 0;
|
||||||
|
|
|
@ -390,6 +390,7 @@
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
|
<Reference name="System.Core"/>
|
||||||
<Reference name="System.Xml"/>
|
<Reference name="System.Xml"/>
|
||||||
<Reference name="OpenSim.Data"/>
|
<Reference name="OpenSim.Data"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
|
Loading…
Reference in New Issue