24 #include <odp/helper/odph_api.h>
26 #define PROG_NAME "odp_timer_stress"
28 #define MAX_WORKERS ((uint32_t)(ODP_THREAD_COUNT_MAX - 1))
29 #define MULTIPLIER 50U
32 #define WAIT_MULTIPLIER 100U
34 #define GIGAS 1000000000U
35 #define MEGAS 1000000U
49 #define DEF_MODE SINGLE_SHOT
50 #define DEF_CLK_SRC ODP_CLOCK_DEFAULT
51 #define DEF_RES 1000000U
52 #define DEF_TIMERS 50U
53 #define DEF_POLICY SHARED_TMR
55 #define DEF_WORKERS 1U
57 #define ROUNDUP_DIV(a, b) (((a) + ((b) - 1)) / (b))
73 typedef struct prog_config_s prog_config_t;
93 prog_config_t *prog_config;
94 uint32_t num_boot_tmr;
104 uint32_t num_workers;
107 typedef struct prog_config_s {
108 odph_thread_t thread_tbl[MAX_WORKERS];
109 worker_config_t worker_config[MAX_WORKERS];
125 static prog_config_t *prog_conf;
132 static void init_config(prog_config_t *config)
136 worker_config_t *worker;
138 opts.mode = DEF_MODE;
139 opts.clk_src = DEF_CLK_SRC;
140 opts.res_ns = DEF_RES;
141 opts.num_tmr = DEF_TIMERS;
142 opts.policy = DEF_POLICY;
143 opts.time_sec = DEF_TIME;
144 opts.num_workers = DEF_WORKERS;
150 if (opts.mode == SINGLE_SHOT || opts.mode == CANCEL) {
158 for (uint32_t i = 0U; i < MAX_WORKERS; ++i) {
159 worker = &config->worker_config[i];
164 config->def_opts = opts;
165 config->opts = config->def_opts;
172 static void print_usage(
const opts_t *opts)
175 "Stress test for benchmarking timer related handling performance in different\n"
178 "Usage: " PROG_NAME
" [OPTIONS]\n");
180 " E.g. " PROG_NAME
" -m 0 -n 20\n"
181 " " PROG_NAME
" -m 2 -p 1 -t 5 -c 4\n");
183 "Optional OPTIONS:\n"
185 " -m, --mode Timer mode. %u by default. Modes:\n"
188 " 2: single shot with cancel\n"
189 " -s, --clock_source Clock source. Use 'odp_timer_clk_src_t' enumeration values.\n"
191 " -r, --resolution Timer resolution in nanoseconds. %" PRIu64
" by default.\n"
192 " -n, --num_timer Number of timers. %u by default.\n"
193 " -p, --policy Timer sharing policy. %u by default. Policies:\n"
194 " 0: Timers shared by workers\n"
195 " 1: Private timers per worker\n"
196 " -t, --time_sec Time in seconds to run. 0 means infinite. %u by default.\n"
197 " -c, --worker_count Number of workers. %u by default.\n"
198 " -h, --help This help.\n"
199 "\n", opts->mode, opts->clk_src, opts->res_ns, opts->num_tmr, opts->policy,
200 opts->time_sec, opts->num_workers);
211 fract.
numer = (uint64_t)(leftover * DEF_RES);
212 fract.
denom = fract.
numer == 0U ? 0U : DEF_RES;
217 static parse_result_t check_options(prog_config_t *config)
219 opts_t *opts = &config->opts;
222 uint32_t req_tmr, max_workers, req_shm;
224 double hz_d, min_hz_d, max_hz_d;
229 if (opts->mode != SINGLE_SHOT && opts->mode != PERIODIC && opts->mode != CANCEL) {
230 ODPH_ERR(
"Invalid timer mode: %u\n", opts->mode);
234 if (opts->policy != SHARED_TMR && opts->policy != PRIV_TMR) {
235 ODPH_ERR(
"Invalid pool policy: %d\n", opts->policy);
239 if (opts->mode == CANCEL && opts->policy != PRIV_TMR) {
240 ODPH_ERR(
"Single shot with cancel mode supported only with worker-private "
248 ODPH_ERR(
"Error querying timer capabilities\n");
253 ODPH_ERR(
"Invalid clock source: %d\n", opts->clk_src);
258 ODPH_ERR(
"Invalid queue support, scheduled completion queues not supported\n");
263 ODPH_ERR(
"Invalid resolution: %" PRIu64
" ns (max: %" PRIu64
" ns)\n",
268 if (opts->num_tmr == 0U) {
269 ODPH_ERR(
"Invalid number of timers: %u\n", opts->num_tmr);
275 if (opts->num_workers == 0U || opts->num_workers > max_workers) {
276 ODPH_ERR(
"Invalid worker count: %u (min: 1, max: %u)\n", opts->num_workers,
283 req_tmr = opts->num_tmr * (opts->policy == PRIV_TMR ? opts->num_workers : 1U);
285 if (opts->mode == SINGLE_SHOT || opts->mode == CANCEL) {
287 ODPH_ERR(
"Single shot timers not supported\n");
292 ODPH_ERR(
"Invalid number of timers: %u (max: %u)\n", req_tmr,
297 config->res_capa.res_ns = opts->res_ns;
300 ODPH_ERR(
"Error querying timer resolution capabilities\n");
304 if (opts->mode == CANCEL) {
306 ODPH_ERR(
"Error querying SHM capabilities");
315 ODPH_ERR(
"Invalid SHM block count support: %u (max: %u)\n",
323 opts->num_tmr * opts->num_workers;
326 ODPH_ERR(
"Invalid total SHM block size: %" PRIu64
""
327 " (max: %" PRIu64
")\n", req_shm_sz, shm_capa.
max_size);
333 ODPH_ERR(
"Periodic timers not supported\n");
338 ODPH_ERR(
"Invalid number of timers: %u (max: %u)\n", req_tmr,
343 hz = calc_req_hz(opts->res_ns);
348 if (hz_d < min_hz_d || hz_d > max_hz_d) {
349 ODPH_ERR(
"Invalid requested resolution: %." FMT_RES
"f hz "
350 "(min: %." FMT_RES
"f hz, max: %." FMT_RES
"f hz)\n", hz_d,
355 config->per_capa.base_freq_hz = hz;
356 config->per_capa.max_multiplier = MULTIPLIER;
357 config->per_capa.res_ns = opts->res_ns;
360 ODPH_ERR(
"Error querying periodic timer capabilities\n");
364 if (config->per_capa.max_multiplier > MULTIPLIER)
365 config->per_capa.max_multiplier = MULTIPLIER;
369 ODPH_ERR(
"Error querying pool capabilities\n");
374 ODPH_ERR(
"Invalid timeout event count: %u (max: %u)\n", req_tmr,
382 static parse_result_t parse_options(
int argc,
char **argv, prog_config_t *config)
385 opts_t *opts = &config->opts;
387 static const struct option longopts[] = {
388 {
"mode", required_argument, NULL,
'm' },
389 {
"clock_source", required_argument, NULL,
's' },
390 {
"resolution", required_argument, NULL,
'r' },
391 {
"num_timer", required_argument, NULL,
'n' },
392 {
"policy", required_argument, NULL,
'p' },
393 {
"time_sec", required_argument, NULL,
't' },
394 {
"worker_count", required_argument, NULL,
'c' },
395 {
"help", no_argument, NULL,
'h' },
399 static const char *shortopts =
"m:s:r:n:p:t:c:h";
404 opt = getopt_long(argc, argv, shortopts, longopts, NULL);
411 opts->mode = atoi(optarg);
414 opts->clk_src = atoi(optarg);
417 opts->res_ns = atoll(optarg);
420 opts->num_tmr = atoi(optarg);
423 opts->policy = atoi(optarg);
426 opts->time_sec = atoi(optarg);
429 opts->num_workers = atoi(optarg);
432 print_usage(&config->def_opts);
436 print_usage(&config->def_opts);
441 return check_options(config);
444 static parse_result_t setup_program(
int argc,
char **argv, prog_config_t *config)
446 struct sigaction action = { .sa_handler = terminate };
450 if (sigemptyset(&action.sa_mask) == -1 || sigaddset(&action.sa_mask, SIGINT) == -1 ||
451 sigaddset(&action.sa_mask, SIGTERM) == -1 ||
452 sigaddset(&action.sa_mask, SIGHUP) == -1 || sigaction(SIGINT, &action, NULL) == -1 ||
453 sigaction(SIGTERM, &action, NULL) == -1 || sigaction(SIGHUP, &action, NULL) == -1) {
454 ODPH_ERR(
"Error installing signal handler\n");
458 return parse_options(argc, argv, config);
468 ODPH_ERR(
"Error creating timer pool\n");
473 ODPH_ERR(
"Error starting timer pool\n");
480 static odp_bool_t setup_config(prog_config_t *config)
482 opts_t *opts = &config->opts;
483 odp_bool_t is_priv = opts->policy == PRIV_TMR;
484 const uint32_t num_barrier = opts->num_workers + 1,
485 max_tmr = opts->num_tmr * (is_priv ? opts->num_workers : 1U),
491 void *cancel_addr = NULL;
492 uint32_t num_tmr_p_w = ROUNDUP_DIV(opts->num_tmr, opts->num_workers),
493 num_tmr = opts->num_tmr;
494 worker_config_t *worker;
497 ODPH_ERR(
"Error initializing scheduler\n");
505 tmo_param.
tmo.
num = max_tmr;
510 ODPH_ERR(
"Error creating timeout pool\n");
515 tmr_param.
clk_src = opts->clk_src;
516 tmr_param.
res_ns = opts->res_ns;
519 if (opts->mode == SINGLE_SHOT || opts->mode == CANCEL) {
521 tmr_param.
min_tmo = config->res_capa.min_tmo;
522 tmr_param.
max_tmo = config->res_capa.max_tmo;
529 config->tmr_pool = create_timer_pool(&tmr_param);
539 if (is_priv && opts->mode == CANCEL) {
541 ODP_CACHE_LINE_SIZE, 0U);
544 ODPH_ERR(
"Error reserving SHM for cancel mode\n");
550 if (cancel_addr == NULL) {
551 ODPH_ERR(
"Error resolving SHM address for cancel mode\n");
556 for (uint32_t i = 0U; i < opts->num_workers; ++i) {
557 worker = &config->worker_config[i];
558 worker->num_boot_tmr = num_tmr_p_w;
559 num_tmr -= num_tmr_p_w;
561 if (num_tmr < num_tmr_p_w)
562 num_tmr_p_w = num_tmr;
565 worker->num_boot_tmr = opts->num_tmr;
567 if (opts->mode == CANCEL)
568 worker->cancel.tmrs =
569 (tmr_hdls_t *)(uintptr_t)((uint8_t *)(uintptr_t)cancel_addr + i *
570 worker->num_boot_tmr * tmr_size);
575 ODPH_ERR(
"Error creating schedule group for worker %u\n", i);
585 ODPH_ERR(
"Error creating completion queue for worker %u\n", i);
589 worker->prog_config = config;
604 ODPH_ABORT(
"Error allocating timers, aborting (tmr: %" PRIx64
", "
613 ODPH_ABORT(
"Error allocating timeouts, aborting (tmo: %" PRIx64
", "
617 time.is_running =
true;
623 uint64_t res_ns, stats_t *stats)
626 uint32_t retry = MAX_RETRY, mul = 1U;
645 ODPH_ABORT(
"Error starting timers, aborting (tmr: %" PRIx64
", tmr pool: "
650 stats->max_mul = mul > stats->max_mul ? mul : stats->max_mul;
653 static void boot_single_shot(worker_config_t *worker,
odp_timer_pool_t tmr_pool,
658 for (uint32_t i = 0U; i < worker->num_boot_tmr; ++i) {
659 time = get_time_handles(tmr_pool, tmo_pool, worker->scd.q);
665 static int process_single_shot(
void *args)
667 worker_config_t *worker = args;
669 prog_config_t *config = worker->prog_config;
671 const uint64_t res_ns = prog_conf->opts.res_ns;
676 stats_t *stats = &worker->stats;
683 ODPH_ABORT(
"Error joining scheduler group, aborting (group: %" PRIu64
")"
687 boot_single_shot(worker, tmr_pool, config->tmo_pool, res_ns);
698 start_single_shot(tmr_pool, tmr, ev, res_ns, stats);
729 ODPH_ABORT(
"Error starting timer, aborting (tmr: %" PRIx64
", tmr pool: "
739 for (uint32_t i = 0U; i < worker->num_boot_tmr; ++i) {
740 time = get_time_handles(tmr_pool, tmo_pool, worker->scd.q);
745 static int process_periodic(
void *args)
747 worker_config_t *worker = args;
749 prog_config_t *config = worker->prog_config;
754 stats_t *stats = &worker->stats;
755 const uint64_t res_ns = prog_conf->opts.res_ns;
763 ODPH_ABORT(
"Error joining scheduler group, aborting (group: %" PRIu64
")"
767 boot_periodic(worker, config->tmr_pool, config->tmo_pool, config->per_capa.max_multiplier);
780 ODPH_ABORT(
"Error acking periodic timer, aborting (tmr: %" PRIx64
")\n",
791 config->per_capa.max_multiplier *
803 ODPH_ABORT(
"Error acking periodic timer, aborting (tmr: %" PRIx64
")\n",
819 ODPH_ABORT(
"Error cancelling periodic timer, aborting "
833 for (uint32_t i = 0U; i < worker->num_boot_tmr; ++i) {
834 time = get_time_handles(tmr_pool, tmo_pool, worker->scd.q);
837 worker->cancel.tmrs[i] = time;
841 static int process_cancel(
void *args)
843 worker_config_t *worker = args;
845 prog_config_t *config = worker->prog_config;
847 const uint64_t res_ns = prog_conf->opts.res_ns;
851 stats_t *stats = &worker->stats;
852 const uint32_t num_boot_tmr = worker->num_boot_tmr;
861 ODPH_ABORT(
"Error joining scheduler group, aborting (group: %" PRIu64
")\n",
864 boot_cancel(worker, tmr_pool, config->tmo_pool, res_ns);
878 for (uint32_t i = 0U; i < num_boot_tmr; ++i) {
879 time = &worker->cancel.tmrs[i];
886 ODPH_ABORT(
"Error cancelling timer, aborting (tmr: %" PRIx64
")\n",
889 time->is_running =
false;
893 for (uint32_t i = 0U; i < num_boot_tmr; ++i) {
894 time = &worker->cancel.tmrs[i];
896 if (time->is_running)
901 time->is_running =
true;
923 static odp_bool_t setup_workers(prog_config_t *config)
925 odph_thread_common_param_t thr_common;
926 odph_thread_param_t thr_params[config->opts.num_workers], *thr_param;
927 worker_config_t *worker;
928 const uint32_t mode = config->opts.mode;
929 int (*start_fn)(
void *) = mode == SINGLE_SHOT ? process_single_shot :
930 mode == PERIODIC ? process_periodic : process_cancel;
932 odph_thread_common_param_init(&thr_common);
933 thr_common.instance = config->odp_instance;
934 thr_common.cpumask = &config->worker_mask;
936 for (uint32_t i = 0; i < config->opts.num_workers; ++i) {
937 thr_param = &thr_params[i];
938 worker = &config->worker_config[i];
939 odph_thread_param_init(thr_param);
940 thr_param->start = start_fn;
942 thr_param->arg = worker;
945 if ((uint32_t)odph_thread_create(config->thread_tbl, &thr_common, thr_params,
946 config->opts.num_workers) != config->opts.num_workers) {
947 ODPH_ERR(
"Error configuring worker threads\n");
954 static odp_bool_t setup_test(prog_config_t *config)
956 return setup_config(config) && setup_workers(config);
959 static void run_control(prog_config_t *config)
961 const uint32_t time_sec = config->opts.time_sec;
975 (void)odph_thread_join(config->thread_tbl, config->opts.num_workers);
978 static void print_humanised(uint64_t value)
981 printf(
"%.2f GOPS\n", (
double)value / GIGAS);
982 else if (value > MEGAS)
983 printf(
"%.2f MOPS\n", (
double)value / MEGAS);
984 else if (value > KILOS)
985 printf(
"%.2f kOPS\n", (
double)value / KILOS);
987 printf(
"%" PRIu64
" OPS\n", value);
990 static void print_stats(
const prog_config_t *config)
992 const stats_t *stats;
993 const opts_t *opts = &config->opts;
994 uint64_t tot_tmo = 0U, tot_miss = 0U, tot_retry = 0U, max_mul = 0U, rate, tot_rate = 0U;
996 printf(
"=====================\n\n"
997 "" PROG_NAME
" done\n\n"
999 " clock source: %d\n"
1000 " resolution: %" PRIu64
" ns\n"
1001 " number of timers: %u (%s)\n\n", opts->mode == SINGLE_SHOT ?
"single shot" :
1002 opts->mode == PERIODIC ?
1003 "periodic" :
"single shot with cancel",
1004 opts->clk_src, opts->res_ns, opts->num_tmr,
1005 opts->policy == SHARED_TMR ?
"shared" :
"private");
1007 for (uint32_t i = 0U; i < config->opts.num_workers; ++i) {
1008 stats = &config->worker_config[i].stats;
1009 tot_tmo += stats->num_tmo;
1010 tot_miss += stats->num_miss;
1011 tot_retry += stats->num_retry;
1012 max_mul = ODPH_MAX(max_mul, stats->max_mul);
1016 printf(
" worker %u:\n"
1017 " %s%" PRIu64
"\n", i,
1018 opts->mode == SINGLE_SHOT || opts->mode == PERIODIC ?
1019 "number of timeouts: " :
"number of cancels: ",
1022 if (opts->mode == SINGLE_SHOT || opts->mode == CANCEL) {
1023 if (opts->mode == CANCEL)
1024 printf(
" number of misses: %" PRIu64
"\n", stats->num_miss);
1026 printf(
" number of retries: %" PRIu64
"\n"
1027 " max start mul: %" PRIu64
"\n", stats->num_retry,
1031 printf(
" runtime: %" PRIu64
" ns\n"
1032 " rate: ", stats->tot_tm);
1033 print_humanised(rate);
1038 " %s%" PRIu64
"\n", opts->mode == SINGLE_SHOT || opts->mode == PERIODIC ?
1039 "number of timeouts: " :
"number of cancels: ",
1042 if (opts->mode == SINGLE_SHOT || opts->mode == CANCEL) {
1043 if (opts->mode == CANCEL)
1044 printf(
" number of misses: %" PRIu64
"\n", tot_miss);
1046 printf(
" number of retries: %" PRIu64
"\n"
1047 " max start mul: %" PRIu64
"\n", tot_retry, max_mul);
1051 print_humanised(tot_rate);
1052 printf(
"\n=====================\n");
1055 static void teardown(
const prog_config_t *config)
1057 const opts_t *opts = &config->opts;
1058 const worker_config_t *worker;
1060 for (uint32_t i = 0U; i < opts->num_workers; ++i) {
1061 worker = &config->worker_config[i];
1080 int main(
int argc,
char **argv)
1082 odph_helper_options_t odph_opts;
1086 int ret = EXIT_SUCCESS;
1087 parse_result_t parse_res;
1089 argc = odph_parse_options(argc, argv);
1091 if (odph_options(&odph_opts) == -1)
1092 ODPH_ABORT(
"Error while reading ODP helper options, aborting\n");
1095 init_param.
mem_model = odph_opts.mem_model;
1098 ODPH_ABORT(
"ODP global init failed, aborting\n");
1101 ODPH_ABORT(
"ODP local init failed, aborting\n");
1103 shm_cfg =
odp_shm_reserve(PROG_NAME
"_cfg",
sizeof(prog_config_t), ODP_CACHE_LINE_SIZE,
1107 ODPH_ERR(
"Error reserving shared memory\n");
1114 if (prog_conf == NULL) {
1115 ODPH_ERR(
"Error resolving shared memory address\n");
1120 memset(prog_conf, 0,
sizeof(*prog_conf));
1122 parse_res = setup_program(argc, argv, prog_conf);
1124 if (parse_res == PRS_NOK) {
1129 if (parse_res == PRS_TERM) {
1134 if (!setup_test(prog_conf)) {
1139 run_control(prog_conf);
1140 print_stats(prog_conf);
1143 teardown(prog_conf);
1149 ODPH_ABORT(
"ODP local terminate failed, aborting\n");
1152 ODPH_ABORT(
"ODP global terminate failed, aborting\n");
void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val)
Initialize atomic uint32 variable.
uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom)
Load value of atomic uint32 variable.
void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val)
Store value to atomic uint32 variable.
void odp_barrier_init(odp_barrier_t *barr, int count)
Initialize barrier with thread count.
void odp_barrier_wait(odp_barrier_t *barr)
Synchronize thread execution on barrier.
#define ODP_ALIGNED_CACHE
Defines type/struct/variable to be cache line size aligned.
#define odp_unlikely(x)
Branch unlikely taken.
#define ODP_UNUSED
Intentionally unused variables of functions.
#define ODP_CACHE_LINE_ROUNDUP(x)
Round up to cache line size.
int odp_cpumask_default_worker(odp_cpumask_t *mask, int num)
Default CPU mask for worker threads.
void odp_event_free(odp_event_t event)
Free event.
#define ODP_EVENT_INVALID
Invalid event.
int odp_instance(odp_instance_t *instance)
Get instance handle.
void odp_init_param_init(odp_init_t *param)
Initialize the odp_init_t to default values for all fields.
int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
Thread local ODP initialization.
int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params)
Global ODP initialization.
int odp_term_local(void)
Thread local ODP termination.
int odp_term_global(odp_instance_t instance)
Global ODP termination.
uint64_t odp_instance_t
ODP instance ID.
void odp_spinlock_lock(odp_spinlock_t *splock)
Acquire spin lock.
void odp_spinlock_init(odp_spinlock_t *splock)
Initialize spin lock.
void odp_spinlock_unlock(odp_spinlock_t *splock)
Release spin lock.
uint64_t odp_pool_to_u64(odp_pool_t hdl)
Get printable value for an odp_pool_t.
odp_pool_t odp_pool_create(const char *name, const odp_pool_param_t *param)
Create a pool.
int odp_pool_capability(odp_pool_capability_t *capa)
Query pool capabilities.
void odp_pool_param_init(odp_pool_param_t *param)
Initialize pool params.
int odp_pool_destroy(odp_pool_t pool)
Destroy a pool previously created by odp_pool_create()
#define ODP_POOL_INVALID
Invalid pool.
@ ODP_POOL_TIMEOUT
Timeout pool.
void odp_queue_param_init(odp_queue_param_t *param)
Initialize queue params.
#define ODP_QUEUE_INVALID
Invalid queue.
odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
Queue create.
int odp_queue_destroy(odp_queue_t queue)
Destroy ODP queue.
@ ODP_QUEUE_TYPE_SCHED
Scheduled queue.
int odp_schedule_group_t
Scheduler thread group.
int odp_schedule_group_join(odp_schedule_group_t group, const odp_thrmask_t *mask)
Join a schedule group.
int odp_schedule_group_destroy(odp_schedule_group_t group)
Schedule group destroy.
#define ODP_SCHED_GROUP_INVALID
Invalid scheduler group.
#define ODP_SCHED_NO_WAIT
Do not wait.
int odp_schedule_default_prio(void)
Default scheduling priority level.
int odp_schedule_config(const odp_schedule_config_t *config)
Global schedule configuration.
uint64_t odp_schedule_group_to_u64(odp_schedule_group_t group)
Get printable value for schedule group handle.
uint64_t odp_schedule_wait_time(uint64_t ns)
Schedule wait time.
odp_schedule_group_t odp_schedule_group_create(const char *name, const odp_thrmask_t *mask)
Schedule group create.
odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait)
Schedule an event.
int odp_shm_free(odp_shm_t shm)
Free a contiguous block of shared memory.
#define ODP_SHM_INVALID
Invalid shared memory block.
int odp_shm_capability(odp_shm_capability_t *capa)
Query shared memory capabilities.
void * odp_shm_addr(odp_shm_t shm)
Shared memory block address.
odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, uint32_t flags)
Reserve a contiguous block of shared memory.
bool odp_bool_t
Boolean type.
double odp_fract_u64_to_dbl(const odp_fract_u64_t *fract)
Convert fractional number (u64) to double.
void odp_thrmask_set(odp_thrmask_t *mask, int thr)
Add thread to mask.
int odp_thread_id(void)
Get thread identifier.
void odp_thrmask_zero(odp_thrmask_t *mask)
Clear entire thread mask.
@ ODP_THREAD_WORKER
Worker thread.
@ ODP_THREAD_CONTROL
Control thread.
#define ODP_TIME_SEC_IN_NS
A second in nanoseconds.
odp_time_t odp_time_local_strict(void)
Current local time (strict)
uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1)
Time difference in nanoseconds.
int odp_timer_pool_start_multi(odp_timer_pool_t timer_pool[], int num)
Start timer pools.
odp_timeout_t odp_timeout_alloc(odp_pool_t pool)
Timeout alloc.
int odp_timer_free(odp_timer_t timer)
Free a timer.
int odp_timer_periodic_start(odp_timer_t timer, const odp_timer_periodic_start_t *start_param)
Start a periodic timer.
odp_timeout_t odp_timeout_from_event(odp_event_t ev)
Get timeout handle from a ODP_EVENT_TIMEOUT type event.
#define ODP_TIMER_POOL_INVALID
Invalid timer pool handle.
int odp_timer_periodic_capability(odp_timer_clk_src_t clk_src, odp_timer_periodic_capability_t *capa)
Periodic timer capability.
odp_timer_pool_t odp_timer_pool_create(const char *name, const odp_timer_pool_param_t *params)
Create a timer pool.
odp_timer_t odp_timeout_timer(odp_timeout_t tmo)
Return timer handle for the timeout.
int odp_timer_cancel(odp_timer_t timer, odp_event_t *tmo_ev)
Cancel a timer.
int odp_timer_capability(odp_timer_clk_src_t clk_src, odp_timer_capability_t *capa)
Query timer capabilities per clock source.
uint64_t odp_timer_ns_to_tick(odp_timer_pool_t timer_pool, uint64_t ns)
Convert nanoseconds to timer ticks.
int odp_timer_periodic_ack(odp_timer_t timer, odp_event_t tmo_ev)
Acknowledge timeout from a periodic timer.
uint64_t odp_timeout_to_u64(odp_timeout_t tmo)
Get printable value for an odp_timeout_t.
odp_timer_clk_src_t
Clock sources for timer pools.
int odp_timer_start(odp_timer_t timer, const odp_timer_start_t *start_param)
Start a timer.
int odp_timer_res_capability(odp_timer_clk_src_t clk_src, odp_timer_res_capability_t *res_capa)
Timer resolution capability.
int odp_timer_periodic_cancel(odp_timer_t timer)
Cancel a periodic timer.
odp_event_t odp_timeout_to_event(odp_timeout_t tmo)
Convert timeout handle to event handle.
#define ODP_TIMEOUT_INVALID
Invalid timeout handle.
odp_timer_t odp_timer_alloc(odp_timer_pool_t timer_pool, odp_queue_t queue, const void *user_ptr)
Allocate a timer.
uint64_t odp_timer_pool_to_u64(odp_timer_pool_t timer_pool)
Get printable value for an odp_timer_pool_t.
#define ODP_TIMER_INVALID
Invalid timer handle.
uint64_t odp_timer_to_u64(odp_timer_t timer)
Get printable value for an odp_timer_t.
void odp_timer_pool_param_init(odp_timer_pool_param_t *param)
Initialize timer pool parameters.
void odp_timer_pool_destroy(odp_timer_pool_t timer_pool)
Destroy a timer pool.
@ ODP_TIMER_SUCCESS
Timer operation succeeded.
@ ODP_TIMER_TOO_NEAR
Timer operation failed, too near to the current time.
@ ODP_TIMER_FAIL
Timer operation failed.
@ ODP_TIMER_TYPE_PERIODIC
Periodic timer.
@ ODP_TIMER_TYPE_SINGLE
Single shot timer.
@ ODP_TIMER_TICK_REL
Relative ticks.
Unsigned 64 bit fractional number.
uint64_t integer
Integer part.
uint64_t denom
Denominator of the fraction part.
uint64_t numer
Numerator of the fraction part.
Global initialization parameters.
odp_mem_model_t mem_model
Application memory model.
uint32_t max_num
Maximum number of buffers of any size.
struct odp_pool_capability_t::@123 tmo
Timeout pool capabilities
uint32_t num
Number of buffers in the pool.
struct odp_pool_param_t::@127 tmo
Parameters for timeout pools.
uint32_t cache_size
Maximum number of buffers cached locally per thread.
odp_pool_type_t type
Pool type.
odp_schedule_param_t sched
Scheduler parameters.
odp_queue_type_t type
Queue type.
odp_schedule_group_t group
Thread group.
odp_schedule_prio_t prio
Priority level.
Shared memory capabilities.
uint32_t max_blocks
Maximum number of shared memory blocks.
uint64_t max_size
Maximum memory block size in bytes.
odp_fract_u64_t min_base_freq_hz
Minimum supported base frequency value.
uint32_t max_timers
Maximum number of single shot timers in a pool.
uint32_t max_pools
Maximum number of timer pools for single shot timers (per clock source)
odp_fract_u64_t max_base_freq_hz
Maximum supported base frequency value.
struct odp_timer_capability_t::@156 periodic
Periodic timer capabilities.
uint64_t highest_res_ns
Highest timer resolution in nanoseconds.
odp_bool_t queue_type_sched
Scheduled queue destination support.
Periodic timer capability.
Periodic timer start parameters.
uint64_t res_ns
Timeout resolution in nanoseconds.
odp_timer_type_t timer_type
Timer type.
uint64_t max_multiplier
Maximum base frequency multiplier.
odp_fract_u64_t base_freq_hz
Timer pool base frequency in hertz.
struct odp_timer_pool_param_t::@157 periodic
Periodic timer parameters.
uint64_t min_tmo
Minimum relative timeout in nanoseconds.
uint32_t num_timers
Number of timers in the pool.
odp_timer_clk_src_t clk_src
Clock source for timers.
uint64_t max_tmo
Maximum relative timeout in nanoseconds.
Timer resolution capability.
uint64_t tick
Expiration time in ticks.
odp_event_t tmo_ev
Timeout event.
odp_timer_tick_type_t tick_type
Tick type.