From 7db38a351c19341e7332dc95cdab5db84ef48226 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 21:49:13 +0000 Subject: Add number of milliseconds since last update to "show threads" --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 3d20080..65d4d32 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -247,13 +247,17 @@ namespace OpenSim.Framework.Servers Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); + + int timeNow = Util.EnvironmentTickCount(); + foreach (Watchdog.ThreadWatchdogInfo twi in threads) { Thread t = twi.Thread; - sb.Append( - "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: " - + "Pri: " + t.Priority + ", State: " + t.ThreadState); + sb.AppendFormat( + "ID: {0}, Name: {1}, Last Update: {2} ms ago, Pri: {3}, State: {4}", + t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); + sb.Append(Environment.NewLine); } -- cgit v1.1 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 From aea547cd11e4baa24cad12e13160e5ff2250a69f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 23:24:51 +0000 Subject: fix build break on UserManagementModule. This also adds time since started to "show threads". Unfortunately these two changes got mixed in. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 41a0e4e..db063f1 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -244,7 +244,7 @@ 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}"; + string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; StringBuilder sb = new StringBuilder(); Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); @@ -253,7 +253,7 @@ namespace OpenSim.Framework.Servers int timeNow = Util.EnvironmentTickCount(); - sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "PRIORITY", "STATE"); + sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE"); sb.Append(Environment.NewLine); foreach (Watchdog.ThreadWatchdogInfo twi in threads) @@ -262,8 +262,12 @@ namespace OpenSim.Framework.Servers sb.AppendFormat( 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); + t.ManagedThreadId, + t.Name, + timeNow - twi.LastTick, + timeNow - twi.FirstTick, + t.Priority, + t.ThreadState); sb.Append(Environment.NewLine); } -- cgit v1.1