email

Wednesday, May 20, 2009

Collect performance data from command prompt

While browsing for something, I came across this nice windows built-in tool called, "typeperf". This tool redirects the output of performance counter values to command prompt. The normal way for collecting performance values is to open perfmon and configure the options trough GUI to capture the output into some CSV or other file. But this command line tool is very handly to have the counter results from command line.

If some one asked me to monitor the CPU utilization of remote system, I will simply issue below command in my command prompt(ofcourse I need admin rights on remote machine or the account I am using should be member of permon related groups if the remote machine is of a server OS). This command has most of the options that you can set using perfmon.

c:\> typeperf "\\RemoteMachine\processor(_Total)\% Processor Time"

"(PDH-CSV 4.0)","\\RemoteMachine\processor(_Total)\% Processor Time"
"05/20/2009 20:55:11.402","37.682755"
"05/20/2009 20:55:12.465","12.502240"
"05/20/2009 20:55:13.465","33.825223"
"05/20/2009 20:55:14.559","36.987914"
"05/20/2009 20:55:15.668","21.877000"
"05/20/2009 20:55:16.668","3.127480"
"05/20/2009 20:55:17.668","9.377320"
"05/20/2009 20:55:18.668","6.252400"
"05/20/2009 20:55:19.668","10.939780"


Below is the command help and I know you can build your custom command using this. Let me know if you need any help.

Refer this link for syntax and to have more examples. You can type
"typeperf /?" at command prompt to get help on this command.

I WELCOME YOUR COMMENTS;THAT MAKES ME PERFECT:-)

Happy learning..,
Sitaram Pamarthi.

4 comments:

  1. Hi,

    Your post was useful. Thank you.

    I would like to know if there is a way to list per-process resource usage or if not list just get resource utilization for a process (identified by name or pid)?

    ReplyDelete
  2. Well, you can do that.

    If you are familiar with powershell try this..

    Get-Process -id pid | select $_.cpu displays the CPU utilization. Similarly it has other properties related to resource utilization.

    ReplyDelete
  3. Great post Sitaram, I can't believe I didn't know about this before.

    Happy learning indeed.

    ReplyDelete
  4. Thanks Tom.

    You can follow my latest articles in my new blog(http://techibee.com) to which I switched a year back.

    ReplyDelete