TLDR
-
Deep dive into Linux timestamp mechanisms, comparing syscall overhead, VDSO shortcuts, and clock source trade-offs for low-latency use.
Key Takeaways
-
Linux exposes multiple clock sources with different accuracy and cost trade-offs, such as
CLOCK_MONOTONIC_COARSE vs CLOCK_MONOTONIC.
-
VDSO (Virtual Dynamic Shared Object) lets userspace read certain clocks without a full syscall, dramatically reducing overhead.
-
TSC-based clocks are the fastest on modern x86 hardware but require stable CPU frequency and correct kernel configuration.
-
Choosing the wrong clock for a hot path can add tens to hundreds of nanoseconds per call at scale.
Hacker News Comment Review
-
No substantive HN discussion yet.
Original | Discuss on HN