[Interest] QTimer and Qt::PreciseTimer
Thiago Macieira
thiago.macieira at intel.com
Wed Jul 26 23:36:04 CEST 2017
On quarta-feira, 26 de julho de 2017 14:23:29 PDT Joshua Grauman wrote:
> Thanks so much for the response.
>
> So do I have this right then?
>
> QTimer doesn't use any actually timers in the OS (no system
> calls/interrupts). It is all handled internally by Qt's event loop. So if
> the OS doesn't give Qt CPU time, it will miss a timer. Calling 'nice'
> (Linux) on the process may help with this.
On Windows, it will use multimedia timers (timerSetEvent()) for precise
timers, SetTimer() for the others. How the OS services those, I don't have a
clue.[*]
I have a pending patch to make it use CLOCK_MONOTONIC_COARSE on Linux (and
CLOCK_MONOTONIC_FAST on BSDs), but I've run into some problems that some
timers wake up in the wrong order. The coarse and precise timers are not
sync'ed in the OS: even if you query the latter, the former may not update, so
it may look like the monotonic clock went backwards.
Until then, everything uses the same clock on Unix and simply depends on when
the OS wakes us up from ppoll().
[*] I have a vague memory of the regular timers having a 4 ms granularity.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list