Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Finding all of the processes</strong></p> <p>You can do this through the Process class</p> <pre><code>using System.Diagnostics; ... var allProcesses = Process.GetProcesses(); </code></pre> <p><strong>Running Diagnostics</strong></p> <p>Can you give us some more information here? It's not clear what you want to do.</p> <p>The Process class provides a bit of information though that might help you out. It is possible to query this class for </p> <ul> <li>All threads</li> <li>Main Window Handle</li> <li>All loaded modules</li> <li>Various diagnostic information about Memory (Paged, Virtual, Working Set, etc ...)</li> <li>Basic Process Information (id, name, disk location)</li> </ul> <p><strong>EDIT</strong></p> <p>OP mentioned they want to get memory and CPU information. These properties are readily available on the Process class (returned by GetProcesses()). Below is the MSDN page that lists all of the supported properties. There are various memory and CPU ones available that will suite your needs.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx</a></p> <p><strong>Code:</strong></p> <p>Add this line to your using list:</p> <pre><code>using System.Diagnostics; </code></pre> <p>Now you can get a list of the processes with the Process.GetProcesses() method, as seen in this example:</p> <pre><code>Process[] processlist = Process.GetProcesses(); foreach (Process theprocess in processlist) { Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload