aboutsummaryrefslogtreecommitdiff
path: root/modules/benchmark/nqueens.c
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2018-02-27 22:34:49 -0600
committerSimon Quigley <tsimonq2@ubuntu.com>2018-02-27 22:34:49 -0600
commit00831e690c4581ee8f0f92902ebdb75304bde817 (patch)
tree55a37b9cc5d60ad047631ffb39d2f822a22d6d39 /modules/benchmark/nqueens.c
parentd95f107ef2b9e82c341060be0def97d7bfa430b9 (diff)
parent09fcc751ef158898c315ebc9299a0fa3a722d914 (diff)
Update upstream source from tag 'upstream/0.5.1+git20180227'
Update to upstream version '0.5.1+git20180227' with Debian dir 7ca675e2ccb4367b7cc5b255a36b5173afaf9d2c
Diffstat (limited to 'modules/benchmark/nqueens.c')
-rw-r--r--modules/benchmark/nqueens.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/benchmark/nqueens.c b/modules/benchmark/nqueens.c
index a32ed8c1..78293abb 100644
--- a/modules/benchmark/nqueens.c
+++ b/modules/benchmark/nqueens.c
@@ -25,7 +25,7 @@ bool safe(int x, int y)
int nqueens(int y)
{
int x;
-
+
for (x = 0; x < QUEENS; x++) {
if (safe((row[y - 1] = x), y - 1)) {
if (y < QUEENS) {
@@ -35,32 +35,33 @@ int nqueens(int y)
}
}
}
-
+
return 0;
}
static gpointer nqueens_for(unsigned int start, unsigned int end, void *data, gint thread_number)
{
unsigned int i;
-
- for (i = start; i <= end; i++) {
+
+ for (i = start; i <= end; i++) {
nqueens(0);
}
-
+
return NULL;
}
void
benchmark_nqueens(void)
{
- gdouble elapsed = 0;
-
+ bench_value r = EMPTY_BENCH_VALUE;
+
shell_view_set_enabled(FALSE);
shell_status_update("Running N-Queens benchmark...");
-
- elapsed = benchmark_parallel_for(0, 10, nqueens_for, NULL);
-
- bench_results[BENCHMARK_NQUEENS] = elapsed;
+
+ r = benchmark_parallel_for(0, 0, 10, nqueens_for, NULL);
+ r.result = r.elapsed_time;
+
+ bench_results[BENCHMARK_NQUEENS] = r;
}