From 6e8f80f1ab933bbd00b892fa6d01f93f62a1bbbd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Mar 2012 03:26:47 +0000 Subject: Improve threadpool reporting to "show threads" console command (also gets printed out periodically) --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d5c2515..5c74ac9 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -272,12 +272,8 @@ namespace OpenSim.Framework.Servers sb.Append(Environment.NewLine); } - int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; - ThreadPool.GetAvailableThreads(out workers, out ports); - ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts); - - sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine); - sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine); + sb.Append("\n*** Main threadpool (excluding script engine)***\n"); + sb.Append(Util.GetThreadPoolReport()); return sb.ToString(); } -- cgit v1.1 From bece2023e754d3d2c09753ad853f68c84243505c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Mar 2012 03:52:13 +0000 Subject: Add total scripts count to "show threads" However, this returns 0 on Mono (at least on 2.6.7)! So not showing if it is zero. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 5c74ac9..6da1436 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -269,10 +269,18 @@ namespace OpenSim.Framework.Servers t.Priority, t.ThreadState); - sb.Append(Environment.NewLine); + sb.Append("\n"); } - sb.Append("\n*** Main threadpool (excluding script engine)***\n"); + sb.Append("\n"); + + // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting + // zero active threads. + int totalThreads = Process.GetCurrentProcess().Threads.Count; + if (totalThreads > 0) + sb.AppendFormat("Total threads active: {0}\n\n", Process.GetCurrentProcess().Threads.Count); + + sb.Append("Main threadpool (excluding script engine pools)\n"); sb.Append(Util.GetThreadPoolReport()); return sb.ToString(); -- cgit v1.1 From 59b6f6a6e03417360d9ea94b8e9cabc8569ffe89 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Mar 2012 03:56:56 +0000 Subject: minor: reuse threadpool count we just fetched instead of fetching it again --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 6da1436..06a8021 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -278,7 +278,7 @@ namespace OpenSim.Framework.Servers // zero active threads. int totalThreads = Process.GetCurrentProcess().Threads.Count; if (totalThreads > 0) - sb.AppendFormat("Total threads active: {0}\n\n", Process.GetCurrentProcess().Threads.Count); + sb.AppendFormat("Total threads active: {0}\n\n", totalThreads); sb.Append("Main threadpool (excluding script engine pools)\n"); sb.Append(Util.GetThreadPoolReport()); -- cgit v1.1