Window Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a Time
Function fired at 5 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 5 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 5 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

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


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

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

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

Thanx in Advance

Regards,
Manohara

In the following piece of code,

------------------CRITICAL Section Begin -------------------------
startTimer1
Delay(5 milliseconds) // I know this works
startTimer2
Delay(5 milliseconds) // I know this works
startTimer3
-------------------CRITICAL Section End -----------------------

if you want startTimer2 to start exactly 5 millisecs after startTimer1,
then you should ensure that

(a) There are no interrupts inbetween. (U can ensure by placing this
critical code inbetween a CLI and STI assembly code)
(b) There are no NMI. ( On IBM PC, one of the o/p pin of the TIMER chip
is connected to the NMI.
By programming the timer chip is a certain way, you can make the
TIMER chip raise a NMI on some conditions.
So check if something like that is happening on your system.)

(a) and (b) both are must!

RDTSC counter can never be screwed up by the OS.

Cheers
Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Manohara.K
Sent: Monday, August 09, 2004 5:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Window Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a
Time
Function fired at 5 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 5 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 5 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

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


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

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

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

Thanx in Advance

Regards,
Manohara


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

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Never say NEVER, dude. It has been shown here any times that using RDTSC
really only guarantees one thing … You are no longer code compatible with
anything other than an INTEL processor that implements RDTSC.


Gary G. Little
Seagate Technology LLC

wrote in message news:xxxxx@ntdev…
In the following piece of code,

------------------CRITICAL Section Begin -------------------------
startTimer1
Delay(5 milliseconds) // I know this works
startTimer2
Delay(5 milliseconds) // I know this works
startTimer3
-------------------CRITICAL Section End -----------------------

if you want startTimer2 to start exactly 5 millisecs after startTimer1,
then you should ensure that

(a) There are no interrupts inbetween. (U can ensure by placing this
critical code inbetween a CLI and STI assembly code)
(b) There are no NMI. ( On IBM PC, one of the o/p pin of the TIMER chip
is connected to the NMI.
By programming the timer chip is a certain way, you can make the
TIMER chip raise a NMI on some conditions.
So check if something like that is happening on your system.)

(a) and (b) both are must!

RDTSC counter can never be screwed up by the OS.

Cheers
Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Manohara.K
Sent: Monday, August 09, 2004 5:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Window Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a
Time
Function fired at 5 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 5 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 5 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

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


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

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

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

Thanx in Advance

Regards,
Manohara


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

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Im not talking of compatability here.
I think that’s not an issue at all in the first case.

Windows OS is only for IBM PC and compatabiles.
And processor of any brand of any chip manufacturer that can fit into
IBM PC has to be binary compatabile with INTEL.
And thus they have to support the RDTSC.

However a manufacturer can manufacture a processore that is binary
compatible with INTEL, but provides an instruction to write into RDTSC
counters. Well in that case, I would not say "“never”.
But are there any such processors ??

Cheers
Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary G. Little
Sent: Monday, August 09, 2004 8:05 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Window Timers

Never say NEVER, dude. It has been shown here any times that using RDTSC
really only guarantees one thing … You are no longer code compatible
with
anything other than an INTEL processor that implements RDTSC.


Gary G. Little
Seagate Technology LLC

wrote in message news:xxxxx@ntdev…
In the following piece of code,

------------------CRITICAL Section Begin -------------------------
startTimer1
Delay(5 milliseconds) // I know this works
startTimer2
Delay(5 milliseconds) // I know this works
startTimer3
-------------------CRITICAL Section End -----------------------

if you want startTimer2 to start exactly 5 millisecs after startTimer1,
then you should ensure that

(a) There are no interrupts inbetween. (U can ensure by placing this
critical code inbetween a CLI and STI assembly code)
(b) There are no NMI. ( On IBM PC, one of the o/p pin of the TIMER chip
is connected to the NMI.
By programming the timer chip is a certain way, you can make the
TIMER chip raise a NMI on some conditions.
So check if something like that is happening on your system.)

(a) and (b) both are must!

RDTSC counter can never be screwed up by the OS.

Cheers
Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Manohara.K
Sent: Monday, August 09, 2004 5:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Window Timers

Hi Experts!!

I have tried all kinds of Timers on Windows and I was not able to get a
Time
Function fired at 5 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 5 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 5 ms :frowning: ) .

I start 3 timers like this "


Initialize Timers

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


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

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

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

Thanx in Advance

Regards,
Manohara


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

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Repeat After Us: Windows Is Not A Real Time Operating System.