From: Michael Vrable Date: Sun, 13 Feb 2011 20:57:13 +0000 (-0800) Subject: Allow interval at which benchmark results are printed to be controlled. X-Git-Url: http://git.vrable.net/?p=bluesky.git;a=commitdiff_plain;h=edc01a621f0e7f300125a8906102062392feab25 Allow interval at which benchmark results are printed to be controlled. --- diff --git a/microbench/mixedbench.c b/microbench/mixedbench.c index 81e63cf..1093a96 100644 --- a/microbench/mixedbench.c +++ b/microbench/mixedbench.c @@ -9,6 +9,7 @@ * Threads * Benchmark duration (seconds) * Target operations per second (aggregate across all threads) + * Interval count (how many times to report results during the run) */ #include @@ -24,7 +25,7 @@ #include #include -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 { @@ -203,12 +204,13 @@ void reset_stats(int print, double duration) 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; } @@ -219,6 +221,7 @@ int main(int argc, char *argv[]) opt_threads = atoi(argv[4]); opt_duration = atoi(argv[5]); opt_ops = atof(argv[6]); + opt_intervals = atoi(argv[7]); srandom(time(NULL)); @@ -228,9 +231,9 @@ int main(int argc, char *argv[]) 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; diff --git a/microbench/setup/run-benchmark b/microbench/setup/run-benchmark index bf0bc9e..2942f48 100755 --- a/microbench/setup/run-benchmark +++ b/microbench/setup/run-benchmark @@ -13,6 +13,7 @@ BENCH_WRITERATIO=1.0 BENCH_THREADS=8 BENCH_DURATION=120 BENCH_OPS=100 +BENCH_INTERVALS=4 # Export any environment variables specified on the command line for e in "$@"; do @@ -41,7 +42,8 @@ done $BENCH_WRITERATIO \ $BENCH_THREADS \ $BENCH_DURATION \ - $BENCH_OPS + $BENCH_OPS \ + $BENCH_INTERVALS popd >/dev/null