Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/14172 )
Change subject: [gutil] introduce CLOCK_MONOTONIC_RAW ...................................................................... [gutil] introduce CLOCK_MONOTONIC_RAW This patch adds an accessor method for the CLOCK_MONOTONIC_RAW clock, named GetMonoTimeMicrosRaw(). This functionality will be used by follow-up changelists which implement built-in Kudu NTP client (one of those is https://gerrit.cloudera.org/#/c/7477). In essence, CLOCK_MONOTONIC_RAW (CLOCK_UPTIME_RAW on Darwin/macOS) is a better clock source than CLOCK_MONOTONIC for NTP-related calculations since CLOCK_MONOTONIC_RAW is not subject to adjustments by adjtime() and the kernel NTP discipline (see [1]). CLOCK_MONOTONIC_RAW clock is marching forward always at the same rate, and that's useful when sampling local clock readings to estimate delays in NTP packet exchange between the client and the servers, especially when counting in the skew of the local clock into the computations. On macOS, GetMonoTimeMicrosRaw() behaves exactly as GetMonoTimeMicros() since both use mach_absolute_time() which isn't affected by clock adjustments. On newer versions of Darwin (16.0+) and macOS (10.12+), GetMonoTimeMicrosRaw() produces the same results as clock_gettime(CLOCK_UPTIME_RAW, ...), see [2]. References: 1. http://man7.org/linux/man-pages/man2/clock_gettime.2.html 2. http://www.manpagez.com/man/3/clock_gettime/ Change-Id: I88c787fe7aee6aa55943cbadfd2be4f43053f6ad Reviewed-on: http://gerrit.cloudera.org:8080/14172 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> --- M src/kudu/gutil/walltime.h 1 file changed, 28 insertions(+), 8 deletions(-) Approvals: Kudu Jenkins: Verified Adar Dembo: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/14172 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I88c787fe7aee6aa55943cbadfd2be4f43053f6ad Gerrit-Change-Number: 14172 Gerrit-PatchSet: 4 Gerrit-Owner: Alexey Serbin <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120)
