walberla::timing::TimingTree< TP > Class Template Reference

#include <TimingTree.h>

Public Member Functions

 TimingTree ()
 Creates and initialises the timing structure. More...
 
 TimingTree (const TimingTree &tt)
 
TimingTree< TP > & operator= (const TimingTree< TP > &tt)
 
void swap (TimingTree< TP > &tt)
 
void start (const std::string &name)
 Starts a timer beneath the current hierarchy level. More...
 
void stop (const std::string &name)
 Stops the last started timer and jumps back one hierarchy level. More...
 
bool isTimerRunning (const std::string &name) const
 Checks if specified timer is currently running. More...
 
void reset ()
 Resets the the timing hierarchy. More...
 
TimingTree< TP > getReduced (ReduceType rt=REDUCE_TOTAL, int targetRank=0, bool callSynchronize=true) const
 Collects all the timing data from different processes. More...
 
void synchronize ()
 Adds entries which only exist on other processes. Has to be collectively called on all processes! More...
 
const TimingNode< TP > & getRawData () const
 Returns the raw tree data structure. More...
 
const Timer< TP > & operator[] (const std::string &name) const
 Finds the specified timer in the timing hierarchy. More...
 
bool timerExists (const std::string &n) const
 Checks if the specified timer exists in the timing hierarchy. More...
 
std::string getCurrentTimerName () const
 Returns the name of the currently running timer Might be expensive due to value search. More...
 
TimingTree< TP > getCopyWithRemainder () const
 Returns a copy of the timing tree containing the remaining time as a subnode. More...
 

Private Attributes

TimingNode< TP > root_
 Tree data structure. More...
 
TimingNode< TP > * current_
 Pointer to the current hierarchy level. More...
 

Related Functions

(Note that these are not member functions.)

template<typename TP >
void to_json (nlohmann::json &j, const TimingTree< TP > &tt)
 Converts a TimingTree to json. More...
 
template<typename TP >
std::ostream & operator<< (std::ostream &os, const TimingTree< TP > &tt)
 

Constructor & Destructor Documentation

◆ TimingTree() [1/2]

template<typename TP >
walberla::timing::TimingTree< TP >::TimingTree

Creates and initialises the timing structure.

◆ TimingTree() [2/2]

template<typename TP >
walberla::timing::TimingTree< TP >::TimingTree ( const TimingTree< TP > &  tt)

Member Function Documentation

◆ getCopyWithRemainder()

template<typename TP >
TimingTree< TP > walberla::timing::TimingTree< TP >::getCopyWithRemainder

Returns a copy of the timing tree containing the remaining time as a subnode.

◆ getCurrentTimerName()

template<typename TP >
std::string walberla::timing::TimingTree< TP >::getCurrentTimerName

Returns the name of the currently running timer Might be expensive due to value search.

◆ getRawData()

template<typename TP >
const TimingNode< TP > & walberla::timing::TimingTree< TP >::getRawData

Returns the raw tree data structure.

◆ getReduced()

template<typename TP >
TimingTree< TP > walberla::timing::TimingTree< TP >::getReduced ( ReduceType  rt = REDUCE_TOTAL,
int  targetRank = 0,
bool  callSynchronize = true 
) const

Collects all the timing data from different processes.

Parameters
rttype of reduction used
targetRank
callSynchronizecall synchronize() before doing the reduction
Returns
Attention
Setting callSynchronize to false can lead to deadlocks during reduction if different ranks have different timing nodes! Setting it to true causes an additional communication.

◆ isTimerRunning()

template<typename TP >
bool walberla::timing::TimingTree< TP >::isTimerRunning ( const std::string &  name) const

Checks if specified timer is currently running.

◆ operator=()

template<typename TP >
TimingTree< TP > & walberla::timing::TimingTree< TP >::operator= ( const TimingTree< TP > &  tt)

◆ operator[]()

template<typename TP >
const Timer< TP > & walberla::timing::TimingTree< TP >::operator[] ( const std::string &  name) const

Finds the specified timer in the timing hierarchy.

Parameters
nametimer name which may include more than one hierarchy separated by "."
tt["firstLevel.secondLevel.thirdLevel.timerName"].total();

◆ reset()

template<typename TP >
void walberla::timing::TimingTree< TP >::reset

Resets the the timing hierarchy.

◆ start()

template<typename TP >
void walberla::timing::TimingTree< TP >::start ( const std::string &  name)

Starts a timer beneath the current hierarchy level.

Parameters
nametimer name. '.' is not allowed in the timer name!

◆ stop()

template<typename TP >
void walberla::timing::TimingTree< TP >::stop ( const std::string &  name)

Stops the last started timer and jumps back one hierarchy level.

◆ swap()

template<typename TP >
void walberla::timing::TimingTree< TP >::swap ( TimingTree< TP > &  tt)

◆ synchronize()

template<typename TP >
void walberla::timing::TimingTree< TP >::synchronize

Adds entries which only exist on other processes. Has to be collectively called on all processes!

◆ timerExists()

template<typename TP >
bool walberla::timing::TimingTree< TP >::timerExists ( const std::string &  name) const
inline

Checks if the specified timer exists in the timing hierarchy.

Parameters
nametimer name which may include more than one hierarchy separated by "."
tt.timerExists("firstLevel.secondLevel.thirdLevel.timerName");

Friends And Related Function Documentation

◆ operator<<()

template<typename TP >
std::ostream & operator<< ( std::ostream &  os,
const TimingTree< TP > &  tt 
)
related

◆ to_json()

template<typename TP >
void to_json ( nlohmann::json &  j,
const TimingTree< TP > &  tt 
)
related

Converts a TimingTree to json.

The signature is required by the json library

Member Data Documentation

◆ current_

template<typename TP >
TimingNode<TP>* walberla::timing::TimingTree< TP >::current_
private

Pointer to the current hierarchy level.

◆ root_

template<typename TP >
TimingNode<TP> walberla::timing::TimingTree< TP >::root_
private

Tree data structure.


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