summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJoachim Protze <protze@itc.rwth-aachen.de>2017-12-21 13:55:34 +0000
committerJoachim Protze <protze@itc.rwth-aachen.de>2017-12-21 13:55:34 +0000
commit4fe83593ebc4d3759e2119d6f6b20cfa6bde1910 (patch)
tree34f9b1229d7a8173b11dbde6843e1d6604cfbf5d /openmp/runtime/src
parent0e2a2571ca4639c8b75286988217017fbc884c7b (diff)
downloadbcm5719-llvm-4fe83593ebc4d3759e2119d6f6b20cfa6bde1910.tar.gz
bcm5719-llvm-4fe83593ebc4d3759e2119d6f6b20cfa6bde1910.zip
[OMPT] Handle null pointer in set_callback to improve performance
We use the bitmap ompt_enabled thoughout the runtime, to avoid loading the vector of callback functions when testing if specific code should be executed. Before invoking an event callback function, the pointer is tested for NULL. This revision resets the corresponding bit in ompt_enabled to 0 if NULL is passed in set_callback. Differential Revision: https://reviews.llvm.org/D41171 llvm-svn: 321264
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/ompt-general.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index c1e8b0f22eb..9f21214f808 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -411,9 +411,12 @@ OMPT_API_ROUTINE int ompt_set_callback(ompt_callbacks_t which,
case event_name: \
if (ompt_event_implementation_status(event_name)) { \
ompt_callbacks.ompt_callback(event_name) = (callback_type)callback; \
- ompt_enabled.event_name = 1; \
+ ompt_enabled.event_name = (callback != 0); \
} \
- return ompt_event_implementation_status(event_name);
+ if (callback) \
+ return ompt_event_implementation_status(event_name); \
+ else \
+ return ompt_set_always;
FOREACH_OMPT_EVENT(ompt_event_macro)
OpenPOWER on IntegriCloud