none
Perfmon Process: % Processor Time vs. Task Manager’s CPU usage (for monitoring a specific user)

    Question

  • I'm new to using Perfmon and performance monitoring in general (so go easy on me please ;)

    I know that Perfmon doesn't have anything exactly like Task Manager's CPU usage display, but I'm trying to figure out how to monitor a user's web site CPU usage (worker process user) via Perfmon in a similar way, and trying to understand the measurements (or how to convert the numbers to get a similar understanding)

    For example, if in Task Manager, a particular user is consistently using more than 5-10% CPU, I would want to contact the user about it.

    I learn best by example, so here is exactly what I'm trying to do, with a specific example:

     

    This is on a 32-bit Dual Quad Core Windows 2003 web server (8 CPUs), there are many web sites on the server, each running within their own application pool/worker process ID.

    Through some research I learned of a registry change (which I made) so that the PID shows up with the w3wp process so I can easily identify the site later by cross-referencing it.

     

    I set up a counter with the following settings:

    Process
     
    ->
     
    %
     
    Processor
     
    Time
      
    ->
     all instances

     

    Here is an example. Let's say I'm interested in the "black line " user process in this graph below, as his process is spiking quite high compared to all the other users:

    http://i35.tinypic.com/106yn8k.jpg


    Using this as an example, I see that this worker process user has an AVERAGE % PROCESSOR TIME of 23.264 , and has spiked as high as 103.124

    So - what exactly does this 23.264 number mean to me?  Since this server has 8 CPUs, should I divide this number by 8?    (23.264/8 = 2.9% AVERAGE CPU LOAD?)

    If this is the correct way to calculate this, is this number similar to an average of Task Manager's CPU reading for this user?    (in task manager, this user shows as anywhere from 0 to 13 CPU load, but not consistently at any high number, it almost seems that 2.9% is probably about right as an average taking into account the periodic spikes)

     

    I'm just not sure if I'm calculating/understanding this counter correctly and if this would be a valid way to get a report on worker process user's using too much cpu load.

     

    Thanks in advance.

     

    Sunday, November 15, 2009 1:11 AM

All replies

  • Hi guys, I noticed that a lot of people have read this question (240+ as of this post) but there have been no attempts at answering this yet,  if anyone can comment if maybe my question was not properly phrased or confusing?

    I'll be happy to clarify my question or provide more details if needed.


    Thanks
    Thursday, November 19, 2009 5:28 PM
  • Many people confuses what they see in Task Manager on the Processes tab in CPU column with Process\% Processor Time\Instance in Perfmon.  They are NOT the same counters.   There is NO counter in PerfMon that matches what you see in Task Manager on the Processes tab in CPU column.

    Process\% Processor Time\Instance is NOT the amount of time that the CPU’s were busy.  It is the % of time that this instance charges against the Processor\% User time.


    The theoretical Max for this counter is (# of processors * 100)

    Assume the following:

    A single CPU and we are looking a single point of time

    (processor\%processor time) = 10%

    (processor\%user time) = 8%

    (processor\% privilege time) = 2%

    (process\% processor time\your application) = 80%

    You application is using 80% of the (processor\% user time) which is (8*.8)=6.4% of the CPU

    If you have multiple processors they you will need to divide the (process\% processor time\your application) by the number of processors to determine what will be charged to % user time.

    I know of no easy way to get how much CPU a process is using from perfmon.

    Taskmgr utilizes a NtQuerySystemInformation call for this value.  This is a different method then what perfmon is using.

    Cheers!
    Bruce Adamczak

    Thursday, November 19, 2009 9:08 PM
    Moderator
  • Hi Bruce, this is a great example! Although I wonder where do you get the process\ % processor time\ your application?

    Thank you.

    Monday, August 19, 2013 2:05 PM
  • perfmon > Perfromance Monitor > Add

    Then select counter, Process - there you can select both counter properties and processes.

    I answered, incase its not too late :D

    Thursday, July 9, 2015 10:14 AM
  • I have a similar question but about the "Processes" counter this time. That value (looked up with perfmon) is usually MUCH higher than the amount of processes Task Manager reports. Process Explorer also matches the counter from Task Manager, which makes it confusing for our engineers using SCOM alerts that are triggered by the perfmon counter. They simply check Task Manager (or Process Explorer) just to find out that the value does not match the SCOM alert. Why is this? Is there any way of reading the value from Task Manager / Process Explorer (using WMI)?


    Thanks!

    Tuesday, April 5, 2016 8:38 AM
  • Many people confuses what they see in Task Manager on the Processes tab in CPU column with Process\% Processor Time\Instance in Perfmon.  They are NOT the same counters.   There is NO counter in PerfMon that matches what you see in Task Manager on the Processes tab in CPU column.

    Process\% Processor Time\Instance is NOT the amount of time that the CPU’s were busy.  It is the % of time that this instance charges against the Processor\% User time.


    The theoretical Max for this counter is (# of processors * 100)

    Assume the following:

    A single CPU and we are looking a single point of time

    (processor\%processor time) = 10%

    (processor\%user time) = 8%

    (processor\% privilege time) = 2%

    (process\% processor time\your application) = 80%

    You application is using 80% of the (processor\% user time) which is (8*.8)=6.4% of the CPU

    If you have multiple processors they you will need to divide the (process\% processor time\your application) by the number of processors to determine what will be charged to % user time.

    I know of no easy way to get how much CPU a process is using from perfmon.

    Taskmgr utilizes a NtQuerySystemInformation call for this value.  This is a different method then what perfmon is using.

    Cheers!
    Bruce Adamczak

    So I know this is a really old thread, but it comes up at the top of google searches on this topic. I have some questions on this. Some of the details I see when don't add up to what you said here.

    To test I used the benchmarking tool in 7zip. I have a 8 core i7 processor, and have set the benchmarking tool to use 4 threads. I am also using Windows 7, but have seen it on newer versions also. I also tried to shut down as much as possible so that only 7zip and performance monitor was running.

    Processor Information\%User Time = ~50%
    Processor Information\% Processor Time = ~52%
    Process\%Processor Time\7zG = ~ 400

    So according to the math you had above, this should be:

    400/8 cores = 50%.
    50 *.5 = 25.
    7zg is using 50% of % user time, which is 50% of CPU. So 7zip benchmark is using 25% of the total CPU.

    But when I check Task Manager it says that 7zG is using ~50% CPU!

    Taking the Process\%Processor Time\7zG and dividing it by the number of cores seems to have a much higher correlation to what shows in Task Manager than when I do your calculation.

    So did I not understand something correctly?

    Wednesday, May 25, 2016 4:17 PM
  • Hi,

    Following my knowledge and my tests, I can say that Bruce Adamczak gives wrong maths !!

    The [Process>% Processor Time] counter is related to (nb of logical CPUs) * [Processor>% Processor Time].

    It is not related to [Processor>% User Time] !!! (if you understand the way the CPU works, it is merely illogical to even say it would be related).

    This can easily be shown using a Virtual Machine having 2 cores and a stress loader on 1 core only.

    Perfmon values :

    Process(CPULoad)\% Privileged Time = 8.43
    Process(CPULoad)\% Processor Time = 100.02
    Process(CPULoad)\% User Time = 91.60
    Processor(_Total)\% Privileged Time = 12.70
    Processor(_Total)\% Processor Time = 72.78
    Processor(_Total)\% User Time = 60.00

    Using Bruce formula :
    Real process CPU would be = 1.0002 / 2 cores * 0.6000 = 30.01 % => WRONG

    Using my formula :
    Real process CPU would be = 1.0002 / 2 cores = 50.01 % => TRUE (the process does stress 1 whole CPU)
    ...and it does confirm the value reported in the Task Manager.

    • Edited by Syldub Thursday, October 27, 2016 12:22 AM
    • Proposed as answer by Butmah Tuesday, July 18, 2017 8:26 AM
    Thursday, October 27, 2016 12:08 AM
  • Hello Bruce, do have any comment on the comment by "Syldub"?

    Would be great if you can give some clarification on it. Thanks!

    Thursday, February 7, 2019 7:01 PM