#include <stdlib.h>
#include <math.h>
#include <assert.h>
-#include <time.h>
-#include <sys/time.h>
+#include "benchmark.h"
#include "idct.h"
// Generate random coefficients in the range [-15..15].
quant[i] = 1;
}
- struct timeval start, now;
- gettimeofday(&start, NULL);
+ start_benchmark_timer();
for (unsigned i = 0; i < num_runs; ++i) {
(*idct)(coeff, quant, output);
}
- gettimeofday(&now, NULL);
-
- double diff = timediff(&start, &now);
- printf("%u runs in %.2f seconds = %.2f IDCTs/sec\n",
+ double diff = stop_benchmark_timer();
+ printf("%u runs in %.2f CPU seconds = %.2f IDCTs/sec\n",
num_runs, diff, num_runs / diff);
}