I don't think his comment about CLOCK_MONOTONIC_RAW being slow to query applies anymore. It used to be slow because it was not implemented in the vDSO library and so it included the overhead of a syscall. But there was a big vDSO refactoring that landed on 5.3 that I think fixed this problem. Edit: found the patchset. In includes benchmarks for several architectures as well: https://lore.kernel.org/linux-arm-kernel/2…
It's a fun fact that on cloud VMs (AWS, etc) vDSO gettime doesn't exist, so if you rely on vDSO to make time measurement free, it's not.
Measuring Latency in Linux (2014)
31–37 of 37 posts
Re: Measuring Latency in Linux (2014)
#32How does VM affect this? How does KVM affect this? How does Docker on KVM affect this? How does Hypervisor affect this? Add "... for a given network driver, e2e, measured RTT.."
Re: Measuring Latency in Linux (2014)
#33Re: Measuring Latency in Linux (2014)
#34Re: Measuring Latency in Linux (2014)
#35Earlier quoted context omitted.
How does scheduling a timer to go off at 3pm this Saturday work?
That’s a hard question regardless of programming language. One commonly referenced YouTube video about time that explains why this is hard: https://youtu.be/-5wpm-gesOY A reasonable first approximation of a solution would be to just check every second (or minute, or hour, depending on requirements) whether the current system time is later than the scheduled time for any pending events. Then you probably want to make…
https://developer.apple.com/documentation/dispatch/1420517-d... http://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
Re: Measuring Latency in Linux (2014)
#36Earlier quoted context omitted.
How does scheduling a timer to go off at 3pm this Saturday work?
Well, the parameter of a Timer is of type Duration: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years. Which is not really good because we have to calculate the time between now() and Saturday. If "wall time" changes, the scheduler will not be triggered when expected. In that case I would no…
http://man7.org/linux/man-pages/man2/clock_nanosleep.2.html https://developer.apple.com/documentation/dispatch/1420517-d...
OS timers when given a wall-clock expiry will do the right thing when the system wall-clock jumps.