Signed-off-by: Jens Axboe <axboe@fb.com>
#ifndef FIO_TIME_H
#define FIO_TIME_H
#ifndef FIO_TIME_H
#define FIO_TIME_H
extern uint64_t utime_since(struct timeval *, struct timeval *);
extern uint64_t utime_since_now(struct timeval *);
extern uint64_t mtime_since(struct timeval *, struct timeval *);
extern uint64_t utime_since(struct timeval *, struct timeval *);
extern uint64_t utime_since_now(struct timeval *);
extern uint64_t mtime_since(struct timeval *, struct timeval *);
#include <sys/stat.h>
#include "../lib/lfsr.h"
#include <sys/stat.h>
#include "../lib/lfsr.h"
+#include "../gettime.h"
+#include "../fio_time.h"
int main(int argc, char *argv[])
{
int r;
int main(int argc, char *argv[])
{
int r;
- struct timespec start, end;
+ struct timeval start, end;
struct fio_lfsr *fl;
int verify = 0;
unsigned int spin = 0;
struct fio_lfsr *fl;
int verify = 0;
unsigned int spin = 0;
}
/* Calculate elapsed time and mean time per number */
}
/* Calculate elapsed time and mean time per number */
- total = (end.tv_sec - start.tv_sec) * pow(10,9) +
- end.tv_nsec - start.tv_nsec;
+ total = utime_since(&start, &end);
mean = total / fl->num_vals;
printf("\nTime results ");
mean = total / fl->num_vals;
printf("\nTime results ");
printf("(slower due to verification)");
printf("\n==============================\n");
printf("Elapsed: %lf s\n", total / pow(10,9));
printf("(slower due to verification)");
printf("\n==============================\n");
printf("Elapsed: %lf s\n", total / pow(10,9));
- printf("Mean: %lf ns\n", mean);
+ printf("Mean: %lf us\n", mean);