if (GET_FLAG(INSANITY, prefs->flags) < timer->insanity)
return;
- clock_gettime(CLOCK_MONOTONIC_RAW, &timer->start_time);
+ clock_gettime(CLOCK_BENCH, &timer->start_time);
}
void timer_stop(struct bench *prefs, struct timer *timer,
else
start_time = *start;
- clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
+ clock_gettime(CLOCK_BENCH, &end_time);
//Get elapsed time by subtracting start time from end time.
//Subtraction can result to a negative value, so we check for both cases
reseed:
//We proceed to initialise the global_id, and seed variables.
if (seed == -1) {
- clock_gettime(CLOCK_MONOTONIC_RAW, &timer_seed);
+ clock_gettime(CLOCK_BENCH, &timer_seed);
seed = timer_seed.tv_nsec;
} else {
set_by_hand = 1;
#include <bench-lfsr.h>
+/*
+ * If CLOCK_MONOTONIC_RAW is not defined in our system, use CLOCK_MONOTONIC
+ * instead. CLOCK_MONOTONIC_RAW is preferred since we are guaranteed that the
+ * clock won't skew.
+ */
+#ifdef CLOCK_MONOTONIC_RAW
+#define CLOCK_BENCH CLOCK_MONOTONIC_RAW
+#else
+#define CLOCK_BENCH CLOCK_MONOTONIC
+#endif
+
+
#define MAX_ARG_LEN 10
/*