Add number of milliseconds since last update to "show threads"
parent
6b0553ed7c
commit
66863fdd34
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,15 @@ namespace OpenSim.Framework
|
|||
public class ThreadWatchdogInfo
|
||||
{
|
||||
public Thread Thread { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Approximate tick when this thread was started.
|
||||
/// </summary>
|
||||
public int StartTick { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last time this heartbeat update was invoked
|
||||
/// </summary>
|
||||
public int LastTick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -64,7 +73,8 @@ namespace OpenSim.Framework
|
|||
{
|
||||
Thread = thread;
|
||||
Timeout = timeout;
|
||||
LastTick = Environment.TickCount & Int32.MaxValue;
|
||||
StartTick = Environment.TickCount & Int32.MaxValue;
|
||||
LastTick = StartTick;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue