views:

9346

answers:

8

Hello, I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn't help me as it shows immediate usage only.

Is there a way (on Windows) to track the history of CPU & Memory usage for some process. E.g. I will start tracking "firefox", and after an hour or so will see a graph of its CPU & memory usage during that hour.

I'm looking for either a ready-made tool or a programmatic way to achieve this.

Thanks

A: 

Hmm, I see that Process Explorer can do it, although its graphs are not too convenient. Still looking for alternative / better ways to do it.

Eli Bendersky
+2  A: 

Perfmon.exe is built into windows.

SaaS Developer
+2  A: 

Process Explorer can show total CPU time taken by a process, as well as a history graph per process.

Niall
+4  A: 

I agree, perfmon.exe allows you to add counters (right click on the right panel) for any process you want to monitor.

Performance Object: Process Check "Select instances from list" and select firefox.

Ady Romantika
Thanks. How do I see the history of cpu usage over a pre-defined time, like an hour ?
Eli Bendersky
+2  A: 

WMI is Windows Management Instrumentation, and it's built into all recent versions of Windows. It allows you to programmatically track things like CPU usage, disk I/O, and memory usage.

Perfmon.exe is a GUI front-end to this interface, and can monitor a process, write information to a log, and allow you to analyze the log after the fact. It's not the world's most elegant program, but it does get the job done.

doflynn
Technically perfmon is an interface to the underlying Windows Performance Counter API which predates WMI by many years.WMI also exposes the performance counter API within its namespace.
Rob Walker
A: 

You might want to have a look at Process Lasso.

+5  A: 

Just type perfmon into Start > Run and press enter. When the Performance window is open, click on the + sign to add new counters to the graph. The counters are different aspects of how your PC works and are grouped by similarity into groups called "Performance Object".

For your questions, you can choose the "Process", "Memory" and "Processor" performance objects. You then can see these counters in real time

You can also specify the utility to save the performance data for your inspection later. To do this, select "Performance Logs and Alerts" in the left-hand panel. (It's right under the System Monitor console which provides us with the above mentioned counters. If it is not there, click "File" > "Add/remove snap-in", click Add and select "Performance Logs and Alerts" in the list".) From the "Performance Logs and Alerts", create a new monitoring configuration under "Counter Logs". Then you can add the counters, specify the sampling rate, the log format (binary or plain text) and log location.

Martin
A: 

Process Lasso is designed more for process automation and priority class optimization, not graphs. That said, it does offer per-process CPU utilization history (drawn as a white line on the graph) but it does NOT offer per-process memory utilization history.

DISCLAIMER: I am the author of Process Lasso, but am not actually endorsing it here - as there are better solutions (perfmon being the best).

The best thing ever is Windows Vista+ Resource and Performance Monitor. It can track usage of CPU, Memory, Network, and Disk accesses by processes over time. It is a great overall system information utility that should have been created long ago. Unless I am mistaken, it can track per-process CPU and memory utilization over time (amongst the other things listed).

Jeremy Collake