}
if (print) {
- printf("Reads: %d operations, %f average latency\n",
+ printf("read: [%d, %f]\n",
read_count, read_time / 1e9 / read_count);
- printf("Writes: %d operations, %f average latency\n",
+ printf("write: [%d, %f]\n",
write_count, write_time / 1e9 / write_count);
+ printf("\n");
}
}
launch_thread(i);
}
- /* Warm up phase: run for half the time but do not keep statistics */
- sleep_micros(opt_duration * 1000000 / 2);
- reset_stats(1);
-
- /* Benchmark phase: run for half the time and print summary */
- sleep_micros(opt_duration * 1000000 / 2);
- reset_stats(1);
+ for (int i = 0; i < 4; i++) {
+ sleep_micros(opt_duration * 1000000 / 4);
+ reset_stats(1);
+ }
return 0;
}