aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorJere Leppänen <jere.leppanen@nokia.com>2023-09-06 13:56:04 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2023-10-10 15:35:23 +0300
commit56a348218f820a541f3a8a5f60c6b74ee4449355 (patch)
tree3f1f03410a0f2d29fd3b16a2e0fb6c4ac991c5b9 /example
parent21b9c3703f5d198c67d12648eca662042f49964a (diff)
example: timer_accuracy: add queue sync type option
Add an option (-t, --queue_type) to set the queue sync type. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'example')
-rw-r--r--example/timer/odp_timer_accuracy.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/example/timer/odp_timer_accuracy.c b/example/timer/odp_timer_accuracy.c
index fd46d64b8..a862aa320 100644
--- a/example/timer/odp_timer_accuracy.c
+++ b/example/timer/odp_timer_accuracy.c
@@ -45,6 +45,7 @@ typedef struct test_opt_t {
unsigned long long multiplier;
enum mode_e mode;
int clk_src;
+ odp_queue_type_t queue_type;
int init;
int output;
int early_retry;
@@ -152,6 +153,10 @@ static void print_usage(void)
" -s, --clk_src Clock source select (default 0):\n"
" 0: ODP_CLOCK_DEFAULT\n"
" 1: ODP_CLOCK_SRC_1, ...\n"
+ " -t, --queue_type Queue sync type. Default is 0 (PARALLEL).\n"
+ " 0: PARALLEL\n"
+ " 1: ATOMIC\n"
+ " 2: ORDERED\n"
" -i, --init Set global init parameters. Default: init params not set.\n"
" -h, --help Display help and exit.\n\n");
}
@@ -176,11 +181,12 @@ static int parse_options(int argc, char *argv[], test_opt_t *test_opt)
{"output", required_argument, NULL, 'o'},
{"early_retry", required_argument, NULL, 'e'},
{"clk_src", required_argument, NULL, 's'},
+ {"queue_type", required_argument, NULL, 't'},
{"init", no_argument, NULL, 'i'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
- const char *shortopts = "+c:p:r:R:f:x:n:w:b:g:m:P:M:o:e:s:ih";
+ const char *shortopts = "+c:p:r:R:f:x:n:w:b:g:m:P:M:o:e:s:t:ih";
int ret = 0;
memset(test_opt, 0, sizeof(*test_opt));
@@ -201,6 +207,7 @@ static int parse_options(int argc, char *argv[], test_opt_t *test_opt)
test_opt->max_multiplier = 1;
test_opt->multiplier = 1;
test_opt->clk_src = ODP_CLOCK_DEFAULT;
+ test_opt->queue_type = ODP_SCHED_SYNC_PARALLEL;
test_opt->init = 0;
test_opt->output = 0;
test_opt->early_retry = 0;
@@ -264,6 +271,19 @@ static int parse_options(int argc, char *argv[], test_opt_t *test_opt)
case 's':
test_opt->clk_src = atoi(optarg);
break;
+ case 't':
+ switch (atoi(optarg)) {
+ case 1:
+ test_opt->queue_type = ODP_SCHED_SYNC_ATOMIC;
+ break;
+ case 2:
+ test_opt->queue_type = ODP_SCHED_SYNC_ORDERED;
+ break;
+ default:
+ test_opt->queue_type = ODP_SCHED_SYNC_PARALLEL;
+ break;
+ }
+ break;
case 'i':
test_opt->init = 1;
break;
@@ -513,7 +533,7 @@ static int create_timers(test_global_t *test_global)
odp_queue_param_init(&queue_param);
queue_param.type = ODP_QUEUE_TYPE_SCHED;
queue_param.sched.prio = odp_schedule_default_prio();
- queue_param.sched.sync = ODP_SCHED_SYNC_PARALLEL;
+ queue_param.sched.sync = test_global->opt.queue_type;
queue_param.sched.group = ODP_SCHED_GROUP_ALL;
queue = odp_queue_create("timeout_queue", &queue_param);
@@ -564,6 +584,7 @@ static int create_timers(test_global_t *test_global)
printf(" clock source: %i\n", clk_src);
printf(" max timers capa: %" PRIu32 "\n", max_timers);
printf(" mode: %i\n", mode);
+ printf(" queue type: %i\n", test_global->opt.queue_type);
odp_timer_pool_param_init(&timer_param);