* Threads
* Benchmark duration (seconds)
* Target operations per second (aggregate across all threads)
+ * Interval count (how many times to report results during the run)
*/
#include <errno.h>
#include <unistd.h>
#include <math.h>
-int opt_filesize, opt_filecount, opt_threads, opt_duration;
+int opt_filesize, opt_filecount, opt_threads, opt_duration, opt_intervals;
double opt_writeratio, opt_ops;
struct thread_state {
write_count / duration, write_time / write_count,
stddev(write_time, write_time2, write_count));
printf("\n");
+ fflush(stdout);
}
}
int main(int argc, char *argv[])
{
- if (argc != 7) {
+ if (argc != 8) {
fprintf(stderr, "Usage: TODO\n");
return 1;
}
opt_threads = atoi(argv[4]);
opt_duration = atoi(argv[5]);
opt_ops = atof(argv[6]);
+ opt_intervals = atoi(argv[7]);
srandom(time(NULL));
launch_thread(i);
}
- for (int i = 0; i < 4; i++) {
- sleep_micros(opt_duration * 1000000 / 4);
- reset_stats(1, opt_duration / 4.0);
+ for (int i = 0; i < opt_intervals; i++) {
+ sleep_micros(opt_duration * 1000000 / opt_intervals);
+ reset_stats(1, (double)opt_duration / opt_intervals);
}
return 0;