NDIS hi resolution timers?

I have noticed a few things w.r.t to the NDIS timers I have been using … more often than not I have seen that the instance at which they fire, is off by 10 ms (always later than expected).  [For eg. fire in 20 ms , gets me a timer that fires 30 ms from now]. Is this known behaviour??. Are there any hi-resolution timers for NDIS?

Also - Is there any difference between using NdisMSetTimer family and NdisSetTimer family of functions ? - as far as accuracy is concerenced?

Are there any boot options that I can specify for higher resolution timers… What are my choices?

Thanks

-Johnny


Johnny,

" FALSE if the timer function is already running or if there is no way to stop the timer function from running", so since it isn’t a periodic timer, your solution would work - just don’t reset the timer and you’ll be fine. Take mind that in some situations you should wait a bit before continuing with the initial thread. You wouldn’t want to release memory that the timer function is using or anything of the sort…

Gedon,

-----Original Message-----
From: Johnny D [mailto:xxxxx@hotmail.com]
Sent: Monday, April 22, 2002 11:29 PM
To: NT Developers Interest List
Subject: [ntdev] Question about Ndis timers

What does the DDK mean when they say one must take appropriate action if NdisCancelTimer returns FALSE??. If I set a timer and then prematurely try to cancel it - get a FALSE,  should I make a check in the timer function to see if the timer has been cancelled?. Also, if I always call NdisSetTimer() with a new timeout value, immediately after the cancellation, then I should be safe irrespective of the check… right?


A call to NdisCancelTimer returns TRUE in the TimerCanceled parameter if the timer was queued and then canceled. NdisCancelTimer returns FALSE if the timer function is already running or if there is no way to stop the timer function from running. If NdisCancelTimer returns FALSE, the caller must take appropriate action.


Thanks
-Johnny


Chat with friends online, try MSN Messenger: Click Here

NDIS timers use KeSetTimer under the covers; the resolution of this is about
16ms by default as I recall. Also, the actual time is guaranteed to >= the
specified value; you’ll actually be scheduled to run the next time the clock
ticks after the time you specify.

Simon

-----Original Message-----
From: Johnny D [mailto:xxxxx@hotmail.com]
Sent: Thursday, May 09, 2002 8:52 PM
To: NT Developers Interest List
Cc: xxxxx@intel.com; xxxxx@storagecraft.com
Subject: [ntdev] NDIS hi resolution timers?

I have noticed a few things w.r.t to the NDIS timers I have been using …
more often than not I have seen that the instance at which they fire, is off
by 10 ms (always later than expected). [For eg. fire in 20 ms , gets me a
timer that fires 30 ms from now]. Is this known behaviour??. Are there any
hi-resolution timers for NDIS?

Also - Is there any difference between using NdisMSetTimer family and
NdisSetTimer family of functions ? - as far as accuracy is concerenced?

Are there any boot options that I can specify for higher resolution
timers… What are my choices?

Thanks

-Johnny


Johnny,
" FALSE if the timer function is already running or if there is no way to
stop the timer function from running", so since it isn’t a periodic timer,
your solution would work - just don’t reset the timer and you’ll be fine.
Take mind that in some situations you should wait a bit before continuing
with the initial thread. You wouldn’t want to release memory that the timer
function is using or anything of the sort…
Gedon,

-----Original Message-----
From: Johnny D [mailto:xxxxx@hotmail.com]
Sent: Monday, April 22, 2002 11:29 PM
To: NT Developers Interest List
Subject: [ntdev] Question about Ndis timers

What does the DDK mean when they say one must take appropriate action if
NdisCancelTimer returns FALSE??. If I set a timer and then prematurely try
to cancel it - get a FALSE, should I make a check in the timer function to
see if the timer has been cancelled?. Also, if I always call NdisSetTimer()
with a new timeout value, immediately after the cancellation, then I should
be safe irrespective of the check… right?


A call to NdisCancelTimer returns TRUE in the TimerCanceled parameter if the
timer was queued and then canceled. NdisCancelTimer returns FALSE if the
timer function is already running or if there is no way to stop the timer
function from running. If NdisCancelTimer returns FALSE, the caller must
take appropriate action.


Thanks
-Johnny


Chat with friends online, try MSN Messenger: Click Here
http:

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to %%email.unsub%%</http:>

Generally, requiring a hi-res timer in the NDIS miniport is a bad design.

NT has really problems with hi-res timers, and thus hardware suited for use on NT must not require the OS to have such facility.

If you need the event to fire exactly at some time - then 1ms is the most fine-grained resolution, and it can be reached by ExSetTimerResolution. No NDIS function for this, since NDIS drivers are not supposed to require this feature. This feature abuses the rest of the OS in favor of your driver, and thus is recommended for multimedia only. The corresponding user-mode function is WINMM!timeBeginPeriod, yes, in a multimedia DLL.

If you do not need the event to fire this often or with this precision, but just to measure time precisely - use RDTSC or KeQueryPerformanceCounter.

Max

----- Original Message -----
From: Johnny D
To: xxxxx@lists.osr.com
Cc: xxxxx@intel.com ; xxxxx@storagecraft.com
Sent: Friday, May 10, 2002 4:51 AM
Subject: NDIS hi resolution timers?

I have noticed a few things w.r.t to the NDIS timers I have been using … more often than not I have seen that the instance at which they fire, is off by 10 ms (always later than expected). [For eg. fire in 20 ms , gets me a timer that fires 30 ms from now]. Is this known behaviour??. Are there any hi-resolution timers for NDIS?

Also - Is there any difference between using NdisMSetTimer family and NdisSetTimer family of functions ? - as far as accuracy is concerenced?

Are there any boot options that I can specify for higher resolution timers… What are my choices?

Thanks
-Johnny


Johnny,
" FALSE if the timer function is already running or if there is no way to stop the timer function from running", so since it isn’t a periodic timer, your solution would work - just don’t reset the timer and you’ll be fine. Take mind that in some situations you should wait a bit before continuing with the initial thread. You wouldn’t want to release memory that the timer function is using or anything of the sort…
Gedon,
-----Original Message-----
From: Johnny D [mailto:xxxxx@hotmail.com]
Sent: Monday, April 22, 2002 11:29 PM
To: NT Developers Interest List
Subject: [ntdev] Question about Ndis timers

What does the DDK mean when they say one must take appropriate action if NdisCancelTimer returns FALSE??. If I set a timer and then prematurely try to cancel it - get a FALSE, should I make a check in the timer function to see if the timer has been cancelled?. Also, if I always call NdisSetTimer() with a new timeout value, immediately after the cancellation, then I should be safe irrespective of the check… right?


A call to NdisCancelTimer returns TRUE in the TimerCanceled parameter if the timer was queued and then canceled. NdisCancelTimer returns FALSE if the timer function is already running or if there is no way to stop the timer function from running. If NdisCancelTimer returns FALSE, the caller must take appropriate action.


Thanks
-Johnny


Chat with friends online, try MSN Messenger: Click Here