This simulator simulates worst-case latency when presenting assuming that:
Please note vblank_interval is 16ms, not 16.667 which corresponds to a 62.50hz monitor instead of 60hz.
The main purpose of this simulator is to understand the effects of buffer_count & swapchain_count and how they vary on different conditions.
Actual lag can be reduced if the CPU waits to prepare commands instead of starting as soon as possible. For more info see my reply on Ask Ubuntu and see Controller to Display Latency in Call of Duty.
It is also not meant to be 100% accurate. GPU drivers can use tricks (e.g. often called "Anti Lag" or "Low Latency") to forcefully induce CPU sleeping, or may have implementation quirks that are not considered by the simulator.
Observe that in general:
Source Code can be found on Github. You can also find more info there.