If SmartThreadPool is active, display statistical information about it in "show stats server"

Also puts these and previous builtin threadpool stats in the "threadpool" stat container rather than "processor"
cpu-performance
Justin Clark-Casey (justincc) 2013-06-18 00:10:21 +01:00
parent b7c9dee033
commit a1e32b8437
1 changed files with 13 additions and 2 deletions

View File

@ -49,6 +49,7 @@ namespace OpenSim.Framework.Monitoring
public readonly string CategoryServer = "server"; public readonly string CategoryServer = "server";
public readonly string ContainerThreadpool = "threadpool";
public readonly string ContainerProcessor = "processor"; public readonly string ContainerProcessor = "processor";
public readonly string ContainerMemory = "memory"; public readonly string ContainerMemory = "memory";
public readonly string ContainerNetwork = "network"; public readonly string ContainerNetwork = "network";
@ -157,7 +158,7 @@ namespace OpenSim.Framework.Monitoring
m_log.ErrorFormat("{0} Exception creating 'Process': {1}", LogHeader, e); m_log.ErrorFormat("{0} Exception creating 'Process': {1}", LogHeader, e);
} }
MakeStat("BuiltinThreadpoolWorkerThreadsAvailable", null, "threads", ContainerProcessor, MakeStat("BuiltinThreadpoolWorkerThreadsAvailable", null, "threads", ContainerThreadpool,
s => s =>
{ {
int workerThreads, iocpThreads; int workerThreads, iocpThreads;
@ -165,7 +166,7 @@ namespace OpenSim.Framework.Monitoring
s.Value = workerThreads; s.Value = workerThreads;
}); });
MakeStat("BuiltinThreadpoolIOCPThreadsAvailable", null, "threads", ContainerProcessor, MakeStat("BuiltinThreadpoolIOCPThreadsAvailable", null, "threads", ContainerThreadpool,
s => s =>
{ {
int workerThreads, iocpThreads; int workerThreads, iocpThreads;
@ -173,6 +174,16 @@ namespace OpenSim.Framework.Monitoring
s.Value = iocpThreads; s.Value = iocpThreads;
}); });
if (Util.FireAndForgetMethod != null && Util.GetSmartThreadPoolInfo() != null)
{
MakeStat("STPMaxThreads", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().MaxThreads);
MakeStat("STPMinThreads", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().MinThreads);
MakeStat("STPConcurrency", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().MaxConcurrentWorkItems);
MakeStat("STPActiveThreads", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().ActiveThreads);
MakeStat("STPInUseThreads", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().InUseThreads);
MakeStat("STPWorkItemsWaiting", null, "threads", ContainerThreadpool, s => s.Value = Util.GetSmartThreadPoolInfo().WaitingCallbacks);
}
try try
{ {
List<string> okInterfaceTypes = new List<string>(NetworkInterfaceTypes.Split(',')); List<string> okInterfaceTypes = new List<string>(NetworkInterfaceTypes.Split(','));