From 29eb3b2eb57a43e9959486fb371d81a60ccab921 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 22:51:12 +0000 Subject: improve formatting of "show threads" --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 65d4d32..41a0e4e 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -243,6 +243,9 @@ namespace OpenSim.Framework.Servers /// protected string GetThreadsReport() { + // This should be a constant field. + string reportFormat = "{0,6} {1,35} {2,16} {3,10} {4,30}"; + StringBuilder sb = new StringBuilder(); Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); @@ -250,12 +253,16 @@ namespace OpenSim.Framework.Servers int timeNow = Util.EnvironmentTickCount(); + sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "PRIORITY", "STATE"); + sb.Append(Environment.NewLine); + foreach (Watchdog.ThreadWatchdogInfo twi in threads) { Thread t = twi.Thread; sb.AppendFormat( - "ID: {0}, Name: {1}, Last Update: {2} ms ago, Pri: {3}, State: {4}", + reportFormat, + //t.ManagedThreadId, t.Name, string.Format("{0} ms", timeNow - twi.LastTick), t.Priority, t.ThreadState); t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); sb.Append(Environment.NewLine); -- cgit v1.1