Link to home
Start Free TrialLog in
Avatar of Thorin
Thorin

asked on

How to monitor CPU and Memory for one process

Howdy Experts,

How can I use perfmon to monitor CPU and memory consumption for one particular process, and log it?  Just like it shows in Task Manager - but written to a log so I can average over time.  

Step by step will be appreciated.

-Thorin
Avatar of Brian Pierce
Brian Pierce
Flag of United Kingdom of Great Britain and Northern Ireland image

The only thing I can think of that comes close is Process Monitor http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
ASKER CERTIFIED SOLUTION
Avatar of ashleyknowles86
ashleyknowles86
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As per my previous comment, the "instances" list shows a list of currently running processes. Select the process you want to monitor from this list. You must select a counter first, and then select the instance.
Performane Monitor does not have the ability to log a user selected process, you can just specify just counters... in the above the actual performance object is PROCESSOR - NOT Process !
The instances list has nothing to do with processes - its how many occurances of that counter there are - so if you have two processors there will be two instances - nothing whatsoever to to with processes.
KCTS, Of course it does..

and memory usage as show in graph...
Its called the 'Working set'

What it wont do that process monitors does, it give you some transparency into registry and threads.. Its like the old filemon and regmon together, an excellent util.



perf.JPG
Perfwiz is a Performance Monitor Wizard that will take you through to setup your log:

Performance Monitor Wizard
http://www.microsoft.com/downloads/details.aspx?familyid=31fccd98-c3a1-4644-9622-faa046d69214&displaylang=en
Avatar of Thorin
Thorin

ASKER

Wow!  Thanks for all the responses.  You guys rock!

KCTS - I think I made the same mistake - note in the screen cap they have selected "Process" as the performance object, not "Processor".  You are right that if you select "Processor" it shows the number of processors in the instance list.  

ashleyknowles86/debuggerau - ok....now a detailed question or two:  The process I want to monitor is W3WP, but the server has three web apps running.  Perfmon lists them as W3WP, W3WP#1, and W3WP#2.  How do I know which is which?  Normally I would look at the PID, but that is not shown in PerfMon.  Second question - that works fine for '% Processor Time' - what about memory?  

xentelworker - thanks for the link.  I haven't downloaded yet...is this a pretty front end for PerfMon, or another tool altogether?

Thanks again to all of you....really appreciate the assistance!!!

-Thorin
Thorin,

It would be good to Monitor the Entire Process object since w3wp is a dynamic process. If you select it singally inside Perfmon, it might not capture the spanned worker process's.

If you capture all Process's, it will capture all process's that are spanned, and you can just load them up individually inside your Perfmon Log.

As for your question for PerfWiz, This is a just a wizard for Perfmon, so its not an actual App. It just "Eases" the process to make a perfmon log. The log will still reside inside Perfmon.

For your PID Question. Pop in this reg key to displays PID's of Process:

The Process object in Performance Monitor can display Process IDs (PIDs)
http://support.microsoft.com/kb/281884

Ref: http://weblogs.asp.net/owscott/archive/2007/03/19/registry-change-for-perfmon-and-pid-data.aspx


hi Thorin,
Its what I use to get a grip on process memory usage (with perfmon):

Process : Working Set. This is the current size of the memory area that the process is utilizing for code, threads, and data. The size of the working set will grow and shrink as the VMM can permit. When memory is becoming scarce the working sets of the applications will be trimmed. When memory is plentiful the working sets are allowed to grow. Larger working sets mean more code and data in memory making the overall performance of the applications increase. However, a large working set that does not shrink appropriately is usually an indication of a memory leak.
http://www.microsoft.com/technet/archive/winntas/maintain/perform.mspx?mfr=true

Another site describes it as:
You should do two things with the Memory\Available Bytes counter: create a performance log for this counter and monitor it regularly to see if any downward trend develops, and set an alert to trigger if it drops below 2% of the installed RAM. If a downward trend does develop, you can monitor Process(instance)\Working Set for each process instance to determine which process is consuming larger and larger amounts of RAM. Process(instance)\Working Set measures the size of the working set for each process, which indicates the number of allocated pages the process can address without generating a page fault. A related counter is Memory\Cache Bytes, which measures the working set for the system i.e. the number of allocated pages kernel threads can address without generating a page fault.
http://www.windowsnetworking.com/articles_tutorials/Key-Performance-Monitor-Counters.html

Avatar of Thorin

ASKER

Thanks to everyone - points go to ashleyknowles86 as he/she was first with the answer.  

Really appreciate all of the good answers and help.  

-Thorin
Hi. Does anybody know if it is possible to view cpu temperature in perfmon? I have tried to find the counter and also searched the net with no results.

Jimi