StatManager

class StatManager
#include “StatManager.h”

Stat manager to gather performance statistics.

amr statistics

Update the min / max time to adapt the mesh from this new value.

void statistics_timing_adapt(double t)
void statistics_timing_adapt_mark(double t)
void statistics_timing_adapt_balance(double t, double *stat_time)
void statistics_timing_adapt_partition(double t)

Public Types

enum class timer_accum

Accumulation types.

There are two accumulations: at every time step over MPI tasks, and over all time steps. The timer_accum::none value is only valid over MPI tasks, where it prevents communications.

Values:

enumerator sum
enumerator min
enumerator max
enumerator mean
enumerator none

Public Functions

StatManager(SettingManager *stg_mgr, MPI_Comm mpicomm)

All fields are initialized to TYPE_MAX and TYPE_MIN, as need be.

Parameters:
  • stg_mgr[in] a SettingManager object (to parse input setting file)

  • mpicomm[in] MPI communicator

~StatManager()
int get_stat()

Test if statistics should be collected.

void statistics_dt(double dt)

Update the min / max time step from this new value.

void statistics_level(int min, int max)

Update the min / max levels from this new values.

void statistics_num_quadrants(int lnq)

Update the min / max local number of quadrants from this new value.

void statistics_timing_byname(std::string name, double t)

Update a timer by its name.

void statistics_timing_scheme(double t)

Update the min / max time to advance by one iteration.

void statistics_timing_io(double t)

Update the min / max time to write the solution this new value.

void statistics_write(const std::string &filename)

Write the data inside the statistics struct to a file.

Only process 0 will write to the file. Before writing, a global reduce and gather is done on all the members to get the corresponding global values.

Parameters:

filename[in] Output filename for statistics.

Public Members

MPI_Comm m_mpicomm

the global communicator

int m_mpisize

number of processses

int m_mpirank

the current process

p4est_locidx_t *m_local_num_quadrants[2]

local min / max number of quadrants. Sum of the local_num_quadrants

p4est_gloidx_t m_global_num_quadrants[2]

global min / max number of quadrants.

std::time_t m_start

run start timestamp

std::time_t m_end

run end timestamp

int m_iterations

number of iterations

double m_t

final time

double m_dt[2]

min / max time step

int m_level[2]

min / max level

double m_norml1

L1 norm.

double m_norml2

L2 norm.

std::map<std::string, double> m_timers

map containing the timers

int m_verboseLevel

verbose level for the timers

Public Static Functions

static bool add_timer(const char *name, timer_accum mpi_accum, timer_accum time_accum)

Add a new timer.

Parameters:
  • name[in] A name for the timer

  • mpi_accum[in] The accumulation over MPI tasks

  • time_accum[in] The accumulation over time steps

Returns:

true if the timer has been created, false if the name already exists

Protected Types

using timer_info_map = std::map<std::string, timer_info_t>

Protected Static Attributes

static timer_info_map s_timer_info

map containing the timers infos

Private Functions

void statistics_reduce()

Get global values for all the members of the statistics struct.

struct timer_info_t
#include “StatManager.h”

Type containing information for a timer.

Public Functions

inline timer_info_t()
inline timer_info_t(const char *name_, timer_accum mpi_accum_, timer_accum time_accum_)

Public Members

const char *name
timer_accum mpi_accum
timer_accum time_accum