DNDSR 0.2.1
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::PerformanceTimer Class Reference

Process-wide singleton aggregating wall-clock timings by category. More...

#include <Profiling.hpp>

Public Types

enum  TimerType {
  Unknown = 0 , RHS = 1 , Dt = 2 , Reconstruction = 3 ,
  ReconstructionCR = 4 , Limiter = 5 , LimiterA = 6 , LimiterB = 7 ,
  Basis = 8 , Comm = 9 , Comm1 = 10 , Comm2 = 11 ,
  Comm3 = 12 , LinSolve = 13 , LinSolve1 = 14 , LinSolve2 = 15 ,
  LinSolve3 = 16 , Positivity = 17 , PositivityOuter = 18 , EndTimerType = 64
}
 Named timer slots. New categories can be added before EndTimerType. More...
 

Public Member Functions

 PerformanceTimer (const PerformanceTimer &)=delete
 
PerformanceTimer & operator= (const PerformanceTimer &)=delete
 
 PerformanceTimer (PerformanceTimer &&)=delete
 
PerformanceTimer & operator= (PerformanceTimer &&)=delete
 
 ~PerformanceTimer ()=default
 
void StartTimer (TimerType t)
 Record the current wall time in the "start" slot for timer t.
 
void StartTimer (int t)
 Integer-id overload of StartTimer.
 
void StopTimer (TimerType t)
 Add (now - start) to the accumulated time for timer t.
 
void StopTimer (int t)
 Integer-id overload of StopTimer.
 
real getTimer (TimerType t)
 Current local (this-rank) accumulated wall time (seconds).
 
real getTimer (int t)
 
real getTimerCollective (TimerType t, const MPIInfo &mpi)
 Global maximum across ranks (collective on mpi.comm).
 
real getTimerCollective (int t, const MPIInfo &mpi)
 
template<typename T >
real getTimerColOrLoc (T t, const MPIInfo &mpi, bool col)
 Either getTimerCollective (when col == true) or getTimer.
 
void clearTimer (TimerType t)
 Zero the accumulated time for one timer slot.
 
void clearTimer (int t)
 
void clearAllTimer ()
 Zero every timer slot.
 

Static Public Member Functions

static PerformanceTimer & Instance ()
 Access the process-wide singleton.
 

Static Public Attributes

static const int Ntype = EndTimerType
 
static const int Ntype_Past = 64
 
static const int Ntype_All = Ntype + Ntype_Past
 

Detailed Description

Process-wide singleton aggregating wall-clock timings by category.

Provides a fixed set of named timer slots (RHS, Comm, LinSolve, ...) that callers start / stop at well-known phases of the solver. Calls are expected to nest correctly (each StartTimer matched by a StopTimer).

The buffer holds two copies of each slot (Ntype_All == 2 * Ntype) so current and previous-iteration timings can be retained for reporting.

Thread-safe C++11 singleton; not reentrant for the same timer id.

Definition at line 22 of file Profiling.hpp.

Member Enumeration Documentation

◆ TimerType

Named timer slots. New categories can be added before EndTimerType.

Enumerator
Unknown 
RHS 

Total RHS evaluation.

Dt 

Time-step computation.

Reconstruction 

Variational reconstruction.

ReconstructionCR 

CR (compact reconstruction) branch.

Limiter 

Slope / variable limiter.

LimiterA 

Limiter sub-phase A.

LimiterB 

Limiter sub-phase B.

Basis 

Basis-function evaluation.

Comm 

Catch-all MPI comm.

Comm1 

Comm phase 1 (e.g., cell-ghost).

Comm2 

Comm phase 2 (e.g., face-ghost).

Comm3 

Comm phase 3.

LinSolve 

Linear solve (total).

LinSolve1 

Linear solve phase 1.

LinSolve2 

Linear solve phase 2.

LinSolve3 

Linear solve phase 3.

Positivity 

Positivity preservation.

PositivityOuter 

Outer-iteration positivity.

EndTimerType 

