+ Reply to Thread
Results 1 to 2 of 2

Thread: Using performance counters

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    4

    Using performance counters

    Hi everyone, I have a project to capture performance counters using perfmon. Does anyone have any examples? I need counters for disk IO and Memory for the most part.

    Thanks in advance.

  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    If you want to create performance counters using command line here is an example:

    Code:
    logman create counter perf_mon -f csv -c "\Process(myprocess)\% processor time" -o c:\test\perfmon.csv -rf 0:0:40 -si 5 --v
    logman start perf_mon
    Brief description what's happening with the above command:

    logman - is a command line tool of Perfmon created by Microsoft and comes with windows.
    create counter - command to create performance counter
    perf_mon - is the data collector name/performance counter name
    -f csv - we specify that the output file will be in csv format. You can specify other formats.
    -c - is the counter we specify right after it. In the above case we are monitoring the process called "myprocess"
    -o - is the output file command. In the above case we are using path c:\test\perfmon.csv.
    -rf - Run the data collector for the specified time. In our case we are running it for 40 seconds.
    -si - Interval in seconds we will monitor the performance. In our example above it's 5 seconds.
    --v - Attach file versioning information to the log file. In our example we use this command
    but don't pass in version info so our output file will be perfmon.csv without version appended to it.


    After we create our counter we need to start it with the command start as shown above.
    The performance monitor will start and end in 40 seconds.

    If you need it to stop early or you are not using timer you can run the command below to stop performance monitoring:
    Code:
    logman stop perf_mon
    If you need to delete the perf_mon data collector set just run the command below:
    Code:
    logman delete perf_mon
    If you have more counters you want to use then it may be bette to put the counters into a text file and pass in as an argument.
    To do that you can do the following:

    1. Create a text file called counters.txt and paste these counters in the file and save it.


    "\Processor(_Total)\% processor time"
    "\Processor(_Total)\% Privileged Time"
    "\Processor(_Total)\% User Time"
    "\Process(_Total)\Private bytes"
    "\Process(_Total)\Virtual Bytes"
    "\Process(_Total)\Working Set"
    "\Process(_Total)\Handle count"
    "\Process(_Total)\thread count"
    "\Processor(_Total)\Interrupts/sec"

    "\LogicalDisk(_Total)\Disk Writes/sec"
    "\LogicalDisk(_Total)\Disk Reads/sec"
    "\LogicalDisk(_Total)\Disk Write Bytes/sec"
    "\LogicalDisk(_Total)\Disk Read Bytes/sec"
    "\LogicalDisk(_Total)\Disk Bytes/sec"
    "\LogicalDisk(_Total)\% Free Space"

    "\Process(myprocess)\% processor time"
    "\Process(myprocess)\% Privileged Time"
    "\Process(myprocess)\% user time"
    "\Process(myprocess)\Private bytes"
    "\Process(myprocess)\virtual bytes"
    "\Process(myprocess)\working set"
    "\Process(myprocess)\Handle count"
    "\Process(myprocess)\thread count"
    "\Process(myprocess)\IO Read Bytes/sec"
    "\Process(myprocess)\IO Write Bytes/sec"

    "\Memory\Available Bytes"
    "\Memory\Pool Nonpaged Bytes"
    "\Memory\Pool Paged Bytes"
    "\Memory\Pages/sec"
    "\System\Threads"
    "\System\System Up Time"

    "\Network Interface(*)\Packets/sec"
    "\Network Interface(*)\Packets Received/sec"
    "\Network Interface(*)\Packets Sent/sec"
    "\Network Interface(*)\Current Bandwidth"
    "\Network Interface(*)\Bytes Received/sec"
    "\Network Interface(*)\Bytes Sent/sec"
    "\Network Interface(*)\Bytes Total/sec"

    "\Processor(*)\% processor time"
    "\Processor(*)\% Privileged Time"
    "\Processor(*)\% User Time"
    "\Processor(*)\Interrupts/sec"
    "\LogicalDisk(*)\% Free Space"


    2. Now run the command:
    Code:
    logman create counter perf_mon -f csv -cf counters.txt -o c:\test\perfmon.csv -rf 0:1:44 -si 12 --v
    Don't forget to run logman start perf_mon after create.

    NOTE: In Vista/Windows 7 you may need to run logman in administrator mode. To do that run cmd.exe as Administrator.
    To get better usage of the tool run logman /? command.

    Hope this was helpful

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts