Tuesday, 25 June 2019

windows - Log %CPU by Process over time


Is there any easy way on Windows to log %CPU time per process over time to a file for later analysis?


As far as I can see...



  1. Task manager shows me the %CPU per process but only visually - no way to save to a file.

  2. Perfmon will let me save to a file, and will additionally create a time-based file (taking snapshots at specified time intervals) - which is almost what I want, except that as far as I can see it can't break down the %CPU by process.

  3. Process Explorer will let me break down by process, but it will only save the file as a snapshot of a single point in time


So, none of these are quite what I need: I need to get a file that contains something like 'top 10 processes by CPU, every 15 seconds, until I stop the monitoring' The reason I need this because I have a machine on which some process is causing occasional brief spikes in CPU usage several times a day and I need to find out which process is the culprit.


Can anything do that, or have I missed some feature of perfmon or process explorer?



Answer



Process Monitor can do that for you.


You'll first might want to enable collection of profiling events:


enter image description hereenter image description here


Then, simply collect data for as long as you want (you may want to set up filters and enable Drop filtered events if you plan to collect for extended periods of time). Then go to Tools -> Process Activity Summary:


enter image description here


You'll now get a list of all active processes you recorded, with their activity over time. enter image description here


You can then open the details for a single process (by double-clicking on it) and inspect the timestamps for certain events in the graph:


enter image description here


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...