[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

git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@321264 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joachim Protze
2017-12-21 13:55:34 +00:00
parent df39d67d94
commit 617a41cdba
+5 -2
View File
@@ -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)