LLVM OpenMP 22.0.0git
|
Base class for asserting on OMPT events. More...
Public Member Functions | |
OmptAsserter () | |
virtual | ~OmptAsserter ()=default |
virtual void | insert (omptest::OmptAssertEvent &&AE) |
Add an event to the asserter's internal data structure. | |
void | notify (omptest::OmptAssertEvent &&AE) override |
Called from the CallbackHandler with a corresponding AssertEvent to which callback was handled. | |
virtual void | notifyImpl (omptest::OmptAssertEvent &&AE)=0 |
Implemented in subclasses to implement what should actually be done with the notification. | |
virtual size_t | getRemainingEventCount ()=0 |
Get the number of currently remaining events, with: ObserveState::Always. | |
int | getNotificationCount () |
Get the total number of received, effective notifications. | |
int | getSuccessfulAssertionCount () |
Get the total number of successful assertion checks. | |
AssertMode | getOperationMode () |
Get the asserter's current operationmode: e.g.: Strict or Relaxed. | |
omptest::AssertState | getState () |
Return the asserter's current state. | |
virtual omptest::AssertState | checkState () |
Determine and return the asserter's state. | |
std::shared_ptr< OmptEventGroupInterface > | getEventGroups () const |
Accessor for the event group interface. | |
std::shared_ptr< logging::Logger > | getLog () const |
Accessor for the event group interface. | |
bool | verifyEventGroups (const omptest::OmptAssertEvent &ExpectedEvent, const omptest::OmptAssertEvent &ObservedEvent) |
Check the observed events' group association. | |
void | setOperationMode (AssertMode Mode) |
Set the asserter's mode of operation w.r.t. assertion. | |
![]() | |
virtual | ~OmptListener ()=default |
virtual void | notify (omptest::OmptAssertEvent &&AE)=0 |
Called for each registered OMPT event of the OmptCallbackHandler. | |
void | setActive (bool Enabled) |
Control whether this asserter should be considered 'active'. | |
bool | isActive () |
Check if this asserter is considered 'active'. | |
bool | isSuppressedEventType (omptest::internal::EventTy EvTy) |
Check if the given event type is from the set of suppressed event types. | |
void | permitEvent (omptest::internal::EventTy EvTy) |
Remove the given event type to the set of suppressed events. | |
void | suppressEvent (omptest::internal::EventTy EvTy) |
Add the given event type to the set of suppressed events. | |
Protected Attributes | |
omptest::AssertState | State {omptest::AssertState::Pass} |
The asserter's current state. | |
std::mutex | AssertMutex |
Mutex to avoid data races w.r.t. event notifications and/or insertions. | |
std::shared_ptr< OmptEventGroupInterface > | EventGroups {nullptr} |
Pointer to the OmptEventGroupInterface. | |
std::shared_ptr< logging::Logger > | Log {nullptr} |
Pointer to the logging instance. | |
AssertMode | OperationMode {AssertMode::Strict} |
Operation mode during assertion / notification. | |
int | NumNotifications {0} |
The total number of effective notifications. | |
int | NumSuccessfulAsserts {0} |
The number of successful assertion checks. | |
Base class for asserting on OMPT events.
Definition at line 85 of file OmptAsserter.h.
OmptAsserter::OmptAsserter | ( | ) |
Definition at line 29 of file OmptAsserter.cpp.
References EventGroups, and Log.
|
virtualdefault |
|
virtual |
Determine and return the asserter's state.
Reimplemented in omptest::OmptSequencedAsserter, and omptest::OmptEventAsserter.
Definition at line 87 of file OmptAsserter.cpp.
References State.
|
inline |
Accessor for the event group interface.
Definition at line 120 of file OmptAsserter.h.
References EventGroups.
|
inline |
Accessor for the event group interface.
Definition at line 125 of file OmptAsserter.h.
References Log.
|
inline |
Get the total number of received, effective notifications.
Definition at line 105 of file OmptAsserter.h.
References NumNotifications.
|
inline |
Get the asserter's current operationmode: e.g.: Strict or Relaxed.
Definition at line 111 of file OmptAsserter.h.
References OperationMode.
|
pure virtual |
Get the number of currently remaining events, with: ObserveState::Always.
Implemented in omptest::OmptSequencedAsserter, and omptest::OmptEventAsserter.
|
inline |
Return the asserter's current state.
Definition at line 114 of file OmptAsserter.h.
References State.
|
inline |
Get the total number of successful assertion checks.
Definition at line 108 of file OmptAsserter.h.
References NumSuccessfulAsserts.
|
virtual |
Add an event to the asserter's internal data structure.
Reimplemented in omptest::OmptSequencedAsserter, and omptest::OmptEventAsserter.
Definition at line 75 of file OmptAsserter.cpp.
|
overridevirtual |
Called from the CallbackHandler with a corresponding AssertEvent to which callback was handled.
Implements omptest::OmptListener.
Definition at line 79 of file OmptAsserter.cpp.
References omptest::OmptListener::isActive(), omptest::OmptListener::isSuppressedEventType(), and notifyImpl().
|
pure virtual |
Implemented in subclasses to implement what should actually be done with the notification.
Implemented in omptest::OmptSequencedAsserter, and omptest::OmptEventAsserter.
Referenced by notify().
void OmptAsserter::setOperationMode | ( | AssertMode | Mode | ) |
Set the asserter's mode of operation w.r.t. assertion.
Definition at line 203 of file OmptAsserter.cpp.
References OperationMode.
bool OmptAsserter::verifyEventGroups | ( | const omptest::OmptAssertEvent & | ExpectedEvent, |
const omptest::OmptAssertEvent & | ObservedEvent | ||
) |
Check the observed events' group association.
If the event indicates the begin/end of an OpenMP target region, we will create/deprecate the expected event's group. Return true if the expected event group exists (and is active), otherwise: false. Note: BufferRecords may also match with deprecated groups as they may be delivered asynchronously.
Definition at line 89 of file OmptAsserter.cpp.
References omptest::logging::Critical, EventGroups, and Log.
Referenced by omptest::OmptSequencedAsserter::consumeRegularEvent(), and omptest::OmptEventAsserter::notifyImpl().
|
protected |
Mutex to avoid data races w.r.t. event notifications and/or insertions.
Definition at line 143 of file OmptAsserter.h.
Referenced by omptest::OmptSequencedAsserter::insert(), omptest::OmptEventAsserter::insert(), omptest::OmptSequencedAsserter::notifyImpl(), and omptest::OmptEventAsserter::notifyImpl().
|
protected |
Pointer to the OmptEventGroupInterface.
Definition at line 146 of file OmptAsserter.h.
Referenced by getEventGroups(), OmptAsserter(), and verifyEventGroups().
|
protected |
Pointer to the logging instance.
Definition at line 149 of file OmptAsserter.h.
Referenced by omptest::OmptSequencedAsserter::checkExcessNotify(), omptest::OmptSequencedAsserter::checkState(), omptest::OmptEventAsserter::checkState(), omptest::OmptSequencedAsserter::consumeRegularEvent(), omptest::OmptSequencedAsserter::consumeSyncPoint(), getLog(), omptest::OmptSequencedAsserter::notifyImpl(), omptest::OmptEventAsserter::notifyImpl(), OmptAsserter(), and verifyEventGroups().
|
protected |
The total number of effective notifications.
For example, if specific notifications are to be ignored, they will not count towards this total.
Definition at line 156 of file OmptAsserter.h.
Referenced by omptest::OmptSequencedAsserter::checkExcessNotify(), getNotificationCount(), omptest::OmptSequencedAsserter::notifyImpl(), and omptest::OmptEventAsserter::notifyImpl().
|
protected |
The number of successful assertion checks.
Definition at line 159 of file OmptAsserter.h.
Referenced by omptest::OmptSequencedAsserter::checkExcessNotify(), omptest::OmptSequencedAsserter::consumeRegularEvent(), omptest::OmptSequencedAsserter::consumeSyncPoint(), omptest::OmptSequencedAsserter::getRemainingEventCount(), getSuccessfulAssertionCount(), and omptest::OmptEventAsserter::notifyImpl().
|
protected |
Operation mode during assertion / notification.
Definition at line 152 of file OmptAsserter.h.
Referenced by getOperationMode(), omptest::OmptSequencedAsserter::notifyImpl(), omptest::OmptEventAsserter::notifyImpl(), and setOperationMode().
|
protected |
The asserter's current state.
Definition at line 140 of file OmptAsserter.h.
Referenced by omptest::OmptSequencedAsserter::checkExcessNotify(), checkState(), omptest::OmptSequencedAsserter::checkState(), omptest::OmptEventAsserter::checkState(), omptest::OmptSequencedAsserter::consumeRegularEvent(), omptest::OmptSequencedAsserter::consumeSyncPoint(), getState(), omptest::OmptSequencedAsserter::notifyImpl(), and omptest::OmptEventAsserter::notifyImpl().