ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
EspressoCaliLoop Struct Reference

RAII loop wrapper replacing the CALI_CXX_MARK_LOOP_BEGIN / CALI_CXX_MARK_LOOP_ITERATION / CALI_CXX_MARK_LOOP_END macro triplet. More...

#include <caliper_utils.hpp>

Public Member Functions

 EspressoCaliLoop (const char *name)
 
 ~EspressoCaliLoop ()
 
 EspressoCaliLoop (const EspressoCaliLoop &)=delete
 
EspressoCaliLoopoperator= (const EspressoCaliLoop &)=delete
 
EspressoCaliIteration iteration (int iter) const
 Return an RAII iteration annotation for the current step.
 

Public Attributes

cali::Loop * loop_
 
cali_id_t iter_attr_
 

Detailed Description

RAII loop wrapper replacing the CALI_CXX_MARK_LOOP_BEGIN / CALI_CXX_MARK_LOOP_ITERATION / CALI_CXX_MARK_LOOP_END macro triplet.

When espresso_cali_active() is true at construction time, creates the same cali.loop region and iteration::name attribute as the raw Caliper macros would. When inactive, construction, iteration(), and destruction are all no-ops with no Caliper calls.

Usage:

EspressoCaliLoop cali_loop("Integration loop");
for (int step = 0; step < n_steps; ++step) {
auto cali_iter = cali_loop.iteration(step); // RAII: closed at }
// ... loop body ...
}
// cali_loop destructor ends the loop region
RAII loop wrapper replacing the CALI_CXX_MARK_LOOP_BEGIN / CALI_CXX_MARK_LOOP_ITERATION / CALI_CXX_MA...

Definition at line 165 of file caliper_utils.hpp.

Constructor & Destructor Documentation

◆ EspressoCaliLoop() [1/2]

EspressoCaliLoop::EspressoCaliLoop ( const char *  name)
inlineexplicit

Definition at line 169 of file caliper_utils.hpp.

References espresso_cali_active(), iter_attr_, and loop_.

◆ ~EspressoCaliLoop()

EspressoCaliLoop::~EspressoCaliLoop ( )
inline

Definition at line 176 of file caliper_utils.hpp.

References loop_.

◆ EspressoCaliLoop() [2/2]

EspressoCaliLoop::EspressoCaliLoop ( const EspressoCaliLoop )
delete

Member Function Documentation

◆ iteration()

EspressoCaliIteration EspressoCaliLoop::iteration ( int  iter) const
inline

Return an RAII iteration annotation for the current step.

The returned EspressoCaliIteration must be kept alive for the duration of the loop body; store it in a named local variable.

Definition at line 190 of file caliper_utils.hpp.

References iter_attr_, and loop_.

Referenced by System::System::integrate().

◆ operator=()

EspressoCaliLoop & EspressoCaliLoop::operator= ( const EspressoCaliLoop )
delete

Member Data Documentation

◆ iter_attr_

cali_id_t EspressoCaliLoop::iter_attr_

Definition at line 167 of file caliper_utils.hpp.

Referenced by EspressoCaliLoop(), and iteration().

◆ loop_

cali::Loop* EspressoCaliLoop::loop_

Definition at line 166 of file caliper_utils.hpp.

Referenced by EspressoCaliLoop(), iteration(), and ~EspressoCaliLoop().


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