Repository navigation
capture: order live timestamps with a shared monotonic clock - #82
Merged
Merged
Conversation
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.
Frames from different buses could receive host timestamps before entering the shared capture lock, leaving timestamps out of append order. Live drivers now use
Capture.RecordFrameandRecordEvent, which assign timestamps under that lock from monotonic elapsed time anchored when the capture is created.AppendandAppendEventcontinue to preserve supplied timestamps.ASC rejects timestamp regressions instead of silently clamping them; equal timestamps remain valid. Driver timestamp plumbing is removed while retaining per-bus native I/O ordering. The capture clock survives
Clearand ignores subsequent wall-clock corrections; suspend behaviour follows Go's platform-dependent monotonic clock.Validation:
Note
Medium Risk
Changes timestamp assignment for all live driver paths and ASC export semantics; ordering bugs would affect traces and multi-bus captures, though behavior is heavily tested.
Overview
Introduces
Capture.RecordFrameandRecordEvent, which stamp live traffic under the capture lock from monotonic elapsed time anchored atNewCapture, so multi-bus captures get timestamps in append order instead of racing ontime.Now()outside the lock.Append/AppendEventstill honor caller-supplied times; drivers (PCAN, SocketCAN, Vector, virtual) now record via the live APIs and no longer thread host timestamps through decode paths.The ASC writer stops clamping regressing timestamps and returns an error when a record would go backward; equal timestamps stay valid. Docs and tests cover the shared clock (including concurrent multi-bus), ASC rejection, and relaxed virtual RX/TX timestamp equality (RX must not precede TX).
Reviewed by Cursor Bugbot for commit 4ecbf62. Configure here.