Home > Windows > Quick guide to typeperf for Windows performance monitoring

Quick guide to typeperf for Windows performance monitoring

The typeperf command is an underused gem in the Windows world. It is basically iostat/vmstat/sar for Windows on steroids and is available out of the box from Windows 2000 and up.

With typeperf it is possible to sample any performance counter on the local computer or by all means remotely and write it to the console or to a file at a specified rate, by default once per second. That is perfect when you want to instrument something during a performance test and keep the raw data afterwards.

To get the names of the available counters, run:


typeperf -q >counters.txt

This gets all the installed counters without instances. The same command but with -qx gets the counters with instances. An example of a counter with an instance is \Process(notepad)\% Processor Time which gets the processor time for the notepad process specifically. Without instances notepad becomes *.

To write to a file, include -o. To change the sample rate, use -si. To stop after a given number of samples, use -sc. To connect to another computer, use -s.

To check the total processor time every second:


typeperf "\Processor(_Total)\% Processor Time"

Available memory every ten seconds:


typeperf "\Memory\Available Bytes" -si 10

Pid, processor time and working set for notepad every second (no newlines):


typeperf "\Process(notepad)\ID Process"
  "\Process(notepad)\% Processor Time"
  "\Process(notepad)\Working Set"
  "\Process(notepad)\Working Set - Private"

Disk queue length every second :


typeperf "\PhysicalDisk(*)\Avg. Disk Queue Length"

This just scratches the surface. Happy monitoring!

Advertisements
Categories: Windows
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: