aboutsummaryrefslogtreecommitdiff
path: root/modules/benchmark/zlib.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-12-17 08:56:46 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-02-27 07:41:51 -0800
commitc8785521f39c3a86454ade890018ca021272c621 (patch)
tree4df2fa40ca918cb26460d07939136bef6a63ef13 /modules/benchmark/zlib.c
parent8fb9ed49987ca006495891f04e5250496d6e00f4 (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/zlib.c')
-rw-r--r--modules/benchmark/zlib.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/modules/benchmark/zlib.c b/modules/benchmark/zlib.c
index eeec9d0e..2ded59a4 100644
--- a/modules/benchmark/zlib.c
+++ b/modules/benchmark/zlib.c
@@ -31,8 +31,8 @@ static gpointer zlib_for(unsigned int start, unsigned int end, void *data, gint
compressed = malloc(bound);
if (!compressed)
return NULL;
-
- for (i = start; i <= end; i++) {
+
+ for (i = start; i <= end; i++) {
char uncompressed[65536];
uLong compressedBound = bound;
uLong destBound = sizeof(uncompressed);
@@ -42,30 +42,32 @@ static gpointer zlib_for(unsigned int start, unsigned int end, void *data, gint
}
free(compressed);
-
+
return NULL;
}
void
benchmark_zlib(void)
{
- gdouble elapsed = 0;
+ bench_value r = EMPTY_BENCH_VALUE;
gchar *tmpsrc, *bdata_path;
-
+
bdata_path = g_build_filename(params.path_data, "benchmark.data", NULL);
if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) {
g_free(bdata_path);
return;
- }
-
+ }
+
shell_view_set_enabled(FALSE);
shell_status_update("Running Zlib benchmark...");
-
- elapsed = benchmark_parallel_for(0, 50000, zlib_for, tmpsrc);
-
+
+ r = benchmark_parallel_for(0, 0, 50000, zlib_for, tmpsrc);
+
g_free(bdata_path);
g_free(tmpsrc);
- gdouble marks = (50000. * 65536.) / (elapsed * 840205128.);
- bench_results[BENCHMARK_ZLIB] = marks;
+ //TODO: explain in code comments
+ gdouble marks = (50000. * 65536.) / (r.elapsed_time * 840205128.);
+ r.result = marks;
+ bench_results[BENCHMARK_ZLIB] = r;
}