One past the last valid id.

Definition at line 26 of file Profiling.hpp.

Constructor & Destructor Documentation

◆ PerformanceTimer() [1/2]

DNDS::PerformanceTimer::PerformanceTimer ( const PerformanceTimer &  )
delete

◆ PerformanceTimer() [2/2]

DNDS::PerformanceTimer::PerformanceTimer ( PerformanceTimer &&  )
delete

◆ ~PerformanceTimer()

DNDS::PerformanceTimer::~PerformanceTimer ( )
default

Member Function Documentation

◆ clearAllTimer()

void DNDS::PerformanceTimer::clearAllTimer ( )

Zero every timer slot.

Definition at line 69 of file Profiling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearTimer() [1/2]

void DNDS::PerformanceTimer::clearTimer ( int  t)

Definition at line 64 of file Profiling.cpp.

◆ clearTimer() [2/2]

void DNDS::PerformanceTimer::clearTimer ( TimerType  t)

Zero the accumulated time for one timer slot.

Definition at line 59 of file Profiling.cpp.

Here is the caller graph for this function:

◆ getTimer() [1/2]

real DNDS::PerformanceTimer::getTimer ( int  t)

Definition at line 40 of file Profiling.cpp.

◆ getTimer() [2/2]

real DNDS::PerformanceTimer::getTimer ( TimerType  t)

Current local (this-rank) accumulated wall time (seconds).

Definition at line 35 of file Profiling.cpp.

Here is the caller graph for this function:

◆ getTimerCollective() [1/2]

real DNDS::PerformanceTimer::getTimerCollective ( int  t,
const MPIInfo &  mpi 
)

Definition at line 52 of file Profiling.cpp.

Here is the call graph for this function:

◆ getTimerCollective() [2/2]

real DNDS::PerformanceTimer::getTimerCollective ( TimerType  t,
const MPIInfo &  mpi 
)

Global maximum across ranks (collective on mpi.comm).

Definition at line 45 of file Profiling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTimerColOrLoc()

template<typename T >
real DNDS::PerformanceTimer::getTimerColOrLoc ( T  t,
const MPIInfo &  mpi,
bool  col 
)
inline

Either getTimerCollective (when col == true) or getTimer.

Definition at line 86 of file Profiling.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

PerformanceTimer & DNDS::PerformanceTimer::Instance ( )
static

Access the process-wide singleton.

Definition at line 9 of file Profiling.cpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

PerformanceTimer & DNDS::PerformanceTimer::operator= ( const PerformanceTimer &  )
delete

◆ operator=() [2/2]

PerformanceTimer & DNDS::PerformanceTimer::operator= ( PerformanceTimer &&  )
delete

◆ StartTimer() [1/2]

void DNDS::PerformanceTimer::StartTimer ( int  t)

Integer-id overload of StartTimer.

Definition at line 20 of file Profiling.cpp.

◆ StartTimer() [2/2]

void DNDS::PerformanceTimer::StartTimer ( TimerType  t)

Record the current wall time in the "start" slot for timer t.

Definition at line 15 of file Profiling.cpp.

Here is the caller graph for this function:

◆ StopTimer() [1/2]

void DNDS::PerformanceTimer::StopTimer ( int  t)

Integer-id overload of StopTimer.

Definition at line 30 of file Profiling.cpp.

◆ StopTimer() [2/2]

void DNDS::PerformanceTimer::StopTimer ( TimerType  t)

Add (now - start) to the accumulated time for timer t.

Definition at line 25 of file Profiling.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ Ntype

const int DNDS::PerformanceTimer::Ntype = EndTimerType
static

Definition at line 50 of file Profiling.hpp.

◆ Ntype_All

const int DNDS::PerformanceTimer::Ntype_All = Ntype + Ntype_Past
static

Definition at line 52 of file Profiling.hpp.

◆ Ntype_Past

const int DNDS::PerformanceTimer::Ntype_Past = 64
static

Definition at line 51 of file Profiling.hpp.


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