using System;
using System.Diagnostics;
class MainClass
{
public static void Main()
{
Process thisProc = Process.GetCurrentProcess();
ProcessThreadCollection myThreads = thisProc.Threads;
foreach(ProcessThread pt in myThreads)
{
Console.WriteLine("thread: {0}", pt.Id);
Console.WriteLine(" started: {0}", pt.StartTime);
Console.WriteLine(" CPU time: {0}", pt.TotalProcessorTime);
Console.WriteLine(" priority: {0}", pt.BasePriority);
Console.WriteLine(" thread state: {0}", pt.ThreadState);
}
}
}
thread: 4064
started: 25/03/2007 2:25:08 PM
CPU time: 00:00:00.0312500
priority: 8
thread state: Running
thread: 440
started: 25/03/2007 2:25:08 PM
CPU time: 00:00:00
priority: 8
thread state: Wait
thread: 2444
started: 25/03/2007 2:25:08 PM
CPU time: 00:00:00
priority: 10
thread state: Wait