#include <unistd.h>
#include <math.h>
#include <sys/time.h>
+#include <time.h>
#include "fio.h"
#include "smalloc.h"
case CS_CGETTIME: {
struct timespec ts;
+#ifdef FIO_HAVE_CLOCK_MONOTONIC
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
+#else
if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
+#endif
log_err("fio: clock_gettime fails\n");
assert(0);
}
for (i = 0; i < 10; i++) {
double this = cycles[i];
- if ((max(this, mean) - min(this, mean)) > S)
+ if ((fmax(this, mean) - fmin(this, mean)) > S)
continue;
samples++;
avg += this;