I Need To Make A Change With My IT Support! Call (225) 706-8414

Track CPU usage by a process or Windows Service

You want to monitor a process for CPU consumption, usually because you suspect the process is causing issues. Quite often, this process is a Windows Service.


There is no standard top.exe for Windows like there is for Linux/UNIX, so this is a little more complicated on Windows.

One solution is to use perfmon.exe to create a Counter Log for the monitored process and to save the perfmon log to a CSV. The CSV can then be monitored. As an example, let’s monitor a process named test.exe.

  1. Click on Start, Run, and enter “perfmon”
  2. Click on Performance Logs and Alerts
  3. Click on Counter Logs
  4. Right-click Counter Logs
  5. Click New Log Settings
  6. Enter a log name that makes sense, e.g., Monitor Test.exe CPU
  7. The Counter Log configuration dialog opens
  8. On the General tabl, click Add Counters..
  9. Click “Use local computer counters”
  10. Choose Process for Performance Object
  11. Select % Processor Time for Select counters from list
  12. Select Test from Select instances from list
  13. Click Add
  14. Click Close
  15. For Interval, choose something logical, such as 15 minutes
  16. Click the Log Files tab
  17. Choose a Log File Type of “Text File (Command delimited)”
  18. Choose the file destination directory in Location
  19. Click Ok
  20. Determine whether (and how) you want the log file to rotate with “End file names with..”
  21. Click Ok

You now have a CSV that will contain the date and CPU% for the process. An example entry:

“(PDH-CSV 4.0) (Central Standard Time)(360)”,”\LOCALHOSTProcess(test)% Processor Time”
“03/07/2011 13:13:55.759″,” ”
“03/07/2011 13:28:56.023″,”0.034716878723686867”

To get a running average of CPU%, you would run to average out the usage for a given period of time. An easier solution would be to average a certain number of rows at the end, e.g., find the sum of the last 4 rows of the CSV and divide by 4 to get the average over an hour (assuming perfmon polls the CPU once every 15 minutes).



Concerned About Cyber Attacks?


Want to Migrate to the Cloud?

Office 365

Ready to Experience Microsoft Office 365?

Want the latest IT news directly in your inbox? Subscribe now!