aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-15 21:49:13 +0000
committerJustin Clark-Casey (justincc)2011-11-15 21:49:13 +0000
commit7db38a351c19341e7332dc95cdab5db84ef48226 (patch)
tree01c21b0ae036d8eb2ce70e2c126d0d72fb55074f /OpenSim/Framework
parentDont' bother with a userAgentService != null check right after we've construc... (diff)
downloadopensim-SC-7db38a351c19341e7332dc95cdab5db84ef48226.zip
opensim-SC-7db38a351c19341e7332dc95cdab5db84ef48226.tar.gz
opensim-SC-7db38a351c19341e7332dc95cdab5db84ef48226.tar.bz2
opensim-SC-7db38a351c19341e7332dc95cdab5db84ef48226.tar.xz
Add number of milliseconds since last update to "show threads"
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs10
-rw-r--r--OpenSim/Framework/Watchdog.cs12
2 files changed, 18 insertions, 4 deletions
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
247 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); 247 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
248 248
249 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); 249 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
250
251 int timeNow = Util.EnvironmentTickCount();
252
250 foreach (Watchdog.ThreadWatchdogInfo twi in threads) 253 foreach (Watchdog.ThreadWatchdogInfo twi in threads)
251 { 254 {
252 Thread t = twi.Thread; 255 Thread t = twi.Thread;
253 256
254 sb.Append( 257 sb.AppendFormat(
255 "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: " 258 "ID: {0}, Name: {1}, Last Update: {2} ms ago, Pri: {3}, State: {4}",
256 + "Pri: " + t.Priority + ", State: " + t.ThreadState); 259 t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState);
260
257 sb.Append(Environment.NewLine); 261 sb.Append(Environment.NewLine);
258 } 262 }
259 263
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs
index 8e82f5a..0ee0c5b 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Watchdog.cs
@@ -48,6 +48,15 @@ namespace OpenSim.Framework
48 public class ThreadWatchdogInfo 48 public class ThreadWatchdogInfo
49 { 49 {
50 public Thread Thread { get; private set; } 50 public Thread Thread { get; private set; }
51
52 /// <summary>
53 /// Approximate tick when this thread was started.
54 /// </summary>
55 public int StartTick { get; private set; }
56
57 /// <summary>
58 /// Last time this heartbeat update was invoked
59 /// </summary>
51 public int LastTick { get; set; } 60 public int LastTick { get; set; }
52 61
53 /// <summary> 62 /// <summary>
@@ -64,7 +73,8 @@ namespace OpenSim.Framework
64 { 73 {
65 Thread = thread; 74 Thread = thread;
66 Timeout = timeout; 75 Timeout = timeout;
67 LastTick = Environment.TickCount & Int32.MaxValue; 76 StartTick = Environment.TickCount & Int32.MaxValue;
77 LastTick = StartTick;
68 } 78 }
69 } 79 }
70 80