main: add high-performance clock - #716
Open
rjarry wants to merge 1 commit into
Open
Conversation
Reading the common clock, gr_clock_ns() -- implemented with clock_gettime() -- is quite slow, even though the kernel exposes it as a vDSO. For improved performance in the dataplane, introduce a high-performance clock: clock_ns(), based on snapshotting the common clock, for use where a snapshot is sufficiently accurate. Immediately before walking the graph in the dataplane worker thread's main loop, mark the clock as trusted and update it, so it is safe to use in the "process" functions of the graph nodes. Define GR_CLOCK_SOURCE (as CLOCK_MONOTONIC_RAW), to highlight which clock source is used by Grout. Add definitions like GR_NS_PER_S to help convert between nanoseconds and microseconds (GR_NS_PER_US) respectively milliseconds (GR_NS_PER_MS). Replace all direct calls to gr_clock_ns() in grout control and data plane with clock_ns() and update <gr_clock.h> include to "clock.h" accordingly. Signed-off-by: Morten Brørup <mb@smartsharesystems.com> Signed-off-by: Robin Jarry <rjarry@redhat.com>
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record |
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.
Reading the common clock, gr_clock_ns() -- implemented with clock_gettime() -- is quite slow, even though the kernel exposes it as a vDSO.
For improved performance in the dataplane, introduce a high-performance clock: clock_ns(), based on snapshotting the common clock, for use where a snapshot is sufficiently accurate.
Immediately before walking the graph in the dataplane worker thread's main loop, mark the clock as trusted and update it, so it is safe to use in the "process" functions of the graph nodes.
Define GR_CLOCK_SOURCE (as CLOCK_MONOTONIC_RAW), to highlight which clock source is used by Grout.
Add definitions like GR_NS_PER_S to help convert between nanoseconds and microseconds (GR_NS_PER_US) respectively milliseconds (GR_NS_PER_MS).
Replace all direct calls to gr_clock_ns() in grout control and data plane with clock_ns() and update <gr_clock.h> include to "clock.h" accordingly.
Respin of: https://patches.dpdk.org/project/grout/patch/20260827094041.520166-1-mb@smartsharesystems.com/
Cc: @MortenBroerup