mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
"threads" command now works. I've added manual tracking of threads (only if compiled in DEBUG mode)... Its ugly and even requires a separate thread to track the treads, but it will be very valuable in debugging.
This commit is contained in:
@@ -754,15 +754,30 @@ namespace OpenSim
|
||||
break;
|
||||
|
||||
case "threads":
|
||||
m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:");
|
||||
int _tc = 0;
|
||||
//m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:");
|
||||
//int _tc = 0;
|
||||
|
||||
foreach (ProcessThread pt in Process.GetCurrentProcess().Threads)
|
||||
//foreach (ProcessThread pt in Process.GetCurrentProcess().Threads)
|
||||
//{
|
||||
// _tc++;
|
||||
// m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString());
|
||||
|
||||
//}
|
||||
List<Thread> threads = OpenSim.Framework.ThreadTracker.GetThreads();
|
||||
if (threads == null)
|
||||
{
|
||||
m_console.Notice("THREAD", "Thread tracking is only enabled in DEBUG mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
int _tc = 0;
|
||||
m_console.Notice("THREAD", threads.Count + " threads are being tracked:");
|
||||
foreach (Thread t in threads)
|
||||
{
|
||||
_tc++;
|
||||
m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString());
|
||||
|
||||
m_console.Notice("THREAD", _tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user