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
Windows Server 2003

Avatar of undefined
Last Comment
JimiSweden

8/22/2022 - Mon
Brian Pierce

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
ashleyknowles86

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ashleyknowles86

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.
Brian Pierce

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 !
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Brian Pierce

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.
debuggerau

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
xentelworker

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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Thorin

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
xentelworker

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


debuggerau

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

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
Thorin

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
JimiSweden

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