How to detect CPU loading?

Hello!

My driver have some sort of “must to do” jobs and some sort of “optional”
jobs. I want that optional tasks will be executed only if CPU loading is not
“too high”. So how I can detect current CPU loading?

Vladimir


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

A simple way of doing this is to use a thread for “optional”
jobs and give it a priority corresponding to your meaning of
“not too high”. This is the only suggestion I can make based
on the vague info you gave.

— Vladimir Ignatov <100xcd@100xCD.com> wrote:

Hello!

My driver have some sort of “must to do” jobs and some sort of “optional”
jobs. I want that optional tasks will be executed only if CPU loading is not
“too high”. So how I can detect current CPU loading?

Vladimir


You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You can create two system threads. Assign a lower priority to one and a
higher priority to the other.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Vladimir Ignatov
Sent: Friday, February 15, 2002 6:57 PM
To: NT Developers Interest List
Subject: [ntdev] How to detect CPU loading?

Hello!

My driver have some sort of “must to do” jobs and some sort of
“optional” jobs. I want that optional tasks will be executed only if CPU
loading is not “too high”. So how I can detect current CPU loading?

Vladimir


You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

While I agree with the others saying that the best way to execute jobs when
the cpu load is low is to create a thread with a low priority, to strictly
answer your question about detecting CPU loading, the
NtQuerySystemInformation call with SystemProcessorTimes will give you info
about what the processor(s) is/are up to.

This is not a documented call, so all of the usual caveats apply. For more
info on this call, try the Windows NT/2k native api reference by Gary
Nebbett.

-jordan tigan

On 02/16/02, ““Jamey Kirby” ” wrote:
> You can create two system threads. Assign a lower priority to one and a
> higher priority to the other.
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Vladimir Ignatov
> Sent: Friday, February 15, 2002 6:57 PM
> To: NT Developers Interest List
> Subject: [ntdev] How to detect CPU loading?
>
>
> Hello!
>
> My driver have some sort of “must to do” jobs and some sort of
> “optional” jobs. I want that optional tasks will be executed only if CPU
> loading is not “too high”. So how I can detect current CPU loading?
>
> Vladimir
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
> unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Start a low-priority thread. This is a best way.
It will get the CPU only if the CPU will have no other tasks to do.

Max

----- Original Message -----
From: “Vladimir Ignatov” <100xcd@100xCD.com>
To: “NT Developers Interest List”
Sent: Saturday, February 16, 2002 5:56 AM
Subject: [ntdev] How to detect CPU loading?

> Hello!
>
> My driver have some sort of “must to do” jobs and some sort of “optional”
> jobs. I want that optional tasks will be executed only if CPU loading is not
> “too high”. So how I can detect current CPU loading?
>
> Vladimir
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com