Remove boottime from quark times#368
Open
nicholasberlin wants to merge 1 commit into
Open
Conversation
Times derived from quark.boottime were computed once and stored, so a system clock step after quark_init() (say NTP correcting a clock that was wrong at boot) left every stored and emitted timestamp shifted by the step size until restart. Nothing computed with quark.boottime is stored or handed out anymore: qev->time, proc_time_boot and exit_time_event are raw ns since boot, translated at the last moment with the new quark_time_to_wallclock(). Since quark has no event loop, keeping the epoch honest is the user's job: detect a step (a CLOCK_REALTIME timerfd with TFD_TIMER_CANCEL_ON_SET, or polling the CLOCK_REALTIME - CLOCK_BOOTTIME delta, which only moves on steps) and call the new quark_update_boottime(). Corrections then apply retroactively to any raw time, including events that predate the step. This also makes proc_entity_id immune to clock changes, as it now hashes the raw start time. Breaking change: consumers that treated qev->time, proc_time_boot or exit_time_event as wallclock epoch ns (endpoint, go-quark) must translate via quark_time_to_wallclock().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Times derived from quark.boottime were computed once and stored, so a system clock step after quark_init() (say NTP correcting a clock that was wrong at boot) left every stored and emitted timestamp shifted by the step size until restart.
Nothing computed with quark.boottime is stored or handed out anymore: qev->time, proc_time_boot and exit_time_event are raw ns since boot, translated at the last moment with the new quark_time_to_wallclock(). Since quark has no event loop, keeping the epoch honest is the user's job: detect a step (a CLOCK_REALTIME timerfd with TFD_TIMER_CANCEL_ON_SET, or polling the CLOCK_REALTIME - CLOCK_BOOTTIME delta, which only moves on steps) and call the new quark_update_boottime(). Corrections then apply retroactively to any raw time, including events that predate the step.
This also makes proc_entity_id immune to clock changes, as it now hashes the raw start time.
Breaking change: consumers that treated qev->time, proc_time_boot or exit_time_event as wallclock epoch ns must translate via quark_time_to_wallclock().