Listing information of backgroud process
-
Hi all, In c# application how can i list the complete detailed information of running background process of a system. Thanks in advance.
You can find the complete list with,
Process.GetProcesses();
and then pick the properties of all process such as,ProcessName ID TotalProcessorTime StartTime etc
Please check spellings for all properties above. Read the documentation about the Process as well. After that actually it's matter of control/use/display them as you wish.I appreciate your help all the time... CodingLover :)
-
Hi all, In c# application how can i list the complete detailed information of running background process of a system. Thanks in advance.
Hi.. try this code.. :)
using System;
using System.Diagnostics;class MainClass
{
public static void Main()
{
Process[] allProcs = Process.GetProcesses();foreach(Process proc in allProcs) { ProcessThreadCollection myThreads = proc.Threads; Console.WriteLine("process: {0}, id: {1}", proc.ProcessName, proc.Id); foreach(ProcessThread pt in myThreads) { Console.WriteLine(" thread: {0}", pt.Id); Console.WriteLine(" started: {0}", pt.StartTime.ToString()); Console.WriteLine(" CPU time: {0}", pt.TotalProcessorTime); Console.WriteLine(" priority: {0}", pt.BasePriority); Console.WriteLine(" thread state: {0}", pt.ThreadState.ToString()); } }
}
}-ambarish-