You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use of CLOCK_MONOTONIC_COARSE is supported on Linux and FreeBSD, but is an extension to POSIX from what I can tell with 1ms resolution and uses the VDSO library to avoid kernel calls.
Given the extension only needs millisecond resolution it doesn't diminish the accuracy using the faster coarse grained clock.
So a portability #ifndef will undoubtedly be required to fall back to CLOCK_MONOTIC on systems that don't define the coarse clock.
The text was updated successfully, but these errors were encountered:
Consider use of
clock_gettime(CLOCK_MONOTONIC_COARSE, &ns)
which may provide a lower overhead clock vsgettimeofday()
.This Stack overflow answer provides some indicative cycle counts:
The use of CLOCK_MONOTONIC_COARSE is supported on Linux and FreeBSD, but is an extension to POSIX from what I can tell with 1ms resolution and uses the VDSO library to avoid kernel calls.
Given the extension only needs millisecond resolution it doesn't diminish the accuracy using the faster coarse grained clock.
So a portability
#ifndef
will undoubtedly be required to fall back to CLOCK_MONOTIC on systems that don't define the coarse clock.The text was updated successfully, but these errors were encountered: