diff options
author | Justin Clark-Casey (justincc) | 2010-09-14 22:24:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-14 22:24:11 +0100 |
commit | 609375bf3723b6bd33c22dff60176b5ba8f2f81c (patch) | |
tree | 4f053869b27e75c829d70d96b377b2e955d09be5 /OpenSim/Framework/Servers | |
parent | fix OpenSim.Tests.ConfigurationLoaderTest to satisfy requirement that OpenSim... (diff) | |
download | opensim-SC-609375bf3723b6bd33c22dff60176b5ba8f2f81c.zip opensim-SC-609375bf3723b6bd33c22dff60176b5ba8f2f81c.tar.gz opensim-SC-609375bf3723b6bd33c22dff60176b5ba8f2f81c.tar.bz2 opensim-SC-609375bf3723b6bd33c22dff60176b5ba8f2f81c.tar.xz |
Fix "show threads" to show threads now being managed by OpenSim.Framework.Watchdog
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index f0f8d01..cbab2db 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -37,6 +37,7 @@ using log4net; | |||
37 | using log4net.Appender; | 37 | using log4net.Appender; |
38 | using log4net.Core; | 38 | using log4net.Core; |
39 | using log4net.Repository; | 39 | using log4net.Repository; |
40 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
@@ -234,26 +235,19 @@ namespace OpenSim.Framework.Servers | |||
234 | protected string GetThreadsReport() | 235 | protected string GetThreadsReport() |
235 | { | 236 | { |
236 | StringBuilder sb = new StringBuilder(); | 237 | StringBuilder sb = new StringBuilder(); |
238 | Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); | ||
237 | 239 | ||
238 | ProcessThreadCollection threads = ThreadTracker.GetThreads(); | 240 | sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); |
239 | if (threads == null) | 241 | foreach (Watchdog.ThreadWatchdogInfo twi in threads) |
240 | { | 242 | { |
241 | sb.Append("OpenSim thread tracking is only enabled in DEBUG mode."); | 243 | Thread t = twi.Thread; |
244 | |||
245 | sb.Append( | ||
246 | "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: " | ||
247 | + "Pri: " + t.Priority + ", State: " + t.ThreadState); | ||
248 | sb.Append(Environment.NewLine); | ||
242 | } | 249 | } |
243 | else | ||
244 | { | ||
245 | sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine); | ||
246 | foreach (ProcessThread t in threads) | ||
247 | { | ||
248 | sb.Append("ID: " + t.Id + ", TotalProcessorTime: " + t.TotalProcessorTime + ", TimeRunning: " + | ||
249 | (DateTime.Now - t.StartTime) + ", Pri: " + t.CurrentPriority + ", State: " + t.ThreadState); | ||
250 | if (t.ThreadState == System.Diagnostics.ThreadState.Wait) | ||
251 | sb.Append(", Reason: " + t.WaitReason + Environment.NewLine); | ||
252 | else | ||
253 | sb.Append(Environment.NewLine); | ||
254 | 250 | ||
255 | } | ||
256 | } | ||
257 | int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; | 251 | int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; |
258 | ThreadPool.GetAvailableThreads(out workers, out ports); | 252 | ThreadPool.GetAvailableThreads(out workers, out ports); |
259 | ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts); | 253 | ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts); |