10 June 2013

View CPU Usage and Performance Data Using Windows Command Prompt



Checking your system total CPU usage and its performance is easy using the Windows Task Manager but it has its own limitation. Another way is to use the Windows Resource Monitor but if you want to view the CPU usage in real time then typeperf command will help you. This command writes performance data to the CMD or as log file. Even you can save the data as a text or an Excel file. Let see how to use typeperf command:


Step 1

Go to the Start>All Programs>Accessories>CMD or press Win + R to open the Windows Run dialog box and then type CMD. The syntax of typeperf command is


typeperf <counter [counter ...]> [options]

typeperf -cf <filename> [options]

typeperf -q [object] [options]

typeperf -qx [object] [options]


Where counter specifies performance counters to monitor.


Step 2

Type the command below; hit the Enter key to see your system CPU usage live and in real time. This syntax shows the CPU usage every second. To stop the typeperf, press Ctlr + C.





Step 3

If your system has multiprocessor, then to view each individual processor usage, use the command below where the "#" indicates the number of the processor. For example if your CPU has 2 cores then the first processor or core number would be 0 and the second one would be 1. To find all information about system CPU, you can use the CPU-Z freeware application. Again to stop the typeperf command, press Ctlr + C.





Instead of "processor(#)" in the command above, you can use "processor(*)" to view the usage of all processors together.





Step 4

To specify the time between samples, use the –si parameter. The default value is one second. Enter the command below and hit the Enter key where the "#" is the value of the time in the second.





Step 5

Use the –sc parameter to specify the number of samples to show. Without using the –sc, the typeperf command will collect samples until you press Ctrl + C.





Step 6

To save the report as a text file or an Excel file, use the command below. The parameter –o specifies the path of the output file. Use .txt extension for text file and .csv for Excel file. Instead of the Report in the command below, you can assign any name that you want.



typeperf "\Processor(_Total)\% Processor Time" -sc 20 -o c:\users\win7\desktop\Report.csv

Will create an Excel file on your desktop for 20 samples and

typeperf "\Processor(_Total)\% Processor Time" -sc 20 -o c:\users\win7\desktop\Report.txt

Will create a text file.