Process.Threads : Process « System.Diagnostics « C# / C Sharp by API






Process.Threads

 

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); 
      }
   }
}

   
  








Related examples in the same category

1.Process.CloseMainWindow
2.Process.Exited
3.Process.GetCurrentProcess()
4.Process.GetProcessById
5.Process.Kill()
6.Process.Modules
7.Process.PeakWorkingSet64
8.Process.PriorityClass
9.Process.PrivateMemorySize
10.Process.ProcessName
11.Process.StandardOutput.ReadToEnd()
12.Process.Start
13.Process.StartInfo.RedirectStandardOutput
14.Process.TotalProcessorTime
15.Process.VirtualMemorySize
16.Process.WaitForExit
17.Process.WorkingSet