aboutsummaryrefslogtreecommitdiff
path: root/test/performance
diff options
context:
space:
mode:
Diffstat (limited to 'test/performance')
-rw-r--r--test/performance/odp_atomic_perf.c4
-rw-r--r--test/performance/odp_bench_packet.c29
-rw-r--r--test/performance/odp_cpu_bench.c36
-rw-r--r--test/performance/odp_crypto.c28
-rw-r--r--test/performance/odp_ipsec.c44
-rw-r--r--test/performance/odp_l2fwd.c37
-rw-r--r--test/performance/odp_mem_perf.c4
-rw-r--r--test/performance/odp_packet_gen.c5
-rw-r--r--test/performance/odp_pktio_ordered.c33
-rw-r--r--test/performance/odp_pktio_perf.c50
-rw-r--r--test/performance/odp_pool_perf.c27
-rw-r--r--test/performance/odp_queue_perf.c27
-rw-r--r--test/performance/odp_sched_latency.c26
-rw-r--r--test/performance/odp_sched_perf.c10
-rw-r--r--test/performance/odp_sched_pktio.c51
-rw-r--r--test/performance/odp_scheduling.c12
-rw-r--r--test/performance/odp_timer_perf.c5
17 files changed, 257 insertions, 171 deletions
diff --git a/test/performance/odp_atomic_perf.c b/test/performance/odp_atomic_perf.c
index b56135c35..ee760babf 100644
--- a/test/performance/odp_atomic_perf.c
+++ b/test/performance/odp_atomic_perf.c
@@ -1076,11 +1076,10 @@ static int start_workers(test_global_t *global, odp_instance_t instance,
int num_cpu = test_options->num_cpu;
odph_thread_param_t thr_param[num_cpu];
- memset(&param, 0, sizeof(odph_thread_common_param_t));
+ odph_thread_common_param_init(&param);
param.instance = instance;
param.cpumask = &global->cpumask;
- memset(thr_param, 0, sizeof(thr_param));
for (i = 0; i < num_cpu; i++) {
test_thread_ctx_t *thread_ctx = &global->thread_ctx[i];
@@ -1089,6 +1088,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance,
thread_ctx->func = func;
thread_ctx->type = type;
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].thr_type = ODP_THREAD_WORKER;
thr_param[i].start = run_test;
thr_param[i].arg = thread_ctx;
diff --git a/test/performance/odp_bench_packet.c b/test/performance/odp_bench_packet.c
index e80e823f6..0354ef9b8 100644
--- a/test/performance/odp_bench_packet.c
+++ b/test/performance/odp_bench_packet.c
@@ -1739,7 +1739,9 @@ bench_info_t test_suite[] = {
int main(int argc, char *argv[])
{
odph_helper_options_t helper_options;
- odph_odpthread_t worker_thread;
+ odph_thread_t worker_thread;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
int cpu;
odp_shm_t shm;
odp_cpumask_t cpumask;
@@ -1864,7 +1866,7 @@ int main(int argc, char *argv[])
odp_pool_print(gbl_args->pool);
- memset(&worker_thread, 0, sizeof(odph_odpthread_t));
+ memset(&worker_thread, 0, sizeof(odph_thread_t));
signal(SIGINT, sig_handler);
@@ -1872,20 +1874,23 @@ int main(int argc, char *argv[])
cpu = odp_cpumask_first(&cpumask);
odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_benchmarks;
- thr_params.arg = gbl_args;
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
odp_cpumask_zero(&thd_mask);
odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&worker_thread, &thd_mask,
- &thr_params);
- odph_odpthreads_join(&worker_thread);
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &thd_mask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_benchmarks;
+ thr_param.arg = gbl_args;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(&worker_thread, &thr_common, &thr_param, 1);
+
+ odph_thread_join(&worker_thread, 1);
ret = gbl_args->bench_failed;
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c
index a4999ae27..e0ac82846 100644
--- a/test/performance/odp_cpu_bench.c
+++ b/test/performance/odp_cpu_bench.c
@@ -521,7 +521,9 @@ int main(int argc, char *argv[])
{
stats_t *stats[MAX_WORKERS];
odph_helper_options_t helper_options;
- odph_odpthread_t thread_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
odp_cpumask_t cpumask;
odp_pool_capability_t pool_capa;
odp_pool_t pool;
@@ -540,7 +542,6 @@ int main(int argc, char *argv[])
uint32_t init_val;
unsigned int num_workers;
unsigned int i, j;
- int cpu;
int ret = 0;
/* Let helper collect its own arguments (e.g. --odph_proc) */
@@ -743,7 +744,6 @@ int main(int argc, char *argv[])
}
}
- memset(thread_tbl, 0, sizeof(thread_tbl));
odp_barrier_init(&gbl_args->init_barrier, num_workers + 1);
odp_barrier_init(&gbl_args->term_barrier, num_workers + 1);
@@ -762,34 +762,28 @@ int main(int argc, char *argv[])
}
/* Create worker threads */
- cpu = odp_cpumask_first(&cpumask);
- for (i = 0; i < num_workers; i++) {
- odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ for (i = 0; i < num_workers; i++) {
gbl_args->thread[i].idx = i;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_thread;
- thr_params.arg = &gbl_args->thread[i];
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
-
stats[i] = &gbl_args->thread[i].stats;
- odp_cpumask_zero(&thd_mask);
- odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&thread_tbl[i], &thd_mask,
- &thr_params);
- cpu = odp_cpumask_next(&cpumask, cpu);
+ odph_thread_param_init(&thr_param[i]);
+ thr_param[i].start = run_thread;
+ thr_param[i].arg = &gbl_args->thread[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, thr_param, num_workers);
+
ret = print_stats(num_workers, stats, gbl_args->appl.time,
gbl_args->appl.accuracy);
/* Master thread waits for other threads to exit */
- for (i = 0; i < num_workers; ++i)
- odph_odpthreads_join(&thread_tbl[i]);
+ odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < num_groups; i++) {
for (j = 0; j < QUEUES_PER_GROUP; j++) {
diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index 36324622a..4f81dab17 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -1032,7 +1032,9 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
int num_workers = 1;
odph_helper_options_t helper_options;
- odph_odpthread_t thr[num_workers];
+ odph_thread_t thread_tbl[num_workers];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_instance_t instance;
odp_init_t init_param;
odp_pool_capability_t pool_capa;
@@ -1146,24 +1148,26 @@ int main(int argc, char *argv[])
printf("Run in sync mode\n");
}
- memset(thr, 0, sizeof(thr));
-
test_run_arg.crypto_args = cargs;
test_run_arg.crypto_alg_config = cargs.alg_config;
test_run_arg.crypto_capa = crypto_capa;
if (cargs.alg_config) {
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_thr_func;
- thr_params.arg = &test_run_arg;
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
if (cargs.schedule) {
- odph_odpthreads_create(&thr[0], &cpumask, &thr_params);
- odph_odpthreads_join(&thr[0]);
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thr_func;
+ thr_param.arg = &test_run_arg;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
+
+ odph_thread_join(thread_tbl, num_workers);
} else {
run_measure_one_config(&test_run_arg);
}
diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c
index 05a22ff0d..04788995e 100644
--- a/test/performance/odp_ipsec.c
+++ b/test/performance/odp_ipsec.c
@@ -1027,9 +1027,12 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
int num_workers = 1;
odph_helper_options_t helper_options;
- odph_odpthread_t thr[num_workers];
+ odph_thread_t thread_tbl[num_workers];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_instance_t instance;
odp_init_t init_param;
+ odp_ipsec_capability_t ipsec_capa;
odp_pool_capability_t capa;
odp_ipsec_config_t config;
uint32_t max_seg_len;
@@ -1092,6 +1095,21 @@ int main(int argc, char *argv[])
}
odp_pool_print(pool);
+ if (odp_ipsec_capability(&ipsec_capa) < 0) {
+ app_err("IPSEC capability call failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (cargs.schedule && !ipsec_capa.queue_type_sched) {
+ app_err("Scheduled type destination queue not supported.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (cargs.poll && !ipsec_capa.queue_type_plain) {
+ app_err("Plain type destination queue not supported.\n");
+ exit(EXIT_FAILURE);
+ }
+
odp_ipsec_config_init(&config);
config.max_num_sa = 2;
config.inbound.chksums.all_chksum = 0;
@@ -1148,20 +1166,22 @@ int main(int argc, char *argv[])
printf("Run in sync mode\n");
}
- memset(thr, 0, sizeof(thr));
-
if (cargs.alg_config) {
- odph_odpthread_params_t thr_param;
-
- memset(&thr_param, 0, sizeof(thr_param));
- thr_param.start = run_thr_func;
- thr_param.arg = &thr_arg;
- thr_param.thr_type = ODP_THREAD_WORKER;
- thr_param.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
if (cargs.schedule) {
- odph_odpthreads_create(&thr[0], &cpumask, &thr_param);
- odph_odpthreads_join(&thr[0]);
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thr_func;
+ thr_param.arg = &thr_arg;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
+
+ odph_thread_join(thread_tbl, num_workers);
} else {
run_measure_one_config(&cargs, cargs.alg_config);
}
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 3da08661c..6aa98ce96 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2014-2018, Linaro Limited
* Copyright (c) 2019-2021, Nokia
- * Copyright (c) 2020, Marvell
+ * Copyright (c) 2020-2021, Marvell
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -108,6 +108,7 @@ typedef struct {
uint32_t packet_len; /* Maximum packet length supported */
uint32_t seg_len; /* Pool segment length */
int promisc_mode; /* Promiscuous mode enabled */
+ int flow_aware; /* Flow aware scheduling enabled */
int mtu; /* Interface MTU */
} appl_args_t;
@@ -1547,6 +1548,7 @@ static void usage(char *progname)
" -l, --packet_len <len> Maximum length of packets supported (default %d).\n"
" -L, --seg_len <len> Packet pool segment length\n"
" (default equal to packet length).\n"
+ " -f, --flow_aware Enable flow aware scheduling.\n"
" -v, --verbose Verbose output.\n"
" -h, --help Display help and exit.\n\n"
"\n", NO_PATH(progname), NO_PATH(progname), MAX_PKTIOS, DEFAULT_VEC_SIZE,
@@ -1594,12 +1596,13 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{"promisc_mode", no_argument, NULL, 'P'},
{"packet_len", required_argument, NULL, 'l'},
{"seg_len", required_argument, NULL, 'L'},
+ {"flow_aware", no_argument, NULL, 'f'},
{"verbose", no_argument, NULL, 'v'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
- static const char *shortopts = "+c:t:a:i:m:o:r:d:s:e:k:g:b:p:y:n:l:L:w:x:z:M:uPvh";
+ static const char *shortopts = "+c:t:a:i:m:o:r:d:s:e:k:g:b:p:y:n:l:L:w:x:z:M:uPfvh";
appl_args->time = 0; /* loop forever if time to run is 0 */
appl_args->accuracy = 1; /* get and print pps stats second */
@@ -1622,6 +1625,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->num_vec = 0;
appl_args->vec_size = 0;
appl_args->vec_tmo_ns = 0;
+ appl_args->flow_aware = 0;
while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -1786,6 +1790,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
case 'z':
appl_args->vec_tmo_ns = atoi(optarg);
break;
+ case 'f':
+ appl_args->flow_aware = 1;
+ break;
case 'v':
appl_args->verbose = 1;
break;
@@ -1869,6 +1876,8 @@ static void print_info(appl_args_t *appl_args)
printf("interface default\n");
printf("Promisc mode: %s\n", appl_args->promisc_mode ?
"enabled" : "disabled");
+ printf("Flow aware: %s\n", appl_args->flow_aware ?
+ "yes" : "no");
printf("Burst size: %i\n", appl_args->burst_rx);
printf("Number of pools: %i\n", appl_args->pool_per_if ?
appl_args->if_count : 1);
@@ -1988,6 +1997,8 @@ int main(int argc, char *argv[])
odp_pool_t pool, vec_pool;
odp_init_t init;
odp_pool_capability_t pool_capa;
+ odp_schedule_config_t sched_config;
+ odp_schedule_capability_t sched_capa;
uint32_t pkt_len, num_pkt, seg_len;
/* Let helper collect its own arguments (e.g. --odph_proc) */
@@ -2210,7 +2221,23 @@ int main(int argc, char *argv[])
bind_workers();
- odp_schedule_config(NULL);
+ odp_schedule_config_init(&sched_config);
+
+ if (odp_schedule_capability(&sched_capa)) {
+ ODPH_ERR("Error: schedule capability failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (gbl_args->appl.flow_aware) {
+ if (sched_capa.max_flow_id) {
+ sched_config.max_flow_id = sched_capa.max_flow_id;
+ } else {
+ ODPH_ERR("Error: flow aware mode not supported\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ odp_schedule_config(&sched_config);
/* Default */
if (num_groups == 0) {
@@ -2296,8 +2323,7 @@ int main(int argc, char *argv[])
run_worker_sched_mode_vector : run_worker_sched_mode;
/* Create worker threads */
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &cpumask;
@@ -2306,6 +2332,7 @@ int main(int argc, char *argv[])
thr_common.sync = 1;
for (i = 0; i < num_workers; ++i) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = thr_run_func;
thr_param[i].arg = &gbl_args->thread_args[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_mem_perf.c b/test/performance/odp_mem_perf.c
index 1348eaaa2..56a3cdf9a 100644
--- a/test/performance/odp_mem_perf.c
+++ b/test/performance/odp_mem_perf.c
@@ -311,11 +311,10 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
int num_cpu = test_options->num_cpu;
odph_thread_param_t thr_param[num_cpu];
- memset(&param, 0, sizeof(odph_thread_common_param_t));
+ odph_thread_common_param_init(&param);
param.instance = instance;
param.cpumask = &global->cpumask;
- memset(thr_param, 0, sizeof(thr_param));
for (i = 0; i < num_cpu; i++) {
test_thread_ctx_t *thread_ctx = &global->thread_ctx[i];
@@ -324,6 +323,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
if (global->test_options.private)
thread_ctx->shm_addr = global->shm_addr[i];
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].thr_type = ODP_THREAD_WORKER;
thr_param[i].start = run_test;
thr_param[i].arg = thread_ctx;
diff --git a/test/performance/odp_packet_gen.c b/test/performance/odp_packet_gen.c
index f3919ebac..02704b195 100644
--- a/test/performance/odp_packet_gen.c
+++ b/test/performance/odp_packet_gen.c
@@ -1486,14 +1486,14 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odph_thread_param_t thr_param[num_cpu];
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
/* Receive threads */
for (i = 0; i < num_rx; i++) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = rx_thread;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
@@ -1513,6 +1513,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
global->thread_arg[i].pktout[j] = pktout;
}
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = tx_thread;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c
index d5ffcc8ab..e35386d52 100644
--- a/test/performance/odp_pktio_ordered.c
+++ b/test/performance/odp_pktio_ordered.c
@@ -1060,10 +1060,11 @@ int main(int argc, char *argv[])
odp_pool_capability_t pool_capa;
odph_ethaddr_t new_addr;
odph_helper_options_t helper_options;
- odph_odpthread_t thread_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
stats_t *stats;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
- int cpu;
int i, j;
int if_count;
int ret;
@@ -1281,26 +1282,21 @@ int main(int argc, char *argv[])
odp_barrier_init(&gbl_args->barrier, num_workers + 1);
/* Create worker threads */
- cpu = odp_cpumask_first(&cpumask);
- for (i = 0; i < num_workers; ++i) {
- odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_worker;
- thr_params.arg = &gbl_args->thread[i];
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ for (i = 0; i < num_workers; ++i) {
gbl_args->thread[i].stats = &stats[i];
- odp_cpumask_zero(&thd_mask);
- odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&thread_tbl[i], &thd_mask,
- &thr_params);
- cpu = odp_cpumask_next(&cpumask, cpu);
+ odph_thread_param_init(&thr_param[i]);
+ thr_param[i].start = run_worker;
+ thr_param[i].arg = &gbl_args->thread[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+ odph_thread_create(thread_tbl, &thr_common, thr_param, num_workers);
+
/* Start packet receive and transmit */
for (i = 0; i < if_count; ++i) {
odp_pktio_t pktio;
@@ -1324,8 +1320,7 @@ int main(int argc, char *argv[])
odp_atomic_store_u32(&gbl_args->exit_threads, 1);
/* Master thread waits for other threads to exit */
- for (i = 0; i < num_workers; ++i)
- odph_odpthreads_join(&thread_tbl[i]);
+ odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < if_count; i++) {
odp_pktio_close(gbl_args->pktios[i].pktio);
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 3d70d7d2b..593465f4f 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -603,45 +603,61 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
odp_cpumask_t *thd_mask_rx,
test_status_t *status)
{
- odph_odpthread_t thd_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
thread_args_t args_tx, args_rx;
uint64_t expected_tx_cnt;
int num_tx_workers, num_rx_workers;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = gbl_args->instance;
odp_atomic_store_u32(&gbl_args->shutdown, 0);
- memset(thd_tbl, 0, sizeof(thd_tbl));
+ memset(thread_tbl, 0, sizeof(thread_tbl));
memset(gbl_args->rx_stats, 0, gbl_args->rx_stats_size);
memset(gbl_args->tx_stats, 0, gbl_args->tx_stats_size);
expected_tx_cnt = status->pps_curr * gbl_args->args.duration;
/* start receiver threads first */
- thr_params.start = run_thread_rx;
- thr_params.arg = &args_rx;
+
+ num_rx_workers = odp_cpumask_count(thd_mask_rx);
args_rx.batch_len = gbl_args->args.rx_batch_len;
- odph_odpthreads_create(&thd_tbl[0], thd_mask_rx, &thr_params);
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = gbl_args->instance;
+ thr_common.cpumask = thd_mask_rx;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread_rx;
+ thr_param.arg = &args_rx;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_rx_workers);
odp_barrier_wait(&gbl_args->rx_barrier);
- num_rx_workers = odp_cpumask_count(thd_mask_rx);
/* then start transmitters */
- thr_params.start = run_thread_tx;
- thr_params.arg = &args_tx;
+
num_tx_workers = odp_cpumask_count(thd_mask_tx);
args_tx.pps = status->pps_curr / num_tx_workers;
args_tx.duration = gbl_args->args.duration;
args_tx.batch_len = gbl_args->args.tx_batch_len;
- odph_odpthreads_create(&thd_tbl[num_rx_workers], thd_mask_tx,
- &thr_params);
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = gbl_args->instance;
+ thr_common.cpumask = thd_mask_tx;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread_tx;
+ thr_param.arg = &args_tx;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(&thread_tbl[num_rx_workers], &thr_common, &thr_param, num_tx_workers);
odp_barrier_wait(&gbl_args->tx_barrier);
/* wait for transmitter threads to terminate */
- odph_odpthreads_join(&thd_tbl[num_rx_workers]);
+ odph_thread_join(&thread_tbl[num_rx_workers], num_tx_workers);
/* delay to allow transmitted packets to reach the receivers */
odp_time_wait_ns(SHUTDOWN_DELAY_NS);
@@ -650,7 +666,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
odp_atomic_store_u32(&gbl_args->shutdown, 1);
/* wait for receivers */
- odph_odpthreads_join(&thd_tbl[0]);
+ odph_thread_join(thread_tbl, num_rx_workers);
if (!status->warmup)
return process_results(expected_tx_cnt, status);
diff --git a/test/performance/odp_pool_perf.c b/test/performance/odp_pool_perf.c
index ee97af519..957b1de00 100644
--- a/test/performance/odp_pool_perf.c
+++ b/test/performance/odp_pool_perf.c
@@ -43,7 +43,7 @@ typedef struct test_global_t {
odp_barrier_t barrier;
odp_pool_t pool;
odp_cpumask_t cpumask;
- odph_odpthread_t thread_tbl[ODP_THREAD_COUNT_MAX];
+ odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
test_stat_t stat[ODP_THREAD_COUNT_MAX];
} test_global_t;
@@ -445,23 +445,28 @@ static int test_packet_pool(void *arg)
static int start_workers(test_global_t *global, odp_instance_t instance)
{
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
test_options_t *test_options = &global->test_options;
int num_cpu = test_options->num_cpu;
int packet_pool = test_options->pool_type;
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
- thr_params.arg = global;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &global->cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.arg = global;
+ thr_param.thr_type = ODP_THREAD_WORKER;
if (packet_pool)
- thr_params.start = test_packet_pool;
+ thr_param.start = test_packet_pool;
else
- thr_params.start = test_buffer_pool;
+ thr_param.start = test_buffer_pool;
- if (odph_odpthreads_create(global->thread_tbl, &global->cpumask,
- &thr_params) != num_cpu)
+ if (odph_thread_create(global->thread_tbl, &thr_common, &thr_param,
+ num_cpu) != num_cpu)
return -1;
return 0;
@@ -608,7 +613,7 @@ int main(int argc, char **argv)
start_workers(global, instance);
/* Wait workers to exit */
- odph_odpthreads_join(global->thread_tbl);
+ odph_thread_join(global->thread_tbl, global->test_options.num_cpu);
print_stat(global);
diff --git a/test/performance/odp_queue_perf.c b/test/performance/odp_queue_perf.c
index 33284d312..320f2f35a 100644
--- a/test/performance/odp_queue_perf.c
+++ b/test/performance/odp_queue_perf.c
@@ -44,7 +44,7 @@ typedef struct test_global_t {
odp_shm_t shm;
odp_pool_t pool;
odp_queue_t queue[MAX_QUEUES];
- odph_odpthread_t thread_tbl[ODP_THREAD_COUNT_MAX];
+ odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
test_stat_t stat[ODP_THREAD_COUNT_MAX];
} test_global_t;
@@ -423,18 +423,13 @@ error:
static int start_workers(test_global_t *global)
{
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_cpumask_t cpumask;
int ret;
test_options_t *test_options = &global->options;
int num_cpu = test_options->num_cpu;
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = global->instance;
- thr_params.start = run_test;
- thr_params.arg = global;
-
ret = odp_cpumask_default_worker(&cpumask, num_cpu);
if (num_cpu && ret != num_cpu) {
@@ -452,8 +447,18 @@ static int start_workers(test_global_t *global)
odp_barrier_init(&global->barrier, num_cpu);
- if (odph_odpthreads_create(global->thread_tbl, &cpumask, &thr_params)
- != num_cpu)
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = global->instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_test;
+ thr_param.arg = global;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ if (odph_thread_create(global->thread_tbl, &thr_common, &thr_param,
+ num_cpu) != num_cpu)
return -1;
return 0;
@@ -596,7 +601,7 @@ int main(int argc, char **argv)
}
/* Wait workers to exit */
- odph_odpthreads_join(global->thread_tbl);
+ odph_thread_join(global->thread_tbl, global->options.num_cpu);
print_stat(global);
diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c
index c6b659aac..2910dcdbc 100644
--- a/test/performance/odp_sched_latency.c
+++ b/test/performance/odp_sched_latency.c
@@ -705,8 +705,9 @@ int main(int argc, char *argv[])
odp_instance_t instance;
odp_init_t init_param;
odph_helper_options_t helper_options;
- odph_odpthread_t *thread_tbl;
- odph_odpthread_params_t thr_params;
+ odph_thread_t *thread_tbl;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_cpumask_t cpumask;
odp_pool_t pool;
odp_pool_capability_t pool_capa;
@@ -766,7 +767,7 @@ int main(int argc, char *argv[])
printf(" First CPU: %i\n", odp_cpumask_first(&cpumask));
printf(" CPU mask: %s\n", cpumaskstr);
- thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers);
+ thread_tbl = calloc(sizeof(odph_thread_t), num_workers);
if (!thread_tbl) {
ODPH_ERR("no memory for thread_tbl\n");
return -1;
@@ -858,15 +859,20 @@ int main(int argc, char *argv[])
odp_barrier_init(&globals->barrier, num_workers);
/* Create and launch worker threads */
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
- thr_params.start = run_thread;
- thr_params.arg = NULL;
- odph_odpthreads_create(thread_tbl, &cpumask, &thr_params);
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread;
+ thr_param.arg = NULL;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to terminate */
- odph_odpthreads_join(thread_tbl);
+ odph_thread_join(thread_tbl, num_workers);
free(thread_tbl);
printf("ODP scheduling latency test complete\n\n");
diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c
index da818931c..f9b4ce548 100644
--- a/test/performance/odp_sched_perf.c
+++ b/test/performance/odp_sched_perf.c
@@ -979,10 +979,12 @@ static int test_sched(void *arg)
odp_event_t event;
uint64_t sched_wait = odp_schedule_wait_time(200 * ODP_TIME_MSEC_IN_NS);
- /* Print schedule status at the end of the test, before any queues
+ /* Print queue and scheduler status at the end of the test, before any queues
* are emptied or destroyed. */
- if (test_options->verbose)
+ if (test_options->verbose) {
+ odp_queue_print_all();
odp_schedule_print();
+ }
while ((event = odp_schedule(NULL, sched_wait)) != ODP_EVENT_INVALID)
odp_event_free(event);
@@ -1025,13 +1027,13 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odp_atomic_init_u32(&global->num_worker, num_cpu);
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
for (i = 0; i < num_cpu; i++) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = test_sched;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c
index cbdbdf4aa..589b58d97 100644
--- a/test/performance/odp_sched_pktio.c
+++ b/test/performance/odp_sched_pktio.c
@@ -1396,45 +1396,50 @@ static void destroy_timers(test_global_t *test_global)
odp_timer_pool_destroy(timer_pool);
}
-static void start_workers(odph_odpthread_t thread[],
+static void start_workers(odph_thread_t thread[],
test_global_t *test_global)
{
int i;
odp_cpumask_t cpumask;
- odph_odpthread_params_t param;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
int num = test_global->opt.num_worker;
- memset(&param, 0, sizeof(odph_odpthread_params_t));
+ odp_cpumask_zero(&cpumask);
- if (test_global->opt.timeout_us)
- param.start = worker_thread_timers;
- else if (test_global->opt.pipe_stages)
- param.start = worker_thread_pipeline;
- else
- param.start = worker_thread_direct;
-
- param.thr_type = ODP_THREAD_WORKER;
- param.instance = test_global->instance;
-
- memset(thread, 0, num * sizeof(odph_odpthread_t));
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = test_global->instance;
+ thr_common.cpumask = &cpumask;
for (i = 0; i < num; i++) {
- odp_cpumask_zero(&cpumask);
odp_cpumask_set(&cpumask, test_global->worker_cpu[i]);
test_global->worker_arg[i].worker_id = i;
test_global->worker_arg[i].test_global_ptr = test_global;
- param.arg = &test_global->worker_arg[i];
- odph_odpthreads_create(&thread[i], &cpumask, &param);
+ odph_thread_param_init(&thr_param[i]);
+
+ if (!i) {
+ if (test_global->opt.timeout_us)
+ thr_param[0].start = worker_thread_timers;
+ else if (test_global->opt.pipe_stages)
+ thr_param[0].start = worker_thread_pipeline;
+ else
+ thr_param[0].start = worker_thread_direct;
+ } else {
+ thr_param[i].start = thr_param[0].start;
+ }
+
+ thr_param[i].arg = &test_global->worker_arg[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+
+ memset(thread, 0, num * sizeof(odph_thread_t));
+ odph_thread_create(thread, &thr_common, thr_param, num);
}
-static void wait_workers(odph_odpthread_t thread[], test_global_t *test_global)
+static void wait_workers(odph_thread_t thread[], test_global_t *test_global)
{
- int i;
-
- for (i = 0; i < test_global->opt.num_worker; ++i)
- odph_odpthreads_join(&thread[i]);
+ odph_thread_join(thread, test_global->opt.num_worker);
}
int main(int argc, char *argv[])
@@ -1444,7 +1449,7 @@ int main(int argc, char *argv[])
odp_shm_t shm;
odp_time_t t1 = ODP_TIME_NULL, t2 = ODP_TIME_NULL;
odph_helper_options_t helper_options;
- odph_odpthread_t thread[MAX_WORKERS];
+ odph_thread_t thread[MAX_WORKERS];
test_options_t test_options;
int ret = 0;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 76d767220..d52ad816a 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -997,17 +997,17 @@ int main(int argc, char *argv[])
globals->first_thr = -1;
/* Create and launch worker threads */
- memset(&thr_common, 0, sizeof(thr_common));
- memset(&thr_param, 0, sizeof(thr_param));
-
- thr_param.thr_type = ODP_THREAD_WORKER;
- thr_param.start = run_thread;
- thr_param.arg = NULL;
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &cpumask;
thr_common.share_param = 1;
+ odph_thread_param_init(&thr_param);
+ thr_param.thr_type = ODP_THREAD_WORKER;
+ thr_param.start = run_thread;
+ thr_param.arg = NULL;
+
odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to terminate */
diff --git a/test/performance/odp_timer_perf.c b/test/performance/odp_timer_perf.c
index 6989d0d4c..a45081643 100644
--- a/test/performance/odp_timer_perf.c
+++ b/test/performance/odp_timer_perf.c
@@ -795,13 +795,14 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odph_thread_param_t thr_param[num_cpu];
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
for (i = 0; i < num_cpu; i++) {
+ odph_thread_param_init(&thr_param[i]);
+
if (test_options->mode == MODE_SCHED_OVERH)
thr_param[i].start = sched_mode_worker;
else