6.8. Viewing the Performance Statistics of a Process

Problem

You want to view the memory, I/O, and CPU statistics of a process. This is useful if you want to examine the resources a process is using. If you find that you are running low on memory on a particular system, it can often be attributed to a single process that has consumed a large amount. If you can terminate that process, the system should go back to a stable state.

Solution

Using a graphical user interface

  1. Open the Sysinternals Process Explorer tool (procexp.exe).

  2. Double-click the process you want to view.

  3. The Performance tab contains the process properties.

This information can also be viewed using Windows Task Manager (taskmgr.exe). After starting taskmgr.exe, click on the Processes tab. Select View Select Columns from the menu and check the boxes beside the properties you want to see. And for yet another way to trend out process performance metrics (using more granular metrics), open Performance Monitor and look at the Process object.

Using a command-line interface

The following command displays all of the performance metrics for a process:

> pslist -x <ProcessName>

Replace <ProcessName> with the name of the process without its extension. For example:

> pslist -x iexplore

Using VBScript

' This code displays the performance stats of a process. ' ------ SCRIPT CONFIGURATION ------ intPID = 3280 ' PID of target process strComputer = "." ' ------ END CONFIGURATION --------- WScript.Echo "Process PID: " & intPID set objWMIProcess ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.