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/fft.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/fft.c')
-rw-r--r-- | modules/benchmark/fft.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/modules/benchmark/fft.c b/modules/benchmark/fft.c index 7c5889c8..caa52d3d 100644 --- a/modules/benchmark/fft.c +++ b/modules/benchmark/fft.c @@ -25,43 +25,43 @@ static gpointer fft_for(unsigned int start, unsigned int end, void *data, gint t unsigned int i; FFTBench **benches = (FFTBench **)data; FFTBench *fftbench = (FFTBench *)(benches[thread_number]); - - for (i = start; i <= end; i++) { + + for (i = start; i <= end; i++) { fft_bench_run(fftbench); } - + return NULL; } +#define FFT_MAXT 4 + void benchmark_fft(void) { - gdouble elapsed = 0; + bench_value r = EMPTY_BENCH_VALUE; + int n_cores, i; gchar *temp; FFTBench **benches; - + shell_view_set_enabled(FALSE); shell_status_update("Running FFT benchmark..."); - + /* Pre-allocate all benchmarks */ - temp = module_call_method("devices::getProcessorCount"); - n_cores = temp ? atoi(temp) : 1; - g_free(temp); - - benches = g_new0(FFTBench *, n_cores); - for (i = 0; i < n_cores; i++) { + benches = g_new0(FFTBench *, FFT_MAXT); + for (i = 0; i < FFT_MAXT; i++) { benches[i] = fft_bench_new(); } - + /* Run the benchmark */ - elapsed = benchmark_parallel_for(0, 4, fft_for, benches); - + r = benchmark_parallel_for(FFT_MAXT, 0, FFT_MAXT, fft_for, benches); + /* Free up the memory */ - for (i = 0; i < n_cores; i++) { + for (i = 0; i < FFT_MAXT; i++) { fft_bench_free(benches[i]); } g_free(benches); - - bench_results[BENCHMARK_FFT] = elapsed; + + r.result = r.elapsed_time; + bench_results[BENCHMARK_FFT] = r; } |