diff options
author | Burt P <pburt0@gmail.com> | 2017-12-17 08:56:46 -0600 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-02-27 07:41:51 -0800 |
commit | c8785521f39c3a86454ade890018ca021272c621 (patch) | |
tree | 4df2fa40ca918cb26460d07939136bef6a63ef13 /modules/benchmark/fib.c | |
parent | 8fb9ed49987ca006495891f04e5250496d6e00f4 (diff) |
Benchmark results: store threads used
Benchmark results store actual number of threads used by benchmark
when it was run. Previously, results assumed all available threads
were used.
Examples:
* CPU Fib only uses one
* FPU FFT uses 4, 2, or 1
* N-Queens uses 10, 5, 2, or 1
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/benchmark/fib.c')
-rw-r--r-- | modules/benchmark/fib.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/benchmark/fib.c b/modules/benchmark/fib.c index 0f88be59..d75ac367 100644 --- a/modules/benchmark/fib.c +++ b/modules/benchmark/fib.c @@ -18,8 +18,7 @@ #include "benchmark.h" -static gulong -fib(gulong n) +gulong fib(gulong n) { if (n == 0) return 0; @@ -32,19 +31,22 @@ void benchmark_fib(void) { GTimer *timer = g_timer_new(); - gdouble elapsed; - + bench_value r = EMPTY_BENCH_VALUE; + shell_view_set_enabled(FALSE); shell_status_update("Calculating the 42nd Fibonacci number..."); - + g_timer_reset(timer); g_timer_start(timer); fib(42); - + g_timer_stop(timer); - elapsed = g_timer_elapsed(timer, NULL); + r.elapsed_time = g_timer_elapsed(timer, NULL); g_timer_destroy(timer); - - bench_results[BENCHMARK_FIB] = elapsed; + + r.threads_used = 1; + r.result = r.elapsed_time; + + bench_results[BENCHMARK_FIB] = r; } |