LLVM OpenMP 22.0.0git
Public Member Functions | Protected Attributes | List of all members
omptest::OmptAsserter Class Referenceabstract

Base class for asserting on OMPT events. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/openmp/tools/omptest/include/OmptAsserter.h"

Inheritance diagram for omptest::OmptAsserter:
[legend]

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< OmptEventGroupInterfacegetEventGroups () const
 Accessor for the event group interface.
 
std::shared_ptr< logging::LoggergetLog () 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.
 
- Public Member Functions inherited from omptest::OmptListener
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< OmptEventGroupInterfaceEventGroups {nullptr}
 Pointer to the OmptEventGroupInterface.
 
std::shared_ptr< logging::LoggerLog {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.
 

Detailed Description

Base class for asserting on OMPT events.

Definition at line 85 of file OmptAsserter.h.

Constructor & Destructor Documentation

◆ OmptAsserter()

OmptAsserter::OmptAsserter ( )

Definition at line 29 of file OmptAsserter.cpp.

References EventGroups, and Log.

◆ ~OmptAsserter()

virtual omptest::OmptAsserter::~OmptAsserter ( )
virtualdefault

Member Function Documentation

◆ checkState()

AssertState OmptAsserter::checkState ( )
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.

◆ getEventGroups()

std::shared_ptr< OmptEventGroupInterface > omptest::OmptAsserter::getEventGroups ( ) const
inline

Accessor for the event group interface.

Definition at line 120 of file OmptAsserter.h.

References EventGroups.

◆ getLog()

std::shared_ptr< logging::Logger > omptest::OmptAsserter::getLog ( ) const
inline

Accessor for the event group interface.

Definition at line 125 of file OmptAsserter.h.

References Log.

◆ getNotificationCount()

int omptest::OmptAsserter::getNotificationCount ( )
inline

Get the total number of received, effective notifications.

Definition at line 105 of file OmptAsserter.h.

References NumNotifications.

◆ getOperationMode()

AssertMode omptest::OmptAsserter::getOperationMode ( )
inline

Get the asserter's current operationmode: e.g.: Strict or Relaxed.

Definition at line 111 of file OmptAsserter.h.

References OperationMode.

◆ getRemainingEventCount()

virtual size_t omptest::OmptAsserter::getRemainingEventCount ( )
pure virtual

Get the number of currently remaining events, with: ObserveState::Always.

Implemented in omptest::OmptSequencedAsserter, and omptest::OmptEventAsserter.

◆ getState()

omptest::AssertState omptest::OmptAsserter::getState ( )
inline

Return the asserter's current state.

Definition at line 114 of file OmptAsserter.h.

References State.

◆ getSuccessfulAssertionCount()

int omptest::OmptAsserter::getSuccessfulAssertionCount ( )
inline

Get the total number of successful assertion checks.

Definition at line 108 of file OmptAsserter.h.

References NumSuccessfulAsserts.

◆ insert()

void OmptAsserter::insert ( omptest::OmptAssertEvent &&  AE)
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.

◆ notify()

void OmptAsserter::notify ( omptest::OmptAssertEvent &&  AE)
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().

◆ notifyImpl()

virtual void omptest::OmptAsserter::notifyImpl ( omptest::OmptAssertEvent &&  AE)
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().

◆ setOperationMode()

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.

◆ verifyEventGroups()

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().

Member Data Documentation

◆ AssertMutex

std::mutex omptest::OmptAsserter::AssertMutex
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().

◆ EventGroups

std::shared_ptr<OmptEventGroupInterface> omptest::OmptAsserter::EventGroups {nullptr}
protected

Pointer to the OmptEventGroupInterface.

Definition at line 146 of file OmptAsserter.h.

Referenced by getEventGroups(), OmptAsserter(), and verifyEventGroups().

◆ Log

std::shared_ptr<logging::Logger> omptest::OmptAsserter::Log {nullptr}
protected

◆ NumNotifications

int omptest::OmptAsserter::NumNotifications {0}
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().

◆ NumSuccessfulAsserts

int omptest::OmptAsserter::NumSuccessfulAsserts {0}
protected

◆ OperationMode

AssertMode omptest::OmptAsserter::OperationMode {AssertMode::Strict}
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().

◆ State

omptest::AssertState omptest::OmptAsserter::State {omptest::AssertState::Pass}
protected

The documentation for this class was generated from the following files: