aboutsummaryrefslogtreecommitdiff
path: root/includes/benchmark.h
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-12-23 08:22:46 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-02-27 07:41:51 -0800
commit6a9f6819ae661f64c3c042d48f74d6419f63580e (patch)
treecf7e9a1dd37d260e20a4bbc10c8f21d6792bd195 /includes/benchmark.h
parente925b1b60e37040048c150e272dce181cdce8454 (diff)
Fix benchmark_parallel_for() to use correct number of threads
If (end - start) / threads left a remainder, benchmark_parallel_for() would start an extra thread for the leftover elements. Now, it has the last thread process the few extra elements. Added a note: benchmark_parallel_for(): element [start] included, but [end] is excluded. callback(): expected to processes elements [start] through [end] inclusive. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'includes/benchmark.h')
-rw-r--r--includes/benchmark.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/includes/benchmark.h b/includes/benchmark.h
index fa4ad0cf..277f0c07 100644
--- a/includes/benchmark.h
+++ b/includes/benchmark.h
@@ -38,6 +38,10 @@ typedef struct {
char *bench_value_to_str(bench_value r);
bench_value bench_value_from_str(const char* str);
+/* Note:
+ * benchmark_parallel_for(): element [start] included, but [end] is excluded.
+ * callback(): expected to processes elements [start] through [end] inclusive.
+ */
bench_value benchmark_parallel_for(gint n_threads, guint start, guint end,
gpointer callback, gpointer callback_data);