21#define ompd_declare_access(t, m) uint64_t ompd_access__##t##__##m;
22OMPD_FOREACH_ACCESS(ompd_declare_access)
23#undef ompd_declare_access
25#define ompd_declare_sizeof_member(t, m) uint64_t ompd_sizeof__##t##__##m;
26OMPD_FOREACH_ACCESS(ompd_declare_sizeof_member)
27#undef ompd_declare_sizeof_member
29#define ompd_declare_bitfield(t, m) uint64_t ompd_bitfield__##t##__##m;
30OMPD_FOREACH_BITFIELD(ompd_declare_bitfield)
31#undef ompd_declare_bitfield
33#define ompd_declare_sizeof(t) uint64_t ompd_sizeof__##t;
34OMPD_FOREACH_SIZEOF(ompd_declare_sizeof)
35#undef ompd_declare_sizeof
37volatile const char **ompd_dll_locations = NULL;
38uint64_t ompd_state = 0;
40char *ompd_env_block = NULL;
41ompd_size_t ompd_env_block_size = 0;
45 static int ompd_initialized = 0;
54#define ompd_init_access(t, m) \
55 ompd_access__##t##__##m = (uint64_t) & (((t *)0)->m);
56 OMPD_FOREACH_ACCESS(ompd_init_access)
57#undef ompd_init_access
63#define ompd_init_bitfield(t, m) \
64 ompd_bitfield__##t##__##m = 0; \
65 ((t *)(&ompd_bitfield__##t##__##m))->m = 1;
66 OMPD_FOREACH_BITFIELD(ompd_init_bitfield)
67#undef ompd_init_bitfield
73#define ompd_init_sizeof_member(t, m) \
74 ompd_sizeof__##t##__##m = sizeof(((t *)0)->m);
75 OMPD_FOREACH_ACCESS(ompd_init_sizeof_member)
76#undef ompd_init_sizeof_member
78#define ompd_init_sizeof(t) ompd_sizeof__##t = sizeof(t);
79 OMPD_FOREACH_SIZEOF(ompd_init_sizeof)
80#undef ompd_init_sizeof
88 int ret = dladdr((
void *)ompd_init, &dl_info);
90 fprintf(stderr,
"%s\n", dlerror());
91 }
else if (strrchr(dl_info.dli_fname,
'/')) {
92 int lib_path_length = strrchr(dl_info.dli_fname,
'/') - dl_info.dli_fname;
94 (
char *)malloc(lib_path_length + 12 );
95 strncpy(libname, dl_info.dli_fname, lib_path_length);
96 memcpy(libname + lib_path_length,
"/libompd.so\0", 12);
100 const char *ompd_env_var = getenv(
"OMP_DEBUG");
101 if (ompd_env_var && !strcmp(ompd_env_var,
"enabled")) {
102 fprintf(stderr,
"OMP_OMPD active\n");
104 ompd_state |= OMPD_ENABLE_BP;
107 ompd_initialized = 1;
108 ompd_dll_locations = (
volatile const char **)malloc(3 *
sizeof(
const char *));
109 ompd_dll_locations[0] =
"libompd.so";
110 ompd_dll_locations[1] = libname;
111 ompd_dll_locations[2] = NULL;
112 ompd_dll_locations_valid();
115void __attribute__((noinline)) ompd_dll_locations_valid(
void) {
121void ompd_bp_parallel_begin(
void) {
126void ompd_bp_parallel_end(
void) {
131void ompd_bp_task_begin(
void) {
136void ompd_bp_task_end(
void) {
141void ompd_bp_thread_begin(
void) {
146void ompd_bp_thread_end(
void) {
ompt_callbacks_active_t ompt_enabled
__attribute__((noinline))