Windows Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a Time
Function fired at 4 ms exactaly even though
DDK documentation says that the granualrity for Timer is in nano
seconds/Milli seconds in case of NDISMSetTimer/KeTimer.

Iam using the following technique ot get a “Window” of 4 milli Seconds.
Please tell if its in any ways usefull!!

Using RDTSC , I measure the cycles and compute the number of cycles required
for 4 milli seconds.
I have a routine which doess some junk operations and gives me delay of 4
milliseconds
(I know this works with 99 % accuracy…after lot of testing).

I have a 2.6 GHz intel p4 with HT - Win 2000.So after testing all these
timers I know that the minimum scheduling time is 15 ms
(even though I set a timer for 4 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

startTimer1
Delay(4 milliseconds) // I know this works
startTimer2
Delay(4 milliseconds) // I know this works
startTimer3


So logically I should get a timer running every 4 milliseconds.

Anybody please !! tell me if the OS would screw up the time gap ??

Any Ideas on how to get a code running every 4 milliseconds.??

Thanx in Advance

Regards,
Manohara

Manohara,

Below is David Cutler’s response to your question. I strongly suggest
that you follow his guidelines.

The HAL selects the minimum and maximum rate at which it will run the
system clock. Typically this is 15ms and 1ms, but could be different.

All time values are expressed in 100 nanosecond increments no matter
what rate the clock is running at.

ExSetTimerResolution is exported from the system and available to
drivers to change the system clock rate. This is not encouraged,
however, unless there is a very special need. Increasing the clock rate
decreases battery life. Any increases a driver makes should only be made
for the duration it is necessary.

The lowest the clock resolution can be set to right now is around 1ms.
None of the frequencies are exact. For example, using the RTC part the
rate can be 15.6250ms, 7.8125ms, 3.90625ms, 1.953125ms, 976.5us, and
488.2us.

The clock rate can also be set from user mode using a couple of APIs
from winmm.dll - timeBeginPeriod and timeEndPeriod. The real API
NtSetTimerResolution is not documented for user mode.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Manohara.K
Sent: Monday, August 09, 2004 4:46 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Windows Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a
Time
Function fired at 4 ms exactaly even though
DDK documentation says that the granualrity for Timer is in nano
seconds/Milli seconds in case of NDISMSetTimer/KeTimer.

Iam using the following technique ot get a “Window” of 4 milli Seconds.
Please tell if its in any ways usefull!!

Using RDTSC , I measure the cycles and compute the number of cycles
required
for 4 milli seconds.
I have a routine which doess some junk operations and gives me delay of
4
milliseconds
(I know this works with 99 % accuracy…after lot of testing).

I have a 2.6 GHz intel p4 with HT - Win 2000.So after testing all these
timers I know that the minimum scheduling time is 15 ms
(even though I set a timer for 4 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

startTimer1
Delay(4 milliseconds) // I know this works
startTimer2
Delay(4 milliseconds) // I know this works
startTimer3


So logically I should get a timer running every 4 milliseconds.

Anybody please !! tell me if the OS would screw up the time gap ??

Any Ideas on how to get a code running every 4 milliseconds.??

Thanx in Advance

Regards,
Manohara


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com