Two Minute Drill: TYPEPERF

Hello again AskPerf! Blake Morrison here to discuss a little known OS tool called TYPEPERF.  TYPEPERF is a built-in tool that writes performance data to the command window or to a log file.  If you are a command line junkie, love to script, and need to get Performance data from your Workstation or Server, then TYPEPERF is the tool for you.  Let’s check out its options and some examples.  When you type “typeperf /?” at a command prompt, the following appears:

C:\>typeperf /?
Microsoft r TypePerf.exe (6.0.6000.16386)
Typeperf writes performance data to the command window or to a log file. To
stop Typeperf, press CTRL+C.

typeperf { <counter [counter …]> | -cf <filename> | -q [object]
| -qx [object] } [options]
<counter [counter …]> Performance counters to monitor.

-? Displays context sensitive help.
-f <CSV|TSV|BIN|SQL> Output file format. Default is CSV.
-cf <filename> File containing performance counters to
monitor, one per line.
-si <[[hh:]mm:]ss> Time between samples. Default is 1 second.
-o <filename> Path of output file or SQL database. Default
-q [object] List installed counters (no instances). To
list counters for one object, include the
object name, such as Processor.
-qx [object] List installed counters with instances. To
list counters for one object, include the
object name, such as Processor.
-sc <samples> Number of samples to collect. Default is to
sample until CTRL+C.
-config <filename> Settings file containing command options.
-s <computer_name> Server to monitor if no server is specified
in the counter path.
-y Answer yes to all questions without prompting.
Counter is the full name of a performance counter in “\\<Computer>\<Object>(<Instance>)\<Counter>” format,
such as “\\Server1\Processor(0)\% User Time”.

Here are some quick examples:

Check your Total CPU usage every second:
C:\>typeperf “\processor(_Total)\% Processor Time”

“(PDH-CSV 4.0)”,“\\2K8SRV\processor(_Total)\% Processor Time”
“04/13/2009 09:50:04.359”,“2.509119”
“04/13/2009 09:50:05.360”,“0.754295”
“04/13/2009 09:50:06.360”,“2.899090”
“04/13/2009 09:50:07.360”,“1.534207”
“04/13/2009 09:50:08.360”,“0.559314”
“04/13/2009 09:50:09.360”,“10.113409”
“04/13/2009 09:50:10.360”,“10.113409”
“04/13/2009 09:50:11.360”,“3.094071”
“04/13/2009 09:50:12.360”,“0.559314”

The command completed successfully.

Check your available memory in bytes every 5 seconds:
C:\>typeperf “\memory\Available Bytes” -si 5

“(PDH-CSV 4.0)”,“\\2K8SRV\memory\Available Bytes”
“04/13/2009 09:56:30.818”,“12821381120.000000”
“04/13/2009 09:56:35.819”,“12821602304.000000”
“04/13/2009 09:56:40.819”,“12821659648.000000”
“04/13/2009 09:56:45.820”,“12821610496.000000”
“04/13/2009 09:56:50.820”,“12821794816.000000”

The command completed successfully.

Grab 5 samples of pagefile total usage on a remote system every 10 seconds:
C:\>typeperf “\\REMOTESRV\paging file(_Total)\% Usage” -sc 5 -si 10

“(PDH-CSV 4.0)”,“\\REMOTESRV\paging file(_Total)\% Usage”
“04/13/2009 10:01:12.004”,“1.770573”
“04/13/2009 10:01:22.007”,“1.770573”
“04/13/2009 10:01:32.009”,“1.770573”
“04/13/2009 10:01:42.011”,“1.770573”
“04/13/2009 10:01:52.013”,“1.770573”

The command completed successfully.

As you can see, this tool is quite powerful.  In terms of scenarios in which you might use this tool, consider a situation where you need to gather a limited set of performance data from 500 servers at 3:00 am when the backup job kicks off.  Using TYPEPERF, you can configure this in just a few minutes via batch files and scripts.  Don’t forget that you need to either use the –sc switch to limit the number of samples or use CTRL+C within the command window.  The links below have more information and examples.  Take care!

Additional Resources:

– Blake Morrison

Share this post :