Add monitored thread last update times as stats in "show stats all"
These have the format server.thread.<thread-name>0.8.0.3
parent
33ae733006
commit
47e7febebc
|
@ -82,12 +82,32 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<string> AlarmMethod { get; set; }
|
public Func<string> AlarmMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stat structure associated with this thread.
|
||||||
|
/// </summary>
|
||||||
|
public Stat Stat { get; set; }
|
||||||
|
|
||||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
public ThreadWatchdogInfo(Thread thread, int timeout)
|
||||||
{
|
{
|
||||||
Thread = thread;
|
Thread = thread;
|
||||||
Timeout = timeout;
|
Timeout = timeout;
|
||||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||||
LastTick = FirstTick;
|
LastTick = FirstTick;
|
||||||
|
|
||||||
|
Stat
|
||||||
|
= new Stat(
|
||||||
|
thread.Name,
|
||||||
|
string.Format("Last update of thread {0}", thread.Name),
|
||||||
|
"",
|
||||||
|
"ms",
|
||||||
|
"server",
|
||||||
|
"thread",
|
||||||
|
StatType.Pull,
|
||||||
|
MeasuresOfInterest.None,
|
||||||
|
stat => stat.Value = Environment.TickCount & Int32.MaxValue - LastTick,
|
||||||
|
StatVerbosity.Debug);
|
||||||
|
|
||||||
|
StatsManager.RegisterStat(Stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
||||||
|
@ -100,6 +120,11 @@ namespace OpenSim.Framework.Monitoring
|
||||||
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
||||||
AlarmMethod = previousTwi.AlarmMethod;
|
AlarmMethod = previousTwi.AlarmMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Cleanup()
|
||||||
|
{
|
||||||
|
StatsManager.DeregisterStat(Stat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -238,6 +263,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
"[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||||
|
|
||||||
|
twi.Cleanup();
|
||||||
m_threads.Remove(threadID);
|
m_threads.Remove(threadID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue