Wednesday, March 13, 2013

Get the running processes

using System.Diagnostics;
...
...
Process[] processlist = Process.GetProcesses();
foreach(Process theprocess in processlist)
{
 Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
}
//properties of the Process object
p.StartTime   (Shows the time the process started)
p.TotalProcessorTime  (Shows the amount of CPU time the process has taken)
p.Threads   (gives access to the collection of threads in the process)

No comments:

Post a Comment