Re: High Resolution Callback Timer (microseconds)
From: Tom Widmer (tom_usenet_at_hotmail.com)
Date: 03/10/05
- Next message: ioanamirela: "command line arguments"
- Previous message: Devender Khari: "Re: VC6 and VC7 applications and DLLs coexistence"
- In reply to: Michael Evans: "High Resolution Callback Timer (microseconds)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Mar 2005 11:47:05 +0000
Michael Evans wrote:
> Anyone,
>
> I'm looking for a way to setup a callback function in our VC++ .net
> 2003 7.1 console application using a higher resolution timer. The
> multimedia timer is too low resolution at 1 millisecond. We need
> microsecond resolution to guarantee an exact update rate (60 or 70 Hz
> for example.)
>
> We use the Performance Counter to get microsecond resolution when
> measuring elapsed time, but there doesn't appear to be any tools for
> generating callbacks or interrupts, etc. at that higher resolution.
>
> Any ideas would be greatly appreciated. Thanks,
This isn't generally possible even with realtime operating systems.
Typically, OSes service timers at a particular resolution, such as every
1 ms, or whatever. If a timer callback or event is supposed to fire at
microsecond 123456, it will actually fire at the first kernel tick after
that time, say at microsecond 124000 (+ any kernel and scheduling latency).
The two approaches Carl mentioned are the two feasible ones. A realtime
operating system will give you almost perfect timings every time using
either (as long as priorities are set appropriately), while Windows will
give you, on average, reasonable timings (as long as priorities are set
appropriately), but with no guarantees. Remember to boost the priority
of the timing process and thread as high as possible, at least during
the critical regions (e.g. during the polling stage using technique 1).
If you are just updating a display, if you use DirectX, you shouldn't
need any timers better than 1ms accuracy. What exactly are you doing?
Tom
- Next message: ioanamirela: "command line arguments"
- Previous message: Devender Khari: "Re: VC6 and VC7 applications and DLLs coexistence"
- In reply to: Michael Evans: "High Resolution Callback Timer (microseconds)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|