none
perfmon & logman - Process CPU counter higher than CPU _total

    Pregunta

  • Hi,

    I'm using logman to profile my application CPU utilization and i keep getting disturbing results.
    the Process i'm currently profiling CPU% is sometimes higher than total CPU.
    I don't see how is that even possible.

    the only explanation (that i could think of) is maybe the counter gives me stats per-CPU and that i have to divide my number in 2 (as I'm using a dual-core processor).

    I'd really thank anybody's help as i'm close to hopeless after searching an answer for almost 2 days straight now...

    Thanks,
    Hanan

    PS
    here is the script i use to profile my apps:

    @ECHO OFF
    md c:\perflogs
    logman create counter APPS_CPU -cf collection.txt
    logman update APPS_CPU -f csv -v mmddhhmm -si 1 -m start -rf 100
    logman query APPS_CPU
    ECHO Counters Created,
    ECHO Logging for 1:40
    sleep 100
    logman delete APP_CPU

    contents of collection.txt:
    \Processor(_total)\% Processor Time
    \Process(<process1>)\% Processor Time
    \Process(<process2>)\% Processor Time
    \Process(<process3>)\% Processor Time
    jueves, 23 de abril de 2009 6:04

Respuestas

  • Hanan,

    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.

     


    Bruce Adamczak


    Bruce Adamczak

     

    • Marcado como respuesta HananBar jueves, 23 de abril de 2009 14:32
    jueves, 23 de abril de 2009 14:05
    Moderador

Todas las respuestas

  •  

    Hi,

    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)

    Bruce Adamczak

    jueves, 23 de abril de 2009 11:48
    Moderador
  • inline

     

    Hi,

    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.

     

    from MS management console help file (or whatever you want to call the window that opens when you press help in perfmon):

    Process\% Processor Time - The sum of processor time on each processor for all threads of the process.

     

    so you're saying this is wrong?

     

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

    what?

    you mean to say that if i get the counter to 8%, and i have 2 processors:

    my actual CPU consumption is

    8/200 = 4% ?


    Bruce Adamczak

    I'm still not sure I've understood everything you said, so i'll try an example.

    say i have 2 process to profile, running on a dual-core processor.
    and i get the following line in my log file:

    process 1   process 2   cpu(_total)
      5               0.5             4   

    what is my app actual CPU consumption?
    (my guess says - 2.75%)
    but than again, maybe i'm wrong.

    Thanks,
    Hanan
    jueves, 23 de abril de 2009 13:28
  • Hanan,

    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.

     


    Bruce Adamczak


    Bruce Adamczak

     

    • Marcado como respuesta HananBar jueves, 23 de abril de 2009 14:32
    jueves, 23 de abril de 2009 14:05
    Moderador
  • well, if that's true, my results are better than i expected :)

    cheers,

    Hanan
    jueves, 23 de abril de 2009 14:32
  •  

    Hi,

    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)

    Bruce Adamczak

    Hi Bruce,

    thanks for this excellent post! I'm only left with one question: You´re saying the theoretical Max for the Process\% Processor Time\Instance counter is # of processors * 100. What if I´ve a QuadCore CPU with 4 physical cores but 8 logical core (because of HyperThreading)? Do I´ve to calculate with 4 or 8?

    Thank you very much in advance.

    Andreas Schreiber

    miércoles, 21 de diciembre de 2011 11:57