18#include <odp/helper/odph_api.h>
20#include <bench_common.h>
21#include <export_results.h>
30#define REPEAT_COUNT 1024
36#define TEST_MAX_BENCH 70
38#define BENCH_INFO(run_fn, init_fn, max, alt_name) \
39 {.name = #run_fn, .run = run_fn, .init = init_fn, .max_rounds = max, .desc = alt_name}
71 uint64_t a1[REPEAT_COUNT];
72 uint64_t a2[REPEAT_COUNT];
73 uint32_t b1[REPEAT_COUNT];
74 uint32_t b2[REPEAT_COUNT];
75 uint16_t c1[REPEAT_COUNT];
76 uint16_t c2[REPEAT_COUNT];
82 double result[TEST_MAX_BENCH];
86static gbl_args_t *gbl_args;
95static int setup_sig_handler(
void)
97 struct sigaction action;
99 memset(&action, 0,
sizeof(action));
100 action.sa_handler = sig_handler;
104 if (sigemptyset(&action.sa_mask))
107 if (sigaction(SIGINT, &action, NULL))
113static void init_time_global(
void)
118 uint64_t *a1 = gbl_args->a1;
120 for (i = 0; i < REPEAT_COUNT; i++)
123 for (i = 0; i < REPEAT_COUNT; i++)
126 for (i = 0; i < REPEAT_COUNT; i++)
130static void init_time_local(
void)
135 uint64_t *a1 = gbl_args->a1;
137 for (i = 0; i < REPEAT_COUNT; i++)
140 for (i = 0; i < REPEAT_COUNT; i++)
143 for (i = 0; i < REPEAT_COUNT; i++)
147static void init_cpu_cycles(
void)
150 uint64_t *a1 = gbl_args->a1;
151 uint64_t *a2 = gbl_args->a2;
153 for (i = 0; i < REPEAT_COUNT; i++)
156 for (i = 0; i < REPEAT_COUNT; i++)
160static int time_local(
void)
165 for (i = 0; i < REPEAT_COUNT; i++)
171static int time_local_strict(
void)
176 for (i = 0; i < REPEAT_COUNT; i++)
182static int time_local_ns(
void)
185 uint64_t *a1 = gbl_args->a1;
187 for (i = 0; i < REPEAT_COUNT; i++)
193static int time_local_strict_ns(
void)
196 uint64_t *a1 = gbl_args->a1;
198 for (i = 0; i < REPEAT_COUNT; i++)
204static int time_global(
void)
209 for (i = 0; i < REPEAT_COUNT; i++)
215static int time_global_strict(
void)
220 for (i = 0; i < REPEAT_COUNT; i++)
226static int time_global_ns(
void)
229 uint64_t *a1 = gbl_args->a1;
231 for (i = 0; i < REPEAT_COUNT; i++)
237static int time_global_strict_ns(
void)
240 uint64_t *a1 = gbl_args->a1;
242 for (i = 0; i < REPEAT_COUNT; i++)
248static int time_diff(
void)
255 for (i = 0; i < REPEAT_COUNT; i++)
261static int time_diff_ns(
void)
268 for (i = 0; i < REPEAT_COUNT; i++)
271 gbl_args->suite.dummy += res;
276static int time_add_ns(
void)
281 uint64_t *a1 = gbl_args->a1;
283 for (i = 0; i < REPEAT_COUNT; i++)
289static int time_sum(
void)
296 for (i = 0; i < REPEAT_COUNT; i++)
302static int time_to_ns_short(
void)
308 for (i = 0; i < REPEAT_COUNT; i++)
311 gbl_args->suite.dummy += res;
316static int time_to_ns_long(
void)
322 for (i = 0; i < REPEAT_COUNT; i++)
325 gbl_args->suite.dummy += res;
330static int time_local_from_ns(
void)
334 uint64_t *a1 = gbl_args->a1;
336 for (i = 0; i < REPEAT_COUNT; i++)
342static int time_global_from_ns(
void)
346 uint64_t *a1 = gbl_args->a1;
348 for (i = 0; i < REPEAT_COUNT; i++)
354static int time_cmp(
void)
361 for (i = 0; i < REPEAT_COUNT; i++)
364 gbl_args->suite.dummy += res;
369static int time_local_res(
void)
372 uint64_t *a1 = gbl_args->a1;
374 for (i = 0; i < REPEAT_COUNT; i++)
380static int time_global_res(
void)
383 uint64_t *a1 = gbl_args->a1;
385 for (i = 0; i < REPEAT_COUNT; i++)
391static int time_startup(
void)
394 uint64_t *a1 = gbl_args->a1;
397 for (i = 0; i < REPEAT_COUNT; i++) {
405static int cpu_id(
void)
408 uint64_t *a1 = gbl_args->a1;
410 for (i = 0; i < REPEAT_COUNT; i++)
416static int cpu_count(
void)
419 uint64_t *a1 = gbl_args->a1;
421 for (i = 0; i < REPEAT_COUNT; i++)
427static int cpu_hz(
void)
430 uint64_t *a1 = gbl_args->a1;
432 for (i = 0; i < REPEAT_COUNT; i++)
438static int cpu_hz_id(
void)
442 uint64_t *a1 = gbl_args->a1;
444 for (i = 0; i < REPEAT_COUNT; i++)
450static int cpu_hz_max(
void)
453 uint64_t *a1 = gbl_args->a1;
455 for (i = 0; i < REPEAT_COUNT; i++)
461static int cpu_hz_max_id(
void)
465 uint64_t *a1 = gbl_args->a1;
467 for (i = 0; i < REPEAT_COUNT; i++)
473static int cpu_cycles(
void)
476 uint64_t *a1 = gbl_args->a1;
478 for (i = 0; i < REPEAT_COUNT; i++)
484static int cpu_cycles_diff(
void)
487 uint64_t *a1 = gbl_args->a1;
488 uint64_t *a2 = gbl_args->a2;
491 for (i = 0; i < REPEAT_COUNT; i++)
494 gbl_args->suite.dummy += res;
499static int cpu_cycles_max(
void)
502 uint64_t *a1 = gbl_args->a1;
504 for (i = 0; i < REPEAT_COUNT; i++)
510static int cpu_cycles_resolution(
void)
513 uint64_t *a1 = gbl_args->a1;
515 for (i = 0; i < REPEAT_COUNT; i++)
521static int cpu_pause(
void)
525 for (i = 0; i < REPEAT_COUNT; i++)
531static int thread_id(
void)
534 uint64_t *a1 = gbl_args->a1;
536 for (i = 0; i < REPEAT_COUNT; i++)
542static int thread_count(
void)
545 uint64_t *a1 = gbl_args->a1;
547 for (i = 0; i < REPEAT_COUNT; i++)
553static int thread_count_max(
void)
556 uint64_t *a1 = gbl_args->a1;
558 for (i = 0; i < REPEAT_COUNT; i++)
564static int thread_type(
void)
567 uint64_t *a1 = gbl_args->a1;
569 for (i = 0; i < REPEAT_COUNT; i++)
575static int be_to_cpu_64(
void)
578 uint64_t *a1 = gbl_args->a1;
579 uint64_t *a2 = gbl_args->a2;
581 for (i = 0; i < REPEAT_COUNT; i++)
587static int be_to_cpu_32(
void)
590 uint32_t *b1 = gbl_args->b1;
591 uint32_t *b2 = gbl_args->b2;
593 for (i = 0; i < REPEAT_COUNT; i++)
599static int be_to_cpu_16(
void)
602 uint16_t *c1 = gbl_args->c1;
603 uint16_t *c2 = gbl_args->c2;
605 for (i = 0; i < REPEAT_COUNT; i++)
611static int cpu_to_be_64(
void)
614 uint64_t *a1 = gbl_args->a1;
615 uint64_t *a2 = gbl_args->a2;
617 for (i = 0; i < REPEAT_COUNT; i++)
623static int cpu_to_be_32(
void)
626 uint32_t *b1 = gbl_args->b1;
627 uint32_t *b2 = gbl_args->b2;
629 for (i = 0; i < REPEAT_COUNT; i++)
635static int cpu_to_be_16(
void)
638 uint16_t *c1 = gbl_args->c1;
639 uint16_t *c2 = gbl_args->c2;
641 for (i = 0; i < REPEAT_COUNT; i++)
647static int le_to_cpu_64(
void)
650 uint64_t *a1 = gbl_args->a1;
651 uint64_t *a2 = gbl_args->a2;
653 for (i = 0; i < REPEAT_COUNT; i++)
659static int le_to_cpu_32(
void)
662 uint32_t *b1 = gbl_args->b1;
663 uint32_t *b2 = gbl_args->b2;
665 for (i = 0; i < REPEAT_COUNT; i++)
671static int le_to_cpu_16(
void)
674 uint16_t *c1 = gbl_args->c1;
675 uint16_t *c2 = gbl_args->c2;
677 for (i = 0; i < REPEAT_COUNT; i++)
683static int cpu_to_le_64(
void)
686 uint64_t *a1 = gbl_args->a1;
687 uint64_t *a2 = gbl_args->a2;
689 for (i = 0; i < REPEAT_COUNT; i++)
695static int cpu_to_le_32(
void)
698 uint32_t *b1 = gbl_args->b1;
699 uint32_t *b2 = gbl_args->b2;
701 for (i = 0; i < REPEAT_COUNT; i++)
707static int cpu_to_le_16(
void)
710 uint16_t *c1 = gbl_args->c1;
711 uint16_t *c2 = gbl_args->c2;
713 for (i = 0; i < REPEAT_COUNT; i++)
719static int mb_release(
void)
723 for (i = 0; i < REPEAT_COUNT; i++)
729static int mb_acquire(
void)
733 for (i = 0; i < REPEAT_COUNT; i++)
739static int mb_full(
void)
743 for (i = 0; i < REPEAT_COUNT; i++)
749typedef void (*prefetch_fn_t)(
const void *addr);
751static int run_prefetch(prefetch_fn_t fn)
753 uint64_t *a1 = gbl_args->a1;
757 for (i = 0; i < REPEAT_COUNT; i++) {
769static int prefetch(
void) {
return run_prefetch(
odp_prefetch); }
782static int bench_misc_export(
void *data)
784 gbl_args_t *gbl_args = data;
787 if (test_common_write(
"%s", gbl_args->appl.time ?
788 "function name,average nsec per function call\n" :
789 "function name,average cpu cycles per function call\n")) {
794 for (
int i = 0; i < gbl_args->suite.num_bench; i++) {
795 if (test_common_write(
"odp_%s,%f\n", gbl_args->suite.bench[i].desc != NULL ?
796 gbl_args->suite.bench[i].desc : gbl_args->suite.bench[i].name,
797 gbl_args->suite.result[i])) {
804 test_common_write_term();
809bench_info_t test_suite[] = {
810 BENCH_INFO(time_local, NULL, 0, NULL),
811 BENCH_INFO(time_local_strict, NULL, 0, NULL),
812 BENCH_INFO(time_local_ns, NULL, 0, NULL),
813 BENCH_INFO(time_local_strict_ns, NULL, 0, NULL),
814 BENCH_INFO(time_global, NULL, 0, NULL),
815 BENCH_INFO(time_global_strict, NULL, 0, NULL),
816 BENCH_INFO(time_global_ns, NULL, 0, NULL),
817 BENCH_INFO(time_global_strict_ns, NULL, 0, NULL),
818 BENCH_INFO(time_diff, init_time_global, 0,
"time_diff (global)"),
819 BENCH_INFO(time_diff, init_time_local, 0,
"time_diff (local)"),
820 BENCH_INFO(time_diff_ns, init_time_global, 0, NULL),
821 BENCH_INFO(time_add_ns, init_time_global, 0, NULL),
822 BENCH_INFO(time_sum, init_time_global, 0, NULL),
823 BENCH_INFO(time_to_ns_short, NULL, 0,
"time_to_ns (short)"),
824 BENCH_INFO(time_to_ns_long, NULL, 0,
"time_to_ns (long)"),
825 BENCH_INFO(time_local_from_ns, init_time_global, 0, NULL),
826 BENCH_INFO(time_global_from_ns, init_time_global, 0, NULL),
827 BENCH_INFO(time_cmp, init_time_global, 0, NULL),
828 BENCH_INFO(time_local_res, NULL, 0, NULL),
829 BENCH_INFO(time_global_res, NULL, 0, NULL),
830 BENCH_INFO(time_startup, NULL, 0, NULL),
831 BENCH_INFO(cpu_id, NULL, 0, NULL),
832 BENCH_INFO(cpu_count, NULL, 0, NULL),
833 BENCH_INFO(cpu_hz, NULL, 1, NULL),
834 BENCH_INFO(cpu_hz_id, NULL, 1, NULL),
835 BENCH_INFO(cpu_hz_max, NULL, 0, NULL),
836 BENCH_INFO(cpu_hz_max_id, NULL, 0, NULL),
837 BENCH_INFO(cpu_cycles, NULL, 0, NULL),
838 BENCH_INFO(cpu_cycles_diff, init_cpu_cycles, 0, NULL),
839 BENCH_INFO(cpu_cycles_max, NULL, 0, NULL),
840 BENCH_INFO(cpu_cycles_resolution, NULL, 0, NULL),
841 BENCH_INFO(cpu_pause, NULL, 0, NULL),
842 BENCH_INFO(thread_id, NULL, 0, NULL),
843 BENCH_INFO(thread_count, NULL, 0, NULL),
844 BENCH_INFO(thread_count_max, NULL, 0, NULL),
845 BENCH_INFO(thread_type, NULL, 0, NULL),
846 BENCH_INFO(be_to_cpu_64, NULL, 0, NULL),
847 BENCH_INFO(be_to_cpu_32, NULL, 0, NULL),
848 BENCH_INFO(be_to_cpu_16, NULL, 0, NULL),
849 BENCH_INFO(cpu_to_be_64, NULL, 0, NULL),
850 BENCH_INFO(cpu_to_be_32, NULL, 0, NULL),
851 BENCH_INFO(cpu_to_be_16, NULL, 0, NULL),
852 BENCH_INFO(le_to_cpu_64, NULL, 0, NULL),
853 BENCH_INFO(le_to_cpu_32, NULL, 0, NULL),
854 BENCH_INFO(le_to_cpu_16, NULL, 0, NULL),
855 BENCH_INFO(cpu_to_le_64, NULL, 0, NULL),
856 BENCH_INFO(cpu_to_le_32, NULL, 0, NULL),
857 BENCH_INFO(cpu_to_le_16, NULL, 0, NULL),
858 BENCH_INFO(mb_release, NULL, 0, NULL),
859 BENCH_INFO(mb_acquire, NULL, 0, NULL),
860 BENCH_INFO(mb_full, NULL, 0, NULL),
861 BENCH_INFO(prefetch, NULL, 0, NULL),
862 BENCH_INFO(prefetch_l1, NULL, 0, NULL),
863 BENCH_INFO(prefetch_l2, NULL, 0, NULL),
864 BENCH_INFO(prefetch_l3, NULL, 0, NULL),
865 BENCH_INFO(prefetch_strm_l1, NULL, 0, NULL),
866 BENCH_INFO(prefetch_l1i, NULL, 0, NULL),
867 BENCH_INFO(prefetch_store, NULL, 0, NULL),
868 BENCH_INFO(prefetch_store_l1, NULL, 0, NULL),
869 BENCH_INFO(prefetch_store_l2, NULL, 0, NULL),
870 BENCH_INFO(prefetch_store_l3, NULL, 0, NULL),
871 BENCH_INFO(prefetch_store_strm_l1, NULL, 0, NULL),
875 "Result array is too small to hold all the results");
878static void usage(
void)
881 "ODP miscellaneous API micro benchmarks\n"
884 " -t, --time <opt> Time measurement. 0: measure CPU cycles (default), 1: measure time\n"
885 " -i, --index <idx> Benchmark index to run indefinitely.\n"
886 " -r, --rounds <num> Run each test case 'num' times (default %u).\n"
887 " -h, --help Display help and exit.\n\n"
892static int parse_args(
int argc,
char *argv[])
895 appl_args_t *appl_args = &gbl_args->appl;
896 static const struct option longopts[] = {
897 {
"time", required_argument, NULL,
't'},
898 {
"index", required_argument, NULL,
'i'},
899 {
"rounds", required_argument, NULL,
'r'},
900 {
"help", no_argument, NULL,
'h'},
904 static const char *shortopts =
"t:i:r:h";
907 appl_args->bench_idx = 0;
908 appl_args->rounds = ROUNDS;
911 opt = getopt_long(argc, argv, shortopts, longopts, NULL);
918 appl_args->time = atoi(optarg);
921 appl_args->bench_idx = atoi(optarg);
924 appl_args->rounds = atoi(optarg);
930 ODPH_ERR(
"Bad option. Use -h for help.\n");
935 if (appl_args->rounds < 1) {
936 ODPH_ERR(
"Invalid test cycle repeat count: %u\n", appl_args->rounds);
940 if (appl_args->bench_idx < 0 || appl_args->bench_idx > (
int)ODPH_ARRAY_SIZE(test_suite)) {
941 ODPH_ERR(
"Bad bench index %i\n", appl_args->bench_idx);
951static void print_info(
void)
956 "odp_bench_misc options\n"
957 "----------------------\n");
959 printf(
"CPU mask: %s\n", gbl_args->cpumask_str);
960 printf(
"Measurement unit: %s\n", gbl_args->appl.time ?
"nsec" :
"CPU cycles");
961 printf(
"Test rounds: %u\n", gbl_args->appl.rounds);
965int main(
int argc,
char *argv[])
967 odph_helper_options_t helper_options;
968 test_common_options_t common_options;
969 odph_thread_t worker_thread;
970 odph_thread_common_param_t thr_common;
971 odph_thread_param_t thr_param;
980 argc = odph_parse_options(argc, argv);
981 if (odph_options(&helper_options)) {
982 ODPH_ERR(
"Reading ODP helper options failed\n");
986 argc = test_common_parse_options(argc, argv);
987 if (test_common_options(&common_options)) {
988 ODPH_ERR(
"Reading test options failed\n");
993 init_param.
mem_model = helper_options.mem_model;
997 ODPH_ERR(
"Global init failed\n");
1003 ODPH_ERR(
"Local init failed\n");
1007 if (setup_sig_handler()) {
1008 ODPH_ERR(
"Signal handler setup failed\n");
1013 shm =
odp_shm_reserve(
"shm_args",
sizeof(gbl_args_t), ODP_CACHE_LINE_SIZE, 0);
1015 ODPH_ERR(
"Shared mem reserve failed\n");
1020 if (gbl_args == NULL) {
1021 ODPH_ERR(
"Shared mem alloc failed\n");
1025 memset(gbl_args, 0,
sizeof(gbl_args_t));
1027 for (i = 0; i < REPEAT_COUNT; i++) {
1033 gbl_args->a1[i] = i;
1034 gbl_args->a2[i] = i;
1035 gbl_args->b1[i] = i;
1036 gbl_args->b2[i] = i;
1037 gbl_args->c1[i] = i;
1038 gbl_args->c2[i] = i;
1042 ret = parse_args(argc, argv);
1046 bench_suite_init(&gbl_args->suite);
1047 gbl_args->suite.bench = test_suite;
1048 gbl_args->suite.num_bench = ODPH_ARRAY_SIZE(test_suite);
1049 gbl_args->suite.measure_time = !!gbl_args->appl.time;
1050 gbl_args->suite.indef_idx = gbl_args->appl.bench_idx;
1051 gbl_args->suite.rounds = gbl_args->appl.rounds;
1052 gbl_args->suite.repeat_count = REPEAT_COUNT;
1053 if (common_options.is_export)
1054 gbl_args->suite.result = gbl_args->result;
1058 ODPH_ERR(
"Unable to allocate worker thread\n");
1064 sizeof(gbl_args->cpumask_str));
1068 memset(&worker_thread, 0,
sizeof(odph_thread_t));
1076 odph_thread_common_param_init(&thr_common);
1077 thr_common.instance = instance;
1078 thr_common.cpumask = &cpumask;
1079 thr_common.share_param = 1;
1081 odph_thread_param_init(&thr_param);
1082 thr_param.start = bench_run;
1083 thr_param.arg = &gbl_args->suite;
1086 odph_thread_create(&worker_thread, &thr_common, &thr_param, 1);
1088 odph_thread_join(&worker_thread, 1);
1090 ret = gbl_args->suite.retval;
1092 if (ret == 0 && common_options.is_export) {
1093 if (bench_misc_export(gbl_args)) {
1094 ODPH_ERR(
"Error: Export failed\n");
1101 ODPH_ERR(
"Shared mem free failed\n");
1106 ODPH_ERR(
"Local term failed\n");
1111 ODPH_ERR(
"Global term failed\n");
1116 return EXIT_FAILURE;
1118 return EXIT_SUCCESS;
void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val)
Store value to atomic uint32 variable.
void odp_mb_full(void)
Full memory barrier.
void odp_mb_acquire(void)
Memory barrier for acquire operations.
void odp_mb_release(void)
Memory barrier for release operations.
odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64)
Convert cpu native uint64_t to 64bit little endian.
#define odp_unlikely(x)
Branch unlikely taken.
odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16)
Convert cpu native uint16_t to 16bit little endian.
odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16)
Convert cpu native uint16_t to 16bit big endian.
odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64)
Convert cpu native uint64_t to 64bit big endian.
#define ODP_UNUSED
Intentionally unused variables of functions.
uint32_t odp_le_to_cpu_32(odp_u32le_t le32)
Convert 32bit little endian to cpu native uint32_t.
uint16_t odp_be_to_cpu_16(odp_u16be_t be16)
Convert 16bit big endian to cpu native uint16_t.
uint64_t odp_be_to_cpu_64(odp_u64be_t be64)
Convert 64bit big endian to cpu native uint64_t.
odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32)
Convert cpu native uint32_t to 32bit little endian.
uint16_t odp_le_to_cpu_16(odp_u16le_t le16)
Convert 16bit little endian to cpu native uint16_t.
uint64_t odp_le_to_cpu_64(odp_u64le_t le64)
Convert 64bit little endian to cpu native uint64_t.
odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32)
Convert cpu native uint32_t to 32bit big endian.
uint32_t odp_be_to_cpu_32(odp_u32be_t be32)
Convert 32bit big endian to cpu native uint32_t.
void odp_cpu_pause(void)
Pause CPU execution for a short while.
uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
CPU cycle count difference.
uint64_t odp_cpu_cycles_resolution(void)
Resolution of CPU cycle count.
void odp_prefetch_store(const void *addr)
Prefetch into data cache for storing.
uint64_t odp_cpu_cycles(void)
Current CPU cycle count.
int odp_cpu_id(void)
CPU identifier.
int odp_cpu_count(void)
CPU count.
void odp_prefetch_l3(const void *addr)
Prefetch into L3 data cache.
void odp_prefetch_store_strm_l1(const void *addr)
Streaming prefetch into L1 data cache for storing.
void odp_prefetch_l1i(const void *addr)
Prefetch into L1 instruction cache.
void odp_prefetch_store_l1(const void *addr)
Prefetch into L1 data cache for storing.
void odp_prefetch_l1(const void *addr)
Prefetch into L1 data cache.
uint64_t odp_cpu_hz_max_id(int id)
Maximum CPU frequency of a CPU (in Hz)
void odp_prefetch_l2(const void *addr)
Prefetch into L2 data cache.
uint64_t odp_cpu_hz_max(void)
Maximum CPU frequency in Hz.
void odp_prefetch(const void *addr)
Prefetch into data cache.
void odp_prefetch_store_l2(const void *addr)
Prefetch into L2 data cache for storing.
uint64_t odp_cpu_cycles_max(void)
Maximum CPU cycle count.
void odp_prefetch_strm_l1(const void *addr)
Streaming prefetch into L1 data cache.
uint64_t odp_cpu_hz(void)
Current CPU frequency in Hz.
void odp_prefetch_store_l3(const void *addr)
Prefetch into L3 data cache for storing.
uint64_t odp_cpu_hz_id(int id)
Current CPU frequency of a CPU (in Hz)
void odp_cpumask_set(odp_cpumask_t *mask, int cpu)
Add CPU to mask.
int odp_cpumask_default_worker(odp_cpumask_t *mask, int num)
Default CPU mask for worker threads.
int odp_cpumask_first(const odp_cpumask_t *mask)
Find first set CPU in mask.
void odp_cpumask_zero(odp_cpumask_t *mask)
Clear entire CPU mask.
int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t size)
Format a string from CPU mask.
#define ODP_CPUMASK_STR_SIZE
The maximum number of characters needed to record any CPU mask as a string (output of odp_cpumask_to_...
void odp_init_param_init(odp_init_t *param)
Initialize the odp_init_t to default values for all fields.
#define ODP_STATIC_ASSERT(cond, msg)
Compile time assertion macro.
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.
int odp_shm_free(odp_shm_t shm)
Free a contiguous block of shared memory.
void * odp_shm_addr(odp_shm_t shm)
Shared memory block address.
#define ODP_SHM_INVALID
Invalid shared memory block.
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.
odp_thread_type_t odp_thread_type(void)
Thread type.
int odp_thread_count(void)
Thread count.
int odp_thread_count_max(void)
Maximum thread count.
int odp_thread_id(void)
Get thread identifier.
@ ODP_THREAD_WORKER
Worker thread.
@ ODP_THREAD_CONTROL
Control thread.
uint64_t odp_time_to_ns(odp_time_t time)
Convert time to nanoseconds.
odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
Time difference.
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.
uint64_t odp_time_local_strict_ns(void)
Current local time in nanoseconds (strict)
odp_time_t odp_time_local_from_ns(uint64_t ns)
Convert nanoseconds to local time.
odp_time_t odp_time_global(void)
Current global time.
odp_time_t odp_time_local(void)
Current local time.
#define ODP_TIME_NULL
Zero time stamp.
uint64_t odp_time_global_strict_ns(void)
Current global time in nanoseconds (strict)
uint64_t odp_time_local_res(void)
Local time resolution in hertz.
odp_time_t odp_time_global_strict(void)
Current global time (strict)
odp_time_t odp_time_add_ns(odp_time_t time, uint64_t ns)
Add nanoseconds into time.
#define ODP_TIME_MSEC_IN_NS
A millisecond in nanoseconds.
uint64_t odp_time_global_ns(void)
Current global time in nanoseconds.
odp_time_t odp_time_local_strict(void)
Current local time (strict)
int odp_time_cmp(odp_time_t t2, odp_time_t t1)
Compare two times.
odp_time_t odp_time_global_from_ns(uint64_t ns)
Convert nanoseconds to global time.
uint64_t odp_time_local_ns(void)
Current local time in nanoseconds.
uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1)
Time difference in nanoseconds.
uint64_t odp_time_global_res(void)
Global time resolution in hertz.
void odp_time_startup(odp_time_startup_t *startup)
Get ODP instance startup time.
Global initialization parameters.
odp_mem_model_t mem_model
Application memory model.
Time stamp values at ODP startup.
uint64_t global_ns
Global time in nanoseconds at ODP startup.