TimeStamps |
Top Previous Next |
Message
TimeStamps on|off
Originator
Client
Response
Info: Timestamps on [<timestamp>] Info: Timestamps off SyntaxError: invalid parameters to TimeStamps SyntaxError: insufficient parameters to TimeStamps
Response (immediate socket)
Success Failure
Details
When timestamps are switched on, every message coming from the server has a timestamp added. Here's what one hypothetical message looks like with and without a timestamp:
Event: Nosepoke Event: Nosepoke [43827]
Appended to the original message is a space, '[', a number, and ']'. The number is the system time in milliseconds (ms).
The server never sends '[' or ']' except to mark a timestamp – so you may want to avoid using '[' as part of your event names (because you'll have to distinguish between your event and the timestamp).
Example: reaction times
Imagine your subject is trained to respond to a light stimulus by pressing a lever. You want to know the reaction time between turning the light on and the lever being pressed. Consider this (responses from the server are shown in blue, commands from the client in red):
LineSetEvent Lever on lever_pressed Info: LineEventCreated: 8 on TimeStamps On Info: Timestamps on [429458] LineSetState Light on (*) Success [429682] (†) ... Event: lever_pressed [429912]
(*) This command was sent through the immediate socket in order to get a response to the LineSetState command. (†) This response therefore arrives via the immediate socket.
The reaction time is (429912 ms – 429682 ms) = 230 ms.
This is the most accurate way to measure reaction times, because network latencies do not affect the measurement. (Although a network delay in the LineSetState call will delay the time at which the light goes on, the lever press is accurately measured relative to the moment the light is turned on. Network delays in server-to-client transmission do not matter because time measurement is only being performed on the server.)
Revision history
Implemented in WhiskerServer version 1.
See also
|