<CAB+QPJAsO393mvtjHFLYeEgUz6s9F8Yijbj5wVmocFaLWhM+hA at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
Interesting, I was unaware that the frequency of calling SDL_PumpEvents()
affected the accuracy of the timestamps. To make sure I understand clearly,
is it the case that, for example, the timestamp of a keypress doesn’t
reflect the actual time of the keypress, but instead reflects the time of
the call to SDL_PumpEvents() that followed the keypress?
While this is good to know (hence my attempt at seeking clarification
above), it’s actually tangential to my original query insofar as the lag
between the input event and the timestamp is an issue of accuracy, whereas
my original query sought to improve precision. While it’s important to
ensure accurate measurements (and especially to avoid differential accuracy
across measurements that you’d later want to compare),
Guess what you’re going to run into? Differential accuracy across
measurements. If the details of key-press timing really matters then
you should custom-build a serial-port keyboard that includes
timestamps with the key-press data.
You can improve things somewhat by using a stripped-down Linux (or
similar), but you’re still going to get smacked around by preemption,
maybe paging, task-switching, etc. At least you aren’t quite like the
last guy, he needed to deal with monitor lag.
it’s also helpful to
seek the highest precision you can achieve for the same reason you’d
probably find a meter stick with millimeter marks more useful than one with
merely centimeter marks when forced to record measurements to the nearest
marked unit of measurement.
This is much more relevant when you’re measuring from both sides of an
object, than when you’re measuring between one side of an object and a
point that moves in unpredictable ways. You’ll be doing the later, not
the former. You can attempt to estimate the average differential
between key-press and timestamp, but SDL (whether 1 or 2) wasn’t
designed for scientific research, so it doesn’t have any API to
provide Quality Of Service info like that.
If you do go with SDL’s timestamps, be prepared for several different
groupings, and don’t be surprised if timestamp differentials are
evenly distributed over a relatively large range.> Date: Sat, 2 Nov 2013 19:16:15 -0300
From: Mike Lawrence <mike.lwrnc at gmail.com>
To: SDL Development List
Subject: Re: [SDL] Make SDL_GetTicks() use the performance counter?