22 #include <odp/helper/odph_api.h>
24 #define MODE_MEMCPY 0x1
25 #define MODE_COPY_U32 0x2
26 #define MODE_SQRT_U32 0x4
27 #define MODE_SQRT_F32 0x8
29 #define TMODE_SHARED_REL 0
30 #define TMODE_PRIVATE_REL 1
32 typedef struct test_options_t {
43 typedef struct test_stat_t {
51 typedef struct test_stat_sum_t {
58 typedef struct thread_arg_t {
64 typedef struct test_global_t {
65 test_options_t test_options;
70 uint64_t period_ticks;
80 test_stat_sum_t stat_sum;
85 test_global_t *test_global;
88 static const uint32_t pseudo_rand[] = {
89 14917, 9914, 5313, 4092, 16041, 7757, 17247, 14804, 3255, 7675,
90 13149, 7288, 5665, 7095, 9594, 1296, 2058, 6013, 17779, 11788,
91 14855, 760, 16891, 2483, 10937, 16385, 13593, 10674, 4080, 2392,
92 12218, 11475, 6009, 5798, 7582, 8358, 4520, 14655, 10555, 6598,
93 10598, 16097, 16634, 17102, 16296, 17142, 5748, 11079, 14569, 10961,
94 16693, 17775, 19155, 14102, 16132, 19561, 8746, 4521, 8280, 355,
95 10655, 14539, 5641, 2343, 19213, 9187, 570, 15096, 780, 1711,
96 8007, 8128, 17416, 14123, 4713, 13774, 11450, 9031, 1194, 16531,
97 9349, 3496, 19130, 19458, 12412, 9168, 9508, 10607, 5952, 19375,
98 14934, 18276, 12116, 510, 14272, 10362, 4095, 6789, 1600, 18509,
99 9274, 2815, 3175, 1122, 6495, 7991, 18831, 17550, 7056, 16185,
100 18594, 19178, 10028, 1182, 13410, 16173, 3548, 8013, 6099, 2619,
101 7359, 6889, 15227, 4910, 12341, 18904, 671, 5851, 9836, 18105,
102 13624, 8138, 5751, 15590, 17415, 15330, 697, 11439, 7008, 10676,
103 9863, 17163, 10885, 5581, 8078, 4689, 9870, 18370, 19323, 8831,
104 11444, 3602, 10125, 6244, 13171, 19335, 15635, 19684, 17581, 9513,
105 8444, 13724, 5243, 9987, 19886, 5087, 17292, 16294, 19627, 14985,
106 1999, 9889, 1311, 5589, 10084, 911, 301, 2260, 15305, 8265,
107 409, 1732, 1463, 17680, 15038, 2440, 4239, 9554, 14045, 924,
108 13997, 3472, 18304, 4848, 10601, 18604, 6459, 19394, 2962, 11218,
109 5405, 9869, 133, 2512, 13440, 4350, 625, 6580, 5082, 12908,
110 11517, 8919, 354, 14216, 3190, 15515, 1277, 1028, 507, 9525,
111 10115, 811, 1268, 17587, 5192, 7240, 17371, 4902, 19908, 1027,
112 3475, 8658, 11782, 13701, 13034, 154, 4940, 12679, 14067, 2707,
113 10180, 4669, 17756, 6602, 6727, 818, 8644, 580, 16988, 19127
116 static void print_usage(
void)
119 "Stress test options:\n"
121 " -c, --num_cpu Number of CPUs (worker threads). 0: all available CPUs. Default: 1\n"
122 " -p, --period_ns Timeout period in nsec. Default: 100 ms\n"
123 " -r, --rounds Number of timeout rounds. Default: 2\n"
124 " -m, --mode Test mode flags, multiple may be selected. Default: 0x1\n"
125 " 0: No stress, just wait for timeouts\n"
127 " 0x2: Memory copy loop\n"
128 " 0x4: Integer square root\n"
129 " 0x8: Floating point square root\n"
130 " -s, --mem_size Memory size per worker in bytes. Default: 2048\n"
131 " -g, --group_mode Select schedule group mode: Default: 1\n"
132 " 0: Use GROUP_ALL group. Scheduler load balances timeout events.\n"
133 " 1: Create a group per CPU. Dedicated timeout event per CPU.\n"
134 " -t, --timer_mode Select timer mode: Default: 0\n"
135 " 0: Shared timer pool with relative timers\n"
136 " 1: Private (per worker) timer pools with relative timers. Requires\n"
137 " private schedule group mode (-g 1).\n"
138 " -h, --help This help\n"
142 static int parse_options(
int argc,
char *argv[], test_options_t *test_options)
147 static const struct option longopts[] = {
148 {
"num_cpu", required_argument, NULL,
'c'},
149 {
"period_ns", required_argument, NULL,
'p'},
150 {
"rounds", required_argument, NULL,
'r'},
151 {
"mode", required_argument, NULL,
'm'},
152 {
"mem_size", required_argument, NULL,
's'},
153 {
"group_mode", required_argument, NULL,
'g'},
154 {
"timer_mode", required_argument, NULL,
't'},
155 {
"help", no_argument, NULL,
'h'},
159 static const char *shortopts =
"+c:p:r:m:s:t:g:h";
161 test_options->num_cpu = 1;
163 test_options->rounds = 2;
164 test_options->mode = MODE_MEMCPY;
165 test_options->mem_size = 2048;
166 test_options->group_mode = 1;
167 test_options->timer_mode = TMODE_SHARED_REL;
170 opt = getopt_long(argc, argv, shortopts, longopts, NULL);
177 test_options->num_cpu = atoi(optarg);
180 test_options->period_ns = atoll(optarg);
183 test_options->rounds = atoll(optarg);
186 test_options->mode = strtoul(optarg, NULL, 0);
189 test_options->mem_size = atoll(optarg);
192 test_options->group_mode = atoi(optarg);
195 test_options->timer_mode = atoi(optarg);
206 if (test_options->mode) {
207 if (test_options->mem_size <
sizeof(uint32_t)) {
208 ODPH_ERR(
"Too small memory size. Minimum is %zu bytes.\n",
214 if (test_options->timer_mode == TMODE_PRIVATE_REL && test_options->group_mode == 0) {
215 ODPH_ERR(
"Private timer mode requires private schedule group mode\n");
222 static int set_num_cpu(test_global_t *global)
225 test_options_t *test_options = &global->test_options;
226 int num_cpu = test_options->num_cpu;
236 if (num_cpu && ret != num_cpu) {
237 ODPH_ERR(
"Too many workers. Max supported %i\n.", ret);
244 test_options->num_cpu = num_cpu;
252 static int join_group(test_global_t *global,
int worker_idx,
int thr)
259 group = global->group[worker_idx];
262 ODPH_ERR(
"Thread %i failed to join group %i\n", thr, worker_idx);
269 static int create_timer_pool(test_global_t *global,
odp_timer_pool_t *timer_pool)
277 ODPH_ERR(
"Timer pool create failed\n");
282 ODPH_ERR(
"Timer pool start failed\n");
300 ODPH_ERR(
"Timeout alloc failed (%u)\n", worker_idx);
304 timer =
odp_timer_alloc(timer_pool, global->tmo_queue[worker_idx], NULL);
307 ODPH_ERR(
"Timer alloc failed (%u)\n", worker_idx);
316 ODPH_ERR(
"Timer start failed (%i)\n", worker_idx);
323 static int worker_thread(
void *arg)
330 uint64_t tot_nsec, work_sum, max_nsec, i;
336 uint8_t *src = NULL, *dst = NULL;
337 uint32_t *src_u32 = NULL, *dst_u32 = NULL;
338 thread_arg_t *thread_arg = arg;
339 int worker_idx = thread_arg->worker_idx;
340 test_global_t *global = thread_arg->global;
341 test_options_t *test_options = &global->test_options;
342 const int group_mode = test_options->group_mode;
343 const int mode = test_options->mode;
344 const int data_mode = mode & (MODE_SQRT_U32 | MODE_SQRT_F32);
345 const uint64_t mem_size = test_options->mem_size;
346 const uint64_t copy_size = mem_size / 2;
347 const uint64_t num_words = mem_size /
sizeof(uint32_t);
348 const uint64_t copy_words = num_words / 2;
350 uint64_t dummy_sum = 0;
353 uint64_t tot_rounds = test_options->rounds * test_options->num_cpu;
356 max_nsec = 2 * test_options->rounds * test_options->period_ns;
358 printf(
"Thread %i starting on CPU %i\n", thr,
odp_cpu_id());
360 if (group_mode == 0) {
365 if (join_group(global, worker_idx, thr)) {
373 src = (uint8_t *)global->worker_mem + worker_idx * mem_size;
374 dst = src + copy_size;
375 src_u32 = (uint32_t *)(uintptr_t)src;
376 dst_u32 = (uint32_t *)(uintptr_t)dst;
380 start_param.
tick = global->period_ticks;
382 if (test_options->timer_mode == TMODE_PRIVATE_REL) {
385 ret = create_timer_pool(global, &priv_timer_pool);
389 test_options->period_ns);
390 ret = start_timer(global, priv_timer_pool, &start_param, worker_idx,
431 if (rounds >= test_options->rounds)
446 ODPH_ERR(
"Timer start failed (%" PRIu64
")\n", rounds);
455 if (mode & MODE_MEMCPY)
456 memcpy(dst, src, copy_size);
458 if (mode & MODE_COPY_U32)
459 for (i = 0; i < copy_words; i++)
460 dst_u32[i] = src_u32[i];
463 for (i = 0; i < num_words; i++) {
464 if (mode & MODE_SQRT_U32)
465 dummy_sum += odph_stress_sqrt_u32(src_u32[i]);
467 if (mode & MODE_SQRT_F32)
468 dummy_sum += odph_stress_sqrt_f32(src_u32[i]);
487 global->stat[thr].rounds = rounds;
488 global->stat[thr].tot_nsec = tot_nsec;
489 global->stat[thr].work_nsec = work_sum;
490 global->stat[thr].dummy_sum = dummy_sum;
501 static int start_workers(test_global_t *global,
odp_instance_t instance)
503 odph_thread_common_param_t thr_common;
505 test_options_t *test_options = &global->test_options;
506 int num_cpu = test_options->num_cpu;
507 odph_thread_param_t thr_param[num_cpu];
509 memset(global->thread_tbl, 0,
sizeof(global->thread_tbl));
510 odph_thread_common_param_init(&thr_common);
512 thr_common.instance = instance;
513 thr_common.cpumask = &global->cpumask;
515 for (i = 0; i < num_cpu; i++) {
516 odph_thread_param_init(&thr_param[i]);
517 thr_param[i].start = worker_thread;
518 thr_param[i].arg = &global->thread_arg[i];
522 ret = odph_thread_create(global->thread_tbl, &thr_common, thr_param, num_cpu);
524 if (ret != num_cpu) {
525 ODPH_ERR(
"Thread create failed %i\n", ret);
532 static int create_timeout_pool(test_global_t *global)
540 test_options_t *test_options = &global->test_options;
541 uint32_t num_cpu = test_options->num_cpu;
542 uint64_t period_ns = test_options->period_ns;
543 uint64_t res_ns = period_ns / 1000;
546 if (test_options->timer_mode == TMODE_PRIVATE_REL)
550 ODPH_ERR(
"Timer capability failed\n");
555 ODPH_ERR(
"Timer does not support sched queues\n");
560 ODPH_ERR(
"Too many timer pools requested %u (max %u)\n", num_tp,
566 timer_res_capa.
max_tmo = 2 * period_ns;
568 ODPH_ERR(
"Timer resolution capability failed. Too long period.\n");
572 if (res_ns < timer_res_capa.
res_ns)
573 res_ns = timer_res_capa.
res_ns;
577 printf(
" num timers %u\n", num_cpu);
578 printf(
" resolution %" PRIu64
" nsec\n", res_ns);
579 printf(
" period %" PRIu64
" nsec\n", period_ns);
580 printf(
" test duration %.2f sec\n", duration);
581 if (test_options->group_mode == 0)
582 printf(
" force stop after %.2f sec\n", 2 * duration);
587 pool_param.
tmo.
num = 4 * num_cpu;
591 global->tmo_pool = pool;
593 ODPH_ERR(
"Pool create failed\n");
598 timer_pool_param->
res_ns = res_ns;
599 timer_pool_param->
min_tmo = period_ns / 2;
600 timer_pool_param->
max_tmo = 2 * period_ns;
604 if (test_options->timer_mode == TMODE_PRIVATE_REL)
605 timer_pool_param->
priv = 1;
610 static int create_queues(test_global_t *global)
616 test_options_t *test_options = &global->test_options;
617 uint32_t num_cpu = test_options->num_cpu;
620 ODPH_ERR(
"Schedule capability failed\n");
624 if (test_options->group_mode) {
626 ODPH_ERR(
"Too many workers. Not enough schedule groups.\n");
633 for (i = 0; i < num_cpu; i++) {
637 ODPH_ERR(
"Schedule group create failed (%u)\n", i);
648 for (i = 0; i < num_cpu; i++) {
649 if (test_options->group_mode)
655 ODPH_ERR(
"Timeout dest queue create failed (%u)\n", i);
663 static int start_shared_timers(test_global_t *global)
667 test_options_t *test_options = &global->test_options;
668 uint32_t num_cpu = test_options->num_cpu;
672 for (i = 0; i < num_cpu; i++) {
676 ODPH_ERR(
"Timeout alloc failed (%u)\n", i);
681 for (i = 0; i < num_cpu; i++) {
682 timer[i] =
odp_timer_alloc(global->timer_pool, global->tmo_queue[i], NULL);
685 ODPH_ERR(
"Timer alloc failed (%u)\n", i);
689 global->timer[i] = timer[i];
693 start_param.
tick = global->period_ticks;
695 for (i = 0; i < num_cpu; i++) {
699 ODPH_ERR(
"Timer start failed (%u)\n", i);
707 static void destroy_timers(test_global_t *global)
710 test_options_t *test_options = &global->test_options;
711 uint32_t num_cpu = test_options->num_cpu;
713 for (i = 0; i < num_cpu; i++) {
720 ODPH_ERR(
"Timer free failed (%u)\n", i);
727 static void destroy_queues(test_global_t *global)
730 test_options_t *test_options = &global->test_options;
731 uint32_t num_cpu = test_options->num_cpu;
733 for (i = 0; i < num_cpu; i++) {
740 ODPH_ERR(
"Queue destroy failed (%u)\n", i);
743 if (test_options->group_mode) {
744 for (i = 0; i < num_cpu; i++) {
751 ODPH_ERR(
"Schedule group destroy failed (%u)\n", i);
759 static void sig_handler(
int signo)
763 if (test_global == NULL)
769 static void stop_workers(test_global_t *global)
775 test_options_t *test_options = &global->test_options;
776 uint32_t num_cpu = test_options->num_cpu;
780 for (i = 0; i < num_cpu; i++) {
781 queue = global->tmo_queue[i];
792 ODPH_ERR(
"Enqueue failed %u\n", i);
798 static void sum_stat(test_global_t *global)
801 test_options_t *test_options = &global->test_options;
802 uint32_t num_cpu = test_options->num_cpu;
803 test_stat_sum_t *sum = &global->stat_sum;
805 memset(sum, 0,
sizeof(test_stat_sum_t));
807 for (i = 1; i < num_cpu + 1 ; i++) {
808 sum->rounds += global->stat[i].rounds;
809 sum->tot_nsec += global->stat[i].tot_nsec;
810 sum->work_nsec += global->stat[i].work_nsec;
814 static void print_stat(test_global_t *global)
817 test_options_t *test_options = &global->test_options;
818 uint32_t num_cpu = test_options->num_cpu;
819 int mode = test_options->mode;
820 test_stat_sum_t *sum = &global->stat_sum;
821 double sec_ave, work_ave, perc;
822 double round_ave = 0.0;
823 double rate_ave = 0.0;
824 double rate_tot = 0.0;
825 double cpu_load = 0.0;
826 const double mega = 1000000.0;
827 const double giga = 1000000000.0;
833 sec_ave = (sum->tot_nsec / giga) / num_cpu;
834 work_ave = (sum->work_nsec / giga) / num_cpu;
837 printf(
"CPU load from work (percent) per thread:\n");
838 printf(
"----------------------------------------------\n");
839 printf(
" 1 2 3 4 5 6 7 8 9 10");
841 for (i = 1; i < num_cpu + 1; i++) {
842 if (global->stat[i].tot_nsec == 0)
848 perc = 100.0 * ((double)global->stat[i].work_nsec) / global->stat[i].tot_nsec;
850 printf(
"%6.2f ", perc);
855 round_ave = (double)sum->rounds / num_cpu;
856 cpu_load = 100.0 * (work_ave / sec_ave);
861 if (mode == MODE_MEMCPY || mode == MODE_COPY_U32 ||
862 mode == (MODE_COPY_U32 | MODE_MEMCPY))
863 data_bytes = sum->rounds * test_options->mem_size / 2;
865 data_bytes = sum->rounds * test_options->mem_size;
867 rate_ave = data_bytes / (sum->work_nsec / giga);
868 rate_tot = rate_ave * num_cpu;
873 printf(
"TOTAL (%i workers)\n", num_cpu);
874 printf(
" ave time: %.2f sec\n", sec_ave);
875 printf(
" ave work: %.2f sec\n", work_ave);
876 printf(
" ave CPU load: %.2f\n", cpu_load);
877 printf(
" ave rounds per sec: %.2f\n", round_ave / sec_ave);
878 printf(
" ave data rate: %.2f MB/sec\n", rate_ave / mega);
879 printf(
" total data rate: %.2f MB/sec\n", rate_tot / mega);
883 int main(
int argc,
char **argv)
885 odph_helper_options_t helper_options;
890 test_global_t *global;
891 test_options_t *test_options;
896 int shared_timers = 1;
898 signal(SIGINT, sig_handler);
901 argc = odph_parse_options(argc, argv);
902 if (odph_options(&helper_options)) {
903 ODPH_ERR(
"Reading ODP helper options failed.\n");
908 init.
mem_model = helper_options.mem_model;
911 ODPH_ERR(
"Global init failed.\n");
916 ODPH_ERR(
"Local init failed.\n");
920 shm =
odp_shm_reserve(
"Stress global",
sizeof(test_global_t), ODP_CACHE_LINE_SIZE, 0);
923 ODPH_ERR(
"SHM reserve failed.\n");
928 if (global == NULL) {
929 ODPH_ERR(
"SHM addr failed\n");
932 test_global = global;
934 memset(global, 0,
sizeof(test_global_t));
946 global->thread_arg[i].global = global;
947 global->thread_arg[i].worker_idx = i;
950 if (parse_options(argc, argv, &global->test_options))
953 test_options = &global->test_options;
954 mode = test_options->mode;
965 if (set_num_cpu(global))
968 num_cpu = test_options->num_cpu;
974 uint32_t num_rand = ODPH_ARRAY_SIZE(pseudo_rand);
976 mem_size = test_options->mem_size * num_cpu;
978 shm =
odp_shm_reserve(
"Test memory", mem_size, ODP_CACHE_LINE_SIZE, 0);
981 ODPH_ERR(
"SHM reserve failed.\n");
986 if (global->worker_mem == NULL) {
987 ODPH_ERR(
"SHM addr failed\n");
991 num_words = mem_size /
sizeof(uint32_t);
992 word = (uint32_t *)global->worker_mem;
994 for (uint64_t j = 0; j < num_words; j++)
995 word[j] = pseudo_rand[j % num_rand];
1000 printf(
"Test parameters\n");
1001 printf(
" num workers %u\n", num_cpu);
1002 printf(
" mode 0x%x\n", mode);
1003 printf(
" group mode %i\n", test_options->group_mode);
1004 printf(
" timer mode %i\n", test_options->timer_mode);
1005 printf(
" mem size per worker %" PRIu64
" bytes\n", test_options->mem_size);
1007 if (test_options->timer_mode != TMODE_SHARED_REL)
1010 if (create_timeout_pool(global))
1013 if (shared_timers) {
1017 if (create_timer_pool(global, &tp))
1020 global->timer_pool = tp;
1024 if (create_queues(global))
1028 start_workers(global, instance);
1033 if (shared_timers) {
1034 if (start_shared_timers(global)) {
1036 ODPH_ERR(
"Timers did not start. Stopping workers.\n");
1037 stop_workers(global);
1042 odph_thread_join(global->thread_tbl, num_cpu);
1049 destroy_timers(global);
1051 destroy_queues(global);
1055 ODPH_ERR(
"SHM free failed.\n");
1061 ODPH_ERR(
"SHM free failed.\n");
1066 ODPH_ERR(
"Term local failed.\n");
1071 ODPH_ERR(
"Term global failed.\n");
void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val)
Initialize atomic uint32 variable.
void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val)
Add to atomic uint32 variable.
uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom)
Load value of atomic uint32 variable.
void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val)
Initialize atomic uint64 variable.
uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom)
Fetch and increment atomic uint64 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.
int odp_cpu_id(void)
CPU identifier.
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.
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.
odp_pool_t odp_pool_create(const char *name, const odp_pool_param_t *param)
Create a pool.
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.
int odp_queue_enq(odp_queue_t queue, odp_event_t ev)
Enqueue an event to a 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.
#define ODP_SCHED_WAIT
Wait infinitely.
#define ODP_SCHED_SYNC_PARALLEL
Parallel scheduled queues.
int odp_schedule_group_t
Scheduler thread group.
void odp_schedule_config_init(odp_schedule_config_t *config)
Initialize schedule configuration options.
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_config(const odp_schedule_config_t *config)
Global schedule configuration.
uint64_t odp_schedule_wait_time(uint64_t ns)
Schedule wait time.
int odp_schedule_capability(odp_schedule_capability_t *capa)
Query scheduler capabilities.
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.
#define ODP_SCHED_GROUP_ALL
Group of all threads.
int odp_shm_free(odp_shm_t shm)
Free a contiguous block of shared memory.
#define ODP_SHM_INVALID
Invalid shared memory block.
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.
void odp_sys_info_print(void)
Print system info.
#define ODP_THREAD_COUNT_MAX
Maximum number of threads supported in build time.
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.
odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
Time sum.
#define ODP_TIME_SEC_IN_NS
A second in nanoseconds.
odp_time_t odp_time_local_from_ns(uint64_t ns)
Convert nanoseconds to local time.
odp_time_t odp_time_local(void)
Current local time.
#define ODP_TIME_MSEC_IN_NS
A millisecond in nanoseconds.
int odp_time_cmp(odp_time_t t2, odp_time_t t1)
Compare two times.
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.
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.
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_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_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.
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.
#define ODP_CLOCK_DEFAULT
The default clock source.
#define ODP_TIMER_INVALID
Invalid timer handle.
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_TICK_REL
Relative ticks.
Global initialization parameters.
odp_mem_model_t mem_model
Application memory model.
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.
uint32_t max_groups
Maximum number of scheduling groups.
odp_bool_t worker
ODP_SCHED_GROUP_WORKER.
odp_bool_t control
ODP_SCHED_GROUP_CONTROL.
struct odp_schedule_config_t::@143 sched_group
Enable/disable predefined scheduling groups.
odp_bool_t all
ODP_SCHED_GROUP_ALL.
odp_schedule_group_t group
Thread group.
odp_schedule_sync_t sync
Synchronization method.
uint32_t max_pools
Maximum number of timer pools for single shot timers (per clock source)
odp_bool_t queue_type_sched
Scheduled queue destination support.
uint64_t res_ns
Timeout resolution in nanoseconds.
int priv
Thread private timer pool.
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 max_tmo
Maximum relative timeout in nanoseconds.
uint64_t res_ns
Timeout resolution in nanoseconds.
uint64_t tick
Expiration time in ticks.
odp_event_t tmo_ev
Timeout event.
odp_timer_tick_type_t tick_type
Tick type.