diff options
Diffstat (limited to 'openmp/libomptarget/include/ompt_device_callbacks.h')
-rw-r--r-- | openmp/libomptarget/include/ompt_device_callbacks.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/openmp/libomptarget/include/ompt_device_callbacks.h b/openmp/libomptarget/include/ompt_device_callbacks.h index 3dbba3dedbee..127e18950249 100644 --- a/openmp/libomptarget/include/ompt_device_callbacks.h +++ b/openmp/libomptarget/include/ompt_device_callbacks.h @@ -49,6 +49,20 @@ public: #undef OmptBindCallback } + /// Used to find a callback given its name + ompt_interface_fn_t lookupCallback(const char *InterfaceFunctionName) { +#define OmptLookup(Name, Type, Code) \ + if (strcmp(InterfaceFunctionName, #Name) == 0) \ + return (ompt_interface_fn_t)Name##_fn; + + FOREACH_OMPT_TARGET_CALLBACK(OmptLookup); +#undef OmptLookup + return (ompt_interface_fn_t) nullptr; + } + + /// Wrapper function to find a callback given its name + static ompt_interface_fn_t doLookup(const char *InterfaceFunctionName); + private: /// Set to true if callbacks for this library have been initialized bool Enabled; @@ -62,8 +76,6 @@ private: /// Device callbacks object for the library that performs the instantiation extern OmptDeviceCallbacksTy OmptDeviceCallbacks; -#undef DEBUG_PREFIX - #endif // OMPT_SUPPORT #endif // _OMPT_DEVICE_CALLBACKS_H |