diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-07-09 13:17:18 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-07-09 13:57:03 +0200 |
commit | bc2ba9a9cdc7381c2a4f2ae6ee303be636f31368 (patch) | |
tree | 0cac920d072b342b2b32410868757054cb528dbc /testsuite | |
parent | test/epoch01: Simplify (diff) | |
download | rtems-libbsd-bc2ba9a9cdc7381c2a4f2ae6ee303be636f31368.tar.bz2 |
EPOCH(9): Add epoch_drain_callbacks()
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/epoch01/test_main.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/epoch01/test_main.c b/testsuite/epoch01/test_main.c index 7088a126..b72431de 100644 --- a/testsuite/epoch01/test_main.c +++ b/testsuite/epoch01/test_main.c @@ -357,6 +357,51 @@ test_enter_list_op_exit_preempt_fini(rtems_test_parallel_context *base, } static void +test_enter_list_op_exit_drain_body(rtems_test_parallel_context *base, + void *arg, size_t active_workers, size_t worker_index) +{ + test_context *ctx; + epoch_t e; + uint32_t counter; + uint32_t removals; + uint32_t item_counter[CPU_COUNT]; + + ctx = (test_context *)base; + e = global_epoch; + counter = 0; + removals = 0; + memset(item_counter, 0, sizeof(item_counter)); + + while (!rtems_test_parallel_stop_job(&ctx->base)) { + test_item *rm; + + epoch_enter(e); + ++counter; + rm = test_remove_item(ctx, item_counter, &removals, + worker_index); + epoch_exit(e); + + if (rm != NULL) { + epoch_call(e, &rm->ec, test_list_callback); + epoch_drain_callbacks(e); + } + } + + ctx->stats.counter[worker_index] = counter; + ctx->stats.removals[worker_index] = removals; + memcpy(ctx->stats.item_counter[worker_index], item_counter, + sizeof(ctx->stats.item_counter[worker_index])); +} + +static void +test_enter_list_op_exit_drain_fini(rtems_test_parallel_context *base, + void *arg, size_t active_workers) +{ + + test_fini(base, "EnterListOpExitDrain", active_workers); +} + +static void test_thread_local_mutex_body(rtems_test_parallel_context *base, void *arg, size_t active_workers, size_t worker_index) { @@ -443,6 +488,11 @@ static const rtems_test_parallel_job test_jobs[] = { .fini = test_enter_list_op_exit_preempt_fini, .cascade = true }, { + .init = test_list_init, + .body = test_enter_list_op_exit_drain_body, + .fini = test_enter_list_op_exit_drain_fini, + .cascade = true + }, { .init = test_init, .body = test_thread_local_mutex_body, .fini = test_thread_local_mutex_fini, |