From c8785521f39c3a86454ade890018ca021272c621 Mon Sep 17 00:00:00 2001 From: Burt P Date: Sun, 17 Dec 2017 08:56:46 -0600 Subject: 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 --- modules/benchmark/fft.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'modules/benchmark/fft.c') 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; } -- cgit v1.2.3