System Idle Process

  • Thread starter Thread starter TyBreaker
  • Start date Start date
T

TyBreaker

I am using a performance counter to record the "Elapsed (CPU) time" of
the "Idle" process. I record the elapsed time, wait 1 second and then
record the new elapsed time. The result I get is:

before: 175437046.875
after: 175438093.75
CPU time used: 1046.875

However I was running Prime95 at the same time and I obtained the
following stats during the same interval (used managed .NET call
Process.TotalProcessorTime.TotalMilliseconds):

before: 295905.4912
after: 296896.9168
CPU time used: 991.4256

Now my understanding of the System Idle Process is that it counts the
spare CPU time only. However for a 1 second interval both the Idle and
Prime95 processes appear to have clocked up nearly 1 second each! I
must be missing something here because this should be impossible,
correct? Just to clarify, I have a single CPU which only displays a
single CPU graph in Task Manager (hence isn't hyper-threaded or dual core).

Grateful for any guidance, thanks!

--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
You are using 2 different timings:
Idle process: Elapsed CPU time
Prime95: TotalProcessorTime

so you can not compare them ...
 
Theo said:
You are using 2 different timings:
Idle process: Elapsed CPU time
Prime95: TotalProcessorTime

so you can not compare them ...

Woah! Really? I though the total processor time meant the total
processor time (kernel time plus user time) for a particular process?

--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
TyBreaker said:
Woah! Really? I though the total processor time meant the total
processor time (kernel time plus user time) for a particular process?

The Visual Basic.NET help indicates Process.TotalProcessorTime is the
total CPU time for the particular process. So I should be able to
compare that to the Elapsed time for the System Idle Process over any
given interval eg 1 second. Unless I'm missing something?

--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
TotalProcessorTime: The processortime consumed by the process
ElapsedCpuTime: The cputime elapsed between 2 measurements, not
neccesary used by your process (preemtive multitasking ...)
 
To be more precise:

Prime95 is measuring the total processor time used by your process.
Your process used 991.4 milliseconds

The elapsedcputime is measuring the real processor time that has elapsed
(1 second/second/processor, so with dual processor there are 2 cpu
seconds per second). The time elapsed on your single processor machine
was 1046.8 milliseconds.

This means that 1046.8 - 991.4 = 55.4 milliseconds were used for one or
more other processes. That the measurement of the elapsed cpu time isn't
exactly 1 second is caused by the time slices of the preemtive
multitasking, wich are variable and at least 20ms each.
 
Theo said:
Prime95 is measuring the total processor time used by your process.
Your process used 991.4 milliseconds

OK, understood.
The elapsedcputime is measuring the real processor time that has elapsed
(1 second/second/processor, so with dual processor there are 2 cpu
seconds per second). The time elapsed on your single processor machine
was 1046.8 milliseconds.

Ah this is where I'm confused then. I ran perfmon to see what counters
existed and the description for Process\Elapsed Time indicates it
records "The total elapsed time, in seconds, that this process has been
running." so I understood it to be specific to the particular process I
had nominated - in this case the Idle process:

Private IdleCpuUsage As PerformanceCounter = New
PerformanceCounter("Process", "Elapsed Time", "Idle")

I notice I do get different values for this performance counter
depending on whether I point it at Idle or say, Firefox. If it is
recording the total CPU time irrespective of any particular process,
shouldn't the value being graphed be the same irrespective of which
process I nominate?
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
Back
Top