Re[2]: Clock resolution on a PC and WinNT

Clock resolution ( and hence measuring elapsed time) does not depend
on interrupts per second.

Clock interrupts are another concept which is important when you need
system supplied callbacks at specific times.

| Norbert Kawulski | mailto:xxxxx@stollmann.de |
| Stollmann T.P.GmbH, Development | http://www.stollmann.de |
–If it’s ISDN or Bluetooth, make sure it’s driven by Stollmann–

“Behind every successful man stands a surprised mother-in-law.”

I hate to break the news to everyone, but just because the Operating
System has the possibility to keep time in 100nsec increments, that
does NOT mean the closk resolution is that fine. I believe that PCs
have clocks that interrupt every 1 millisecond (at least as WinNT
sets them).

The clock tick count is the minimum true resolution that can be
used. I suspect that some systems have clock rates that are settable
to something less that 1msec, and that an industrious system programmer
could change the resolution. The issue of clock resolution has to do
with whether or not you want to service that number of interrupts required.

I am sure you could buy a clock board that can interrupt faster than
every 1msec and write a driver to service those requests if you have
such a need.

just my opinion, Rick Cadruvi…

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@nai.com
> Sent: Wednesday, June 27, 2001 8:56 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Clock resolution on a PC and WinNT
>
>
> Have you tried NdisGetCurrentSystemTime ??
> It has a 100-nanosecond granularity.
>
>
>
> >Hi, guys!
> >
> >I have a question (as always… :wink: ). This time I believe it’s quite
> >simple:
> >
> >I’ve developed a driver that listens to the network card. For every frame
> >that
> >passes through the NIC, I’d like to record its timestamp.
> >
> >Currently, I use the KeQuerySystemTime() function in order to get it.
> >
> >The problem is that the resolution of this clock is not fine enough, and
> I
> >get the very
> >same timestamp for subsequent frames.
> >
> >I’ve been told by someone that there’s another way to get the time,
> >>using a special register that holds the real-time clock, and is updated
> >automatically, regardless of CPU state.
>
> >Is it true?
>
> Any suggestions?
>
> BTW: I’ve noticed that Linux has a clock with 1 microsecond resolution !
>
>
> thanks in advance,
>
> - Barak
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdperf.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@stollmann.de
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

If what you need is the ability to timestamp to 1uS precision (not
resolution), you could do a variation of what was suggested. There is no
need to interrupt every 1 uS, since that would be extremely wasteful on
resources and would probably make an NT/W2K system unusable. Instead, have
a hardware TOY (Time Of Year) clock board whose value can be read from a
64-bit PCI bus port. When you need the current time for a timestamp, simply
read the high-precision TOY to get the current time. This gives you the
high precision without all those unnecessary interrupts.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Rick Cadruvi
Sent: Wednesday, June 27, 2001 11:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Clock resolution on a PC and WinNT

I hate to break the news to everyone, but just because the Operating
System has the possibility to keep time in 100nsec increments, that
does NOT mean the closk resolution is that fine. I believe that PCs
have clocks that interrupt every 1 millisecond (at least as WinNT
sets them).

The clock tick count is the minimum true resolution that can be
used. I suspect that some systems have clock rates that are settable
to something less that 1msec, and that an industrious system programmer
could change the resolution. The issue of clock resolution has to do
with whether or not you want to service that number of interrupts required.

I am sure you could buy a clock board that can interrupt faster than
every 1msec and write a driver to service those requests if you have
such a need.

just my opinion, Rick Cadruvi…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@nai.com
Sent: Wednesday, June 27, 2001 8:56 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Clock resolution on a PC and WinNT

Have you tried NdisGetCurrentSystemTime ??
It has a 100-nanosecond granularity.

>Hi, guys!
>
>I have a question (as always… :wink: ). This time I believe it’s quite
>simple:
>
>I’ve developed a driver that listens to the network card. For every frame
>that
>passes through the NIC, I’d like to record its timestamp.
>
>Currently, I use the KeQuerySystemTime() function in order to get it.
>
>The problem is that the resolution of this clock is not fine enough, and
I
>get the very
>same timestamp for subsequent frames.
>
>I’ve been told by someone that there’s another way to get the time,
>>using a special register that holds the real-time clock, and is updated
>automatically, regardless of CPU state.

>Is it true?

Any suggestions?

BTW: I’ve noticed that Linux has a clock with 1 microsecond resolution !

thanks in advance,

  • Barak

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


You are currently subscribed to ntdev as: xxxxx@pdq.net
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

Why do you not use the KeQueryPerformanceCounter. Its resolution is machine
dependent, but very high.

Best regards

F.X. Mayer

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gregory G. Dyess
Sent: Thursday, June 28, 2001 2:16 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Clock resolution on a PC and WinNT

If what you need is the ability to timestamp to 1uS precision (not
resolution), you could do a variation of what was suggested. There is no
need to interrupt every 1 uS, since that would be extremely wasteful on
resources and would probably make an NT/W2K system unusable.
Instead, have
a hardware TOY (Time Of Year) clock board whose value can be read from a
64-bit PCI bus port. When you need the current time for a
timestamp, simply
read the high-precision TOY to get the current time. This gives you the
high precision without all those unnecessary interrupts.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Rick Cadruvi
Sent: Wednesday, June 27, 2001 11:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Clock resolution on a PC and WinNT

I hate to break the news to everyone, but just because the Operating
System has the possibility to keep time in 100nsec increments, that
does NOT mean the closk resolution is that fine. I believe that PCs
have clocks that interrupt every 1 millisecond (at least as WinNT
sets them).

The clock tick count is the minimum true resolution that can be
used. I suspect that some systems have clock rates that are settable
to something less that 1msec, and that an industrious system programmer
could change the resolution. The issue of clock resolution has to do
with whether or not you want to service that number of interrupts
required.

I am sure you could buy a clock board that can interrupt faster than
every 1msec and write a driver to service those requests if you have
such a need.

just my opinion, Rick Cadruvi…

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@nai.com
> Sent: Wednesday, June 27, 2001 8:56 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Clock resolution on a PC and WinNT
>
>
> Have you tried NdisGetCurrentSystemTime ??
> It has a 100-nanosecond granularity.
>
>
>
> >Hi, guys!
> >
> >I have a question (as always… :wink: ). This time I believe it’s quite
> >simple:
> >
> >I’ve developed a driver that listens to the network card. For
every frame
> >that
> >passes through the NIC, I’d like to record its timestamp.
> >
> >Currently, I use the KeQuerySystemTime() function in order to get it.
> >
> >The problem is that the resolution of this clock is not fine
enough, and
> I
> >get the very
> >same timestamp for subsequent frames.
> >
> >I’ve been told by someone that there’s another way to get the time,
> >>using a special register that holds the real-time clock, and
is updated
> >automatically, regardless of CPU state.
>
> >Is it true?
>
> Any suggestions?
>
> BTW: I’ve noticed that Linux has a clock with 1 microsecond resolution !
>
>
> thanks in advance,
>
> - Barak
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdperf.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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


You are currently subscribed to ntdev as: xxxxx@fxm.de
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

Think about what KeStallExecutionProcessor()does in relation to the
original request for a means of timestamping at a resolution less
than the system clock tick. Stalling the processor in a loop doesn’t
help since no other work is done during that time. I believe this
functionallity was implemented so that software that needed to do
something at finer resolution offsets in some sequence could do it
at the price of NOTHING else getting done.

just my opinion, Rick Cadruvi…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Avi Shmidman
Sent: Thursday, June 28, 2001 12:24 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Clock resolution on a PC and WinNT

> Could you expand on that a bit?
> Johan

The KeStallExecutionProcessor() routine takes a parameter in terms of
microseconds, and implements it by looping for the number of times
specified by a value it retrieves. This value, of course, differs from
machine to machine, depending on their speed. The value seems to be stored
inside the Processor Control Region. Based on this value, then, we may be
able to get an accurate count of the number of cycles per microsecond on a
given machine.

However, now that I think about it, the usefulness of this value is
limited; basically, it just gives us the speed of the machine. And it
would not be able to help us with your goal of synchronizing the clock.

  • Avi

You are currently subscribed to ntdev as: xxxxx@rdperf.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