Re: time in us in OnTimer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




It isn't going to happen in Windows. Not ever. There is no way you can do anything at
intervals under a millisecond with any reliability, and you can have variation of hundreds
of milliseconds due to timeslicing. Windows is completely inappropriate for this purpose.
Even a device driver can't give you these kinds of guarantees.

When time matters, you cannot use a general-purpose operating system. You either have to
program to the bare metal, or use a real-time embedded OS, in a dedicated outboard system.
You can pretty much assume that in a typical operating system you can't do anything to an
accuracy of more than a few hundred milliseconds under normal conditions, You might
achieve tens of milliseconds on good days, and in rare situations you can sustain
accuracies of a millisecond, more or less, for limited contexts. But microseconds are
never going to be feasilble in a general-purpose operating system.

I have, next to my desk, a mass spectrometer that samples every 27 microseconds. It
transmits the summary of this data back to the Windows machine over a serial connection.
But the 27us is a critical time, and represents a very precise parameter that cannot vary.
It is handled by internal timing loops in the embedded processor. There's no other way to
do it.

It also won't happen in Unix, Linux, Solaris, or Mac OS X. General-purpose operating
systems are not going to support these kinds of timings. When these matter, you *have* to
use an outboard embedded processor system. This is a case where it is going to matter.
You will never, ever achieve anything even approximately useful at this level. You will
see much larger variations even at the hardware level in WIndows, because of other devices
interrupting you. You are simply asking the impossible.
joe

On 6 Sep 2006 00:27:37 -0700, "Tio Cactus" <tomjey@xxxxx> wrote:


Joseph M. Newcomer napisal(a):
If you need something that precise, build an external embedded system. Counting in
microseconds is pretty meaningless in a value as large as you specified (I can't tell what
you intended because of the odd use of commas) but you if are asking for something to
happen 4,560,120,320 microseconds apart, or about once every 76 hours. So accuracy to a
microsecond is almost certainly irrelevant.

Furthermore, the best you could *possibly* hope for would be 1000 microseconds resolution,
and you are more likely to consider yourself fortunate beyond belief if you could get
anything accurate to within 15,000 microseconds, so again counting anything to
microseconds is pretty pointless.

Youcould use QueryPerformanceCounter for very tiny measurements, which means that you
could time intervals of as little as a few hundred nanoseconds, with a variance of
hundreds of milliseconds (seriously!). So what are you *really* trying to do?
joe


In Specification of transmission which I'm writing occur tiny interval
of time e.g. Tss (means the time which is required for a host to poll
one peripheral device) Tss= 43 us
Some other period are 55us or 320us. E.g program sometimes must wait
55us to start next action. The device which program simulates require
tiny measurements. Is some way to get this ??
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: time in us in OnTimer
    ... It isn't going to happen in Windows. ... you cannot use a general-purpose operating system. ... accuracy of more than a few hundred milliseconds under normal conditions, ... microseconds are ...
    (microsoft.public.vc.mfc)
  • Re: time in us in OnTimer
    ... you cannot use a general-purpose operating system. ... accuracy of more than a few hundred milliseconds under normal conditions, ... microseconds are ... It is handled by internal timing loops in the embedded processor. ...
    (microsoft.public.vc.mfc)
  • Re: is there better 32 clock() timing?
    ... Even with the attribute lookup overhead, it's not several hundred microseconds ... But on e.g. win32 you can get preempted for a number of milliseconds. ... >Windows is to write a kernel driver, and even then there are no guarantees. ... >Windows is NOT a real-time system. ...
    (comp.lang.python)
  • Re: System Clock
    ... > I need to be able to measure a time interval in milliseconds on a ... For floats, what matters is the resolution (precision), not the unit. ...
    (comp.lang.python)
  • Re: Programming psychology experiments in Windows environment
    ... I should think about rewriting. ... Windows maintains a millisecond counter. ... It should be accurate within a couple of milliseconds ... >>display (e.g., sycnronizing display onsets with the refresh cycle, etc). ...
    (comp.lang.pascal.delphi.misc)