> I'm working on a neuropsychological test battery, and
> I need to measure the time elapsed since something
> appears in the screen until the subject reacts
> pressing a key. I'd like to have accuracy to 1 msec or
> better. Does anyone know how accurate is Squeak going
> to be?
Depends on a combination of VM/OS/Hardware. There is no way to tell
other than to count ticks and see what accuracy you get. Very
generally, on Windows you will typically get 1ms accuracy. For example:
| thisTick nextTick count list |
list := Array new: 1000.
count := 0.
thisTick := Time millisecondClockValue.
[count < 1000] whileTrue:[
nextTick := Time millisecondClockValue.
nextTick = thisTick ifFalse:[
count := count + 1.
list at: count put: (nextTick - thisTick).
thisTick := nextTick.
].
].
^(Bag withAll: list) sortedCounts
On my machine (XP, 3.6.2 VM) the result is
997->1
3->2
> How much time can pass since I display something in
> Squeak (drawing over Display) until it gets displayed
> in the user screen?
In Morphic, things will appear once
DisplayScreen>>forceDamageToScreen: has been called. But what's more
important, your monitor will be a limiting factor. Even at a refresh
rate of 100Hz the monitor only gets refreshed every 10ms.
Unfortunately, at this point there is no way from Squeak to sync to
the monitor so your timing is likely to be off by some portion of the
monitor refresh rate.
> And how accurate are event timestamps?
Speaking for Windows (but I think the same is true for the other
platforms) the time stamp of the event is delivered by the OS, so it's
the timing of the OS that matters here (and I have absolutely no idea
how good it is).
Cheers,
- Andreas