summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/testsupport/testparallel.c
diff options
context:
space:
mode:
authorAlexander Krutwig <alexander.krutwig@embedded-brains.de>2015-03-06 16:13:40 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-06 16:20:20 +0100
commit33b72fde61b3e50be52000e6ed9030225eab4eb0 (patch)
tree2ec76aa6d9a780941478e109fd722d566425a4fe /cpukit/libmisc/testsupport/testparallel.c
parentshell: Add PROFREPORT command (diff)
downloadrtems-33b72fde61b3e50be52000e6ed9030225eab4eb0.tar.bz2
testsupport: Add cascade option to parallel test
Diffstat (limited to 'cpukit/libmisc/testsupport/testparallel.c')
-rw-r--r--cpukit/libmisc/testsupport/testparallel.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/cpukit/libmisc/testsupport/testparallel.c b/cpukit/libmisc/testsupport/testparallel.c
index 681f769124..c1bdeda9f0 100644
--- a/cpukit/libmisc/testsupport/testparallel.c
+++ b/cpukit/libmisc/testsupport/testparallel.c
@@ -44,6 +44,7 @@ static void start_worker_stop_timer(
ctx
);
_Assert(sc == RTEMS_SUCCESSFUL);
+ (void) sc;
}
static void run_tests(
@@ -58,21 +59,31 @@ static void run_tests(
for (i = 0; i < job_count; ++i) {
const rtems_test_parallel_job *job = &jobs[i];
+ size_t n = rtems_get_processor_count();
+ size_t j = job->cascade ? 0 : rtems_get_processor_count() - 1;
- if (rtems_test_parallel_is_master_worker(worker_index)) {
- rtems_interval duration = (*job->init)(ctx, job->arg);
+ while (j < n) {
+ size_t active_worker = j + 1;
- start_worker_stop_timer(ctx, duration);
- }
+ if (rtems_test_parallel_is_master_worker(worker_index)) {
+ rtems_interval duration = (*job->init)(ctx, job->arg, active_worker);
+
+ start_worker_stop_timer(ctx, duration);
+ }
+
+ _SMP_barrier_Wait(&ctx->barrier, &bs, ctx->worker_count);
- _SMP_barrier_Wait(&ctx->barrier, &bs, ctx->worker_count);
+ if (worker_index <= j) {
+ (*job->body)(ctx, job->arg, active_worker, worker_index);
+ }
- (*job->body)(ctx, job->arg, worker_index);
+ _SMP_barrier_Wait(&ctx->barrier, &bs, ctx->worker_count);
- _SMP_barrier_Wait(&ctx->barrier, &bs, ctx->worker_count);
+ if (rtems_test_parallel_is_master_worker(worker_index)) {
+ (*job->fini)(ctx, job->arg, active_worker);
+ }
- if (rtems_test_parallel_is_master_worker(worker_index)) {
- (*job->fini)(ctx, job->arg);
+ ++j;
}
}
}
@@ -91,6 +102,7 @@ static void worker_task(rtems_task_argument arg)
sc = rtems_event_transient_send(warg.ctx->master_id);
_Assert(sc == RTEMS_SUCCESSFUL);
+ (void) sc;
run_tests(warg.ctx, warg.jobs, warg.job_count, warg.worker_index);