Latency is the time between giving a computer the instruction to draw on the screen and the actual drawing taking place.
A computer program that measures latency in Psychopy looks like this:
white.draw() # prepare a white image t0 = time.time() # mark time t0 win.flip() # wait for monitor to end previous refresh t1 = time.time() # mark time t1 light_sensor.read() # wait for light sensor to respond to white screen t2 = time.time() # mark time t2
The total measured latency in the graph above consists of a number of components:
- fixed flip time: 2 ms, the minimum time the flip() function takes to return. If this time is much larger, please adjust software settings. If it is larger than one refresh period of the monitor (8.33 ms) please make sure the software is not waiting for two vsyncs rather than for one.
- wait time (red): 0-8.33 ms, uniformly distributed. This is the time the computer has to wait for the monitor the finish its previous refresh of the screen. When using an experiment that is in sync with the display or that uses nvidia gsync the wait time disappears. Turning off vsync obviously removes this time as well.
- post flip latency: 2 ms, the time between the flip() function returning and the first pixels being drawn on the screen. Sometimes this number alone is called the latency. This is the number that is extremely high in image processing displays, such as televisions that are used as computer monitors.
- drawing time: 0-8 ms (about 1 ms in this graph). The time between drawing the first line on the screen and the last line on the screen. When using vsync, this time is fixed for a fixed position on the screen. When not using vsync, it is uniformly distributed between 0 and some time not smaller than 6.3 ms (the time to send all information to the screen) and 8.33 ms (the refresh period).
- response time (green): 0-1 ms, uniformly distributed (and sometimes 1 ms longer) The time it takes for the light sensor to send its response to the computer (this is not part of the monitor latency, but it is part of the time reported in the graph above)
So, what is the latency of this setup? The very short answer is: The maximum time it takes for the first pixel to be drawn after the draw instruction being given in Psychopy is 12 ms.