Calling clock_gettime very often with rr

Benjamin King benjaminking at
Tue May 29 14:41:28 UTC 2018

On Tue, May 29, 2018 at 09:52:48AM +1200, Robert O'Callahan wrote:
>On Tue, May 29, 2018 at 5:38 AM, Benjamin King <benjaminking at> wrote:
>    I was considering using rdtsc to avoid too frequent calls to clock_gettime.
>    Something along the lines of 'assume that 1 microsecond did not pass unless
>    time stamp counter changed by at least X'. But this is also nondeterminism
>    that would need to be tracked by rr, no?
>Yes, and handling RDTSC is even slower than clock_gettime because we must
>context switch to the tracer. Unfortunately there is no way to selectively trap
>on RDTSCs like there is for system calls --- no seccomp filters for RDTSC. That
>could be implemented but would require new kernel APIs. With the right kernel
>APIs though, I think we could make it fast under rr.

Ok Rob, thanks for your opinion on this! I'll find another workaround then.


More information about the rr-dev mailing list