소스 검색

The CLOCK_MONOTONIC_RAW clock is not subject to NTP adjustments, but is not
available on all systems. In that case we use the CLOCK_MONOTONIC clock
instead.

Cédric Augonnet 15 년 전
부모
커밋
e211a14276
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      src/common/timing.h

+ 9 - 0
src/common/timing.h

@@ -44,7 +44,16 @@ typedef struct starpu_tick_s
 {
 	struct timespec ts;
 } starpu_tick_t;
+
+/* Modern CPUs' clocks are usually not synchronized so we use a monotonic clock
+ * to have consistent timing measurements. The CLOCK_MONOTONIC_RAW clock is not
+ * subject to NTP adjustments, but is not available on all systems (in that
+ * case we use the CLOCK_MONOTONIC clock instead). */
+#ifndef CLOCK_MONOTONIC_RAW
+#define STARPU_GET_TICK(t) clock_gettime(CLOCK_MONOTONIC_RAW, &((t).ts))
+#else
 #define STARPU_GET_TICK(t) clock_gettime(CLOCK_MONOTONIC, &((t).ts))
+#endif
 
 #else // !STARPU_HAVE_CLOCK_GETTIME