Skip to content

main: add high-performance clock - #716

Open
rjarry wants to merge 1 commit into
DPDK:mainfrom
rjarry:clock
Open

main: add high-performance clock#716
rjarry wants to merge 1 commit into
DPDK:mainfrom
rjarry:clock

Conversation

@rjarry

@rjarry rjarry commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

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

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>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants