CPU Usage Internal Implementation?

Hello experts,

I’m wondering how the Windows (XP) CPU Usage measurement may be implemented.

The background is that we have an I/O intensive application exposing only
very low system wide CPU Usage in Task Manager of approximately 1% while
simultaneously running benchmarks show performance degradation of up to 40%
for ALU related benchmarks.

The application does most of its work in a dedicated driver, acquiring and
sorting measurement data at a bandwidth of up to 100 MByte/s.

My question is: How does the CPU Usage measurement and calculation work? Is
it really based on simple sampling by timer interrupt? Is the logging of
load of ISRs and DPCs warranted?

How can such a large discrepancy between monitoring and real performance
degradation be accomplished - by accident or intentionally?

Who knows how the CPU usage measurement works? What does it measure? What
not? Any hint is highly appreciated.

Many thanks,
Volker

> My question is: How does the CPU Usage measurement and calculation work?

Is
it really based on simple sampling by timer interrupt?

Yes.

Who knows how the CPU usage measurement works? What does it measure?

On each timer interrupt, it is checked what context was interrupted - another
ISR, DPC, idle pseudo-thread or a thread. For a thread, it is also checked
whether it was in kernel mode or user mode, and in what process it was.

Then the appropriate counter is incremented. Then the average of these counters
is called “CPU load” - per process, user/kernel, ISR and DPC time and so on.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank You, Maxim.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
S. Shatskih
Sent: Tuesday, March 14, 2006 3:02 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] CPU Usage Internal Implementation?

> My question is: How does the CPU Usage measurement and
calculation work?
>Is
> it really based on simple sampling by timer interrupt?

Yes.

> Who knows how the CPU usage measurement works? What does it measure?

On each timer interrupt, it is checked what context was
interrupted - another
ISR, DPC, idle pseudo-thread or a thread. For a thread, it is
also checked
whether it was in kernel mode or user mode, and in what
process it was.

Then the appropriate counter is incremented. Then the average
of these counters
is called “CPU load” - per process, user/kernel, ISR and DPC
time and so on.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online
at http://www.osronline.com/page.cfm?name=ListServer