aboutsummaryrefslogtreecommitdiff
path: root/test/performance/odp_sched_perf.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/performance/odp_sched_perf.c')
-rw-r--r--test/performance/odp_sched_perf.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c
index fa93aa18d..148bf11d5 100644
--- a/test/performance/odp_sched_perf.c
+++ b/test/performance/odp_sched_perf.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2018, Linaro Limited
- * Copyright (c) 2020, Nokia
+ * Copyright (c) 2020-2021, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -84,8 +84,6 @@ typedef struct test_global_t {
} test_global_t;
-test_global_t test_global;
-
static void print_usage(void)
{
printf("\n"
@@ -906,7 +904,11 @@ static int test_sched(void *arg)
queue = *next;
}
- odp_queue_enq(queue, ev[0]);
+ if (odp_queue_enq(queue, ev[0])) {
+ printf("Error: Queue enqueue failed\n");
+ odp_event_free(ev[0]);
+ ret = -1;
+ }
}
return ret;
@@ -1081,17 +1083,18 @@ static void print_stat(test_global_t *global)
int main(int argc, char **argv)
{
+ odph_helper_options_t helper_options;
odp_instance_t instance;
odp_init_t init;
+ odp_shm_t shm;
test_global_t *global;
- global = &test_global;
- memset(global, 0, sizeof(test_global_t));
- global->pool = ODP_POOL_INVALID;
- global->ctx_shm = ODP_SHM_INVALID;
-
- if (parse_options(argc, argv, &global->test_options))
- return -1;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */
+ argc = odph_parse_options(argc, argv);
+ if (odph_options(&helper_options)) {
+ ODPH_ERR("Error: Reading ODP helper options failed.\n");
+ exit(EXIT_FAILURE);
+ }
/* List features not to be used */
odp_init_param_init(&init);
@@ -1102,6 +1105,8 @@ int main(int argc, char **argv)
init.not_used.feat.timer = 1;
init.not_used.feat.tm = 1;
+ init.mem_model = helper_options.mem_model;
+
/* Init ODP before calling anything else */
if (odp_init_global(&instance, &init, NULL)) {
printf("Error: Global init failed.\n");
@@ -1114,6 +1119,25 @@ int main(int argc, char **argv)
return -1;
}
+ shm = odp_shm_reserve("sched_perf_global", sizeof(test_global_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) {
+ ODPH_ERR("Error: SHM reserve failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ global = odp_shm_addr(shm);
+ if (global == NULL) {
+ ODPH_ERR("Error: SHM alloc failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ memset(global, 0, sizeof(test_global_t));
+ global->pool = ODP_POOL_INVALID;
+ global->ctx_shm = ODP_SHM_INVALID;
+
+ if (parse_options(argc, argv, &global->test_options))
+ return -1;
+
odp_sys_info_print();
if (global->test_options.ctx_size) {
@@ -1166,6 +1190,11 @@ int main(int argc, char **argv)
if (global->ctx_shm != ODP_SHM_INVALID)
odp_shm_free(global->ctx_shm);
+ if (odp_shm_free(shm)) {
+ ODPH_ERR("Error: SHM free failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
if (odp_term_local()) {
printf("Error: term local failed.\n");
return -1;