"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:
Tedd Hansen
2008-02-21 10:43:24 +00:00
parent 4a621d106c
commit 7102ac7769
16 changed files with 149 additions and 7 deletions

View File

@@ -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;