The Processes screen of Windows Task Manager lists currently running processes on the local computer. The few columns shown by default allow you to quickly identify the processes that consume the most CPU time or memory. You can also add more columns by going to View | Select Columns. But Task Manager has some limitations. It can't show processes running on a remote machine, and neither "Mem Usage" nor "VM Size" are useful counters when a process approaches its virtual memory limit.
My little pstats for Windows program is a simple-to-use process monitoring tool that provides Task Manager "Process list"-like screen even for a remote computer. Since it's written in clear-text VBScript, you can easily add more performance metrics to the code. If you need to identify handle-leaking processes, for instance, just add HandleCount to the code. The following is a screenshot showing only the top four processes. I included all I/O related metrics because I'm always interested in disk I/O (Note: those metrics also lump device and network I/O together).
Process Stats on localhost at 8/19/2004 5:13:16 PM
|Click column header once to sort locally. Press F5 to refresh from localhost. More help|
Download pstats to a file named pstats.hta. When you use Internet Explorer to access that URL, if you're prompted to Enter computer name instead of prompted to Save file, just Cancel and View Source. Then save the source file to your local disk. If you clicked OK, you would get an ActiveX can't create object error. Ignore it and View Source and save the source. You're also encouraged to save this file you're reading, since it has the pstats Help section below. Run the program by launching it from the folder where you saved the pstats.hta file.
How does pstats work? Performance data is collected by WMI (Windows Management Instrumentation). So make sure the target computer has not had this service disabled or stopped. Pstats fetches this data through the Win32_PerfRawData_PerfProc_Process class. The program is written as an HTA (hypertext application) in VBScript. Data is temporarily stored in a comma-delimited file pstats_targetcomputer.csv and pstats uses TDC (tabular data control) to sort them.
See MSDN Reference for official interpretation of the WMI class Win32_PerfRawData_PerfProc_Process, on which this program is based. I must point out that after I finished this program, I discovered that the statistics are actually cumulative, in spite of the phrase "PerSec" in the I/O stat names. (See my message posted to the Microsoft official newsgroup without an answer.) In order to find the instantaneous CPU or I/O intensive processes, I would need to calculate the differential stats divided by time interval between two consecutive samplings. But currently pstats can at least answer the question such as "Which process uses the most memory?", or "Which process has used the most total CPU time and consumed the most I/O over its lifetime?" (2012 Update Actually, my topio program does exactly that.)
|PPsr||Percent of cumulative processor time used by this process (sum of PPrv and PUsr)|
|PPrv||Percent of cumulative privileged (i.e. system or kernel) CPU time used by this process|
|PUsr||Percent of cumulative user CPU time (doing real work) used by this process|
|VM||Virtual memory size in bytes, including shared memory, equivalent to Perfmon "Virtual Bytes" counter and can be used to check process virtual memory usage (sample question: Is my java.exe approaching its -mx1024m limit now?). Note that this is not the same as "VM Size" in Task Manager, which shows private memory only, and not as Task Manager "Mem Usage" either (see below).|
|WS||working set size in bytes (equivalent to "Mem Usage" in Task Manager)|
|RdBtsPS||Number of bytes read (supposedly but not per second)|
|RdOpsPS||Number of reads (supposedly but not per second)|
|WrBtsPS||Number of bytes written (supposedly but not per second)|
|WrOpsPS||Number of writes (supposedly but not per second)|
|OtBtsPS||Number of bytes performed by control operations (supposedly but not per second)|
|OtOpsPS||Number of I/O control operations (supposedly but not per second)|
By default, sorting is done on PPsr. You can change it by changing the line
<PARAM NAME='SortColumn' VALUE='-PPsr'>in the OBJECT block of the code. When clicking the column header to sort, the sorting direction is hardcoded: all columns will be sorted in descending order except for Name (the only string type), which sorts in ascending order. You can modify the source code to change the sort direction by changing the + or - sign in front of the column name in the function, such as
function PPsr_onclick() pstats.Sort = "-PPsr"
To make the program automatically refresh and fetch new data instead of manually pressing F5, uncomment the META tag near the top. This line
<meta http-equiv="refresh" content="5">will refresh the stats every 5 seconds.
To save a snapshot of the performance data, select all text (^A) and copy (^C) in the pstats window. You cannot View Source and save the source to a file. Alternatively, just look at pstats_computer.csv created on the fly in the current folder.
To my Computer Page