PEARL
Parallel Event Access and Replay Library
Public Types | Static Public Attributes | List of all members
pearl::CallingContext Class Reference

Representation of a calling context definition. More...

#include <pearl/CallingContext.h>

Public Types

typedef uint32_t IdType
 Calling context definition identifier type. More...
 

Public Member Functions

Constructors & destructor
 CallingContext (IdType id, const Region &region, const SourceLocation &scl, CallingContext *parent)
 Constructor. More...
 
Access definition data
IdType getId () const
 Get global identifier. More...
 
const RegiongetRegion () const
 Get current region. More...
 
const SourceLocationgetSourceLocation () const
 Get source-code location. More...
 
CallingContextgetParent () const
 Get parent context. More...
 
uint32_t numChildren () const
 Get number of child contexts. More...
 
const CallingContextgetChild (uint32_t index) const
 Get child context. More...
 

Static Public Attributes

static const IdType NO_ID = (~static_cast<IdType>(0))
 Numerical identifier used for undefined calling context definitions. More...
 
static const CallingContext UNDEFINED
 Static instance of class CallingContext representing undefined calling context entries. More...
 

Related Functions

(Note that these are not member functions.)

Stream I/O functions
std::ostream & operator<< (std::ostream &stream, const CallingContext &item)
 Stream output operator. More...
 
Comparison operators
bool operator== (const CallingContext &lhs, const CallingContext &rhs)
 Equality operator. More...
 
bool operator!= (const CallingContext &lhs, const CallingContext &rhs)
 Inequality operator. More...
 

Detailed Description

Instances of the CallingContext class provide information about a node in the calling context tree. A calling context describes the sequence of call sites leading to a particular source-code location where a thread was interrupted by a CallingContextSample, CallingContextEnter, or CallingContextLeave event. Calling contexts are characterized by the associated source-code region, a specific source-code location, and a parent calling context. The numerical identifiers of the individual calling contexts are globally defined and continuously enumerated, i.e., the ID is element of [0,#callingContexts-1].

Member Typedef Documentation

◆ IdType

Constructor & Destructor Documentation

◆ CallingContext()

pearl::CallingContext::CallingContext ( IdType  id,
const Region region,
const SourceLocation scl,
CallingContext parent 
)

Creates a new calling context definition instance and initializes it with the given values.

Parameters
idGlobal calling context identifier
regionAssociated region (Region::UNDEFINED if unknown)
sclSource-code location (SourceLocation::UNDEFINED if unknown)
parentParent calling context (nullptr for root nodes)

Member Function Documentation

◆ getChild()

const CallingContext& pearl::CallingContext::getChild ( uint32_t  index) const

Returns the child calling context definition stored at the given index in the range of [0,#children-1].

Parameters
indexChild index
Returns
Child context

◆ getId()

IdType pearl::CallingContext::getId ( ) const

Returns the global identifier of the calling context definition.

Returns
Global identifier

◆ getParent()

CallingContext* pearl::CallingContext::getParent ( ) const

Returns a pointer to the parent calling context.

Returns
Parent calling context if available, nullptr otherwise

◆ getRegion()

const Region& pearl::CallingContext::getRegion ( ) const

Returns the region definition associated to the calling context.

Returns
Region if available, Region::UNDEFINED otherwise

◆ getSourceLocation()

const SourceLocation& pearl::CallingContext::getSourceLocation ( ) const

Returns the source-code location definition associated to the calling context.

Returns
Source-code location if available, SourceLocation::UNDEFINED otherwise

◆ numChildren()

uint32_t pearl::CallingContext::numChildren ( ) const

Returns the number of calling contexts which were spawned from the current context during the application's execution.

Returns
Number of child contexts

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const CallingContext lhs,
const CallingContext rhs 
)
related

Compares two calling context definition objects lhs and rhs for inequality. Two calling context definitions are considered unequal if either their identifiers, associated regions, source-code locations, or their parent differ. Child contexts are not compared, i.e., this operator performs a "shallow" comparison.

Parameters
lhsLeft-hand operand
rhsRight-hand operand
Returns
True if the calling context definitions differ, false otherwise

◆ operator<<()

std::ostream & operator<< ( std::ostream &  stream,
const CallingContext item 
)
related

Prints the contents of the given calling context definition object item to an output stream in a human-readable form.

Parameters
streamOutput stream
itemCalling context definition object
Returns
Output stream

◆ operator==()

bool operator== ( const CallingContext lhs,
const CallingContext rhs 
)
related

Compares two calling context definition objects lhs and rhs for equality. Two calling context definitions are considered equal if their identifiers, associated regions and source-code locations, as well as their parents are identical. The child contexts are not compared, i.e., this operator performs a "shallow" comparison.

Parameters
lhsLeft-hand operand
rhsRight-hand operand
Returns
True if the calling context definitions are equal, false otherwise

Member Data Documentation

◆ NO_ID

const IdType pearl::CallingContext::NO_ID = (~static_cast<IdType>(0))
static

◆ UNDEFINED

const CallingContext pearl::CallingContext::UNDEFINED
static

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

Scalasca    Copyright © 1998–2019 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre
Copyright © 2009–2015 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming