Block-Structured AMR Software Framework
amrex::TinyProfiler Class Reference

A simple profiler that returns basic performance information (e.g. min, max, and average running time) More...

#include <AMReX_TinyProfiler.H>

Classes

struct  MemProcStats
 
struct  ProcStats
 stats across processes More...
 
struct  Stats
 

Public Member Functions

 TinyProfiler (std::string funcname) noexcept
 
 TinyProfiler (std::string funcname, bool start_) noexcept
 
 TinyProfiler (const char *funcname) noexcept
 
 TinyProfiler (const char *funcname, bool start_) noexcept
 
 ~TinyProfiler ()
 
 TinyProfiler (TinyProfiler const &)=delete
 
 TinyProfiler (TinyProfiler &&)=delete
 
TinyProfileroperator= (TinyProfiler const &)=delete
 
TinyProfileroperator= (TinyProfiler &&)=delete
 
void start () noexcept
 
void stop () noexcept
 
void memory_start () const noexcept
 
void memory_stop () const noexcept
 

Static Public Member Functions

static MemStatmemory_alloc (std::size_t nbytes, std::map< std::string, MemStat > &memstats) noexcept
 
static void memory_free (std::size_t nbytes, MemStat *stat) noexcept
 
static void Initialize () noexcept
 
static void Finalize (bool bFlushing=false) noexcept
 
static void MemoryInitialize () noexcept
 
static void MemoryFinalize (bool bFlushing=false) noexcept
 
static bool RegisterArena (const std::string &memory_name, std::map< std::string, MemStat > &memstats) noexcept
 
static void DeregisterArena (std::map< std::string, MemStat > &memstats) noexcept
 
static void StartRegion (std::string regname) noexcept
 
static void StopRegion (const std::string &regname) noexcept
 
static void PrintCallStack (std::ostream &os)
 

Static Private Member Functions

static std::string const & get_output_file ()
 
static void PrintStats (std::map< std::string, Stats > &regstats, double dt_max, std::ostream *os)
 
static void PrintMemStats (std::map< std::string, MemStat > &memstats, std::string const &memname, double dt_max, double t_final, std::ostream *os)
 

Private Attributes

std::string fname
 
bool in_parallel_region = false
 
int global_depth = -1
 
std::vector< Stats * > stats
 

Static Private Attributes

static std::deque< const TinyProfiler * > mem_stack
 
static std::vector< std::map< std::string, MemStat > * > all_memstats
 
static std::vector< std::string > all_memnames
 
static std::vector< std::string > regionstack
 
static std::deque< std::tuple< double, double, std::string * > > ttstack
 
static std::map< std::string, std::map< std::string, Stats > > statsmap
 
static double t_init = std::numeric_limits<double>::max()
 
static bool device_synchronize_around_region = false
 
static int n_print_tabs = 0
 
static int verbose = 0
 
static double print_threshold = 1.
 
static bool enabled = true
 
static bool memprof_enabled = true
 
static std::string output_file
 

Detailed Description

A simple profiler that returns basic performance information (e.g. min, max, and average running time)

Constructor & Destructor Documentation

◆ TinyProfiler() [1/6]

amrex::TinyProfiler::TinyProfiler ( std::string  funcname)
explicitnoexcept

◆ TinyProfiler() [2/6]

amrex::TinyProfiler::TinyProfiler ( std::string  funcname,
bool  start_ 
)
noexcept

◆ TinyProfiler() [3/6]

amrex::TinyProfiler::TinyProfiler ( const char *  funcname)
explicitnoexcept

◆ TinyProfiler() [4/6]

amrex::TinyProfiler::TinyProfiler ( const char *  funcname,
bool  start_ 
)
noexcept

◆ ~TinyProfiler()

amrex::TinyProfiler::~TinyProfiler ( )

◆ TinyProfiler() [5/6]

amrex::TinyProfiler::TinyProfiler ( TinyProfiler const &  )
delete

◆ TinyProfiler() [6/6]

amrex::TinyProfiler::TinyProfiler ( TinyProfiler &&  )
delete

Member Function Documentation

◆ DeregisterArena()

void amrex::TinyProfiler::DeregisterArena ( std::map< std::string, MemStat > &  memstats)
staticnoexcept

◆ Finalize()

void amrex::TinyProfiler::Finalize ( bool  bFlushing = false)
staticnoexcept

◆ get_output_file()

std::string const & amrex::TinyProfiler::get_output_file ( )
staticprivate

◆ Initialize()

void amrex::TinyProfiler::Initialize ( )
staticnoexcept

◆ memory_alloc()

MemStat * amrex::TinyProfiler::memory_alloc ( std::size_t  nbytes,
std::map< std::string, MemStat > &  memstats 
)
staticnoexcept

◆ memory_free()

void amrex::TinyProfiler::memory_free ( std::size_t  nbytes,
MemStat stat 
)
staticnoexcept

◆ memory_start()

void amrex::TinyProfiler::memory_start ( ) const
noexcept

◆ memory_stop()

void amrex::TinyProfiler::memory_stop ( ) const
noexcept

◆ MemoryFinalize()

void amrex::TinyProfiler::MemoryFinalize ( bool  bFlushing = false)
staticnoexcept

◆ MemoryInitialize()

void amrex::TinyProfiler::MemoryInitialize ( )
staticnoexcept

◆ operator=() [1/2]

TinyProfiler& amrex::TinyProfiler::operator= ( TinyProfiler &&  )
delete

◆ operator=() [2/2]

TinyProfiler& amrex::TinyProfiler::operator= ( TinyProfiler const &  )
delete

◆ PrintCallStack()

void amrex::TinyProfiler::PrintCallStack ( std::ostream &  os)
static

◆ PrintMemStats()

void amrex::TinyProfiler::PrintMemStats ( std::map< std::string, MemStat > &  memstats,
std::string const &  memname,
double  dt_max,
double  t_final,
std::ostream *  os 
)
staticprivate

◆ PrintStats()

void amrex::TinyProfiler::PrintStats ( std::map< std::string, Stats > &  regstats,
double  dt_max,
std::ostream *  os 
)
staticprivate

◆ RegisterArena()

bool amrex::TinyProfiler::RegisterArena ( const std::string &  memory_name,
std::map< std::string, MemStat > &  memstats 
)
staticnoexcept

◆ start()

void amrex::TinyProfiler::start ( )
noexcept

◆ StartRegion()

void amrex::TinyProfiler::StartRegion ( std::string  regname)
staticnoexcept

◆ stop()

void amrex::TinyProfiler::stop ( )
noexcept

◆ StopRegion()

void amrex::TinyProfiler::StopRegion ( const std::string &  regname)
staticnoexcept

Member Data Documentation

◆ all_memnames

std::vector< std::string > amrex::TinyProfiler::all_memnames
staticprivate

◆ all_memstats

std::vector< std::map< std::string, MemStat > * > amrex::TinyProfiler::all_memstats
staticprivate

◆ device_synchronize_around_region

bool amrex::TinyProfiler::device_synchronize_around_region = false
staticprivate

◆ enabled

bool amrex::TinyProfiler::enabled = true
staticprivate

◆ fname

std::string amrex::TinyProfiler::fname
private

◆ global_depth

int amrex::TinyProfiler::global_depth = -1
private

◆ in_parallel_region

bool amrex::TinyProfiler::in_parallel_region = false
private

◆ mem_stack

std::deque< const TinyProfiler * > amrex::TinyProfiler::mem_stack
staticprivate

◆ memprof_enabled

bool amrex::TinyProfiler::memprof_enabled = true
staticprivate

◆ n_print_tabs

int amrex::TinyProfiler::n_print_tabs = 0
staticprivate

◆ output_file

std::string amrex::TinyProfiler::output_file
staticprivate

◆ print_threshold

double amrex::TinyProfiler::print_threshold = 1.
staticprivate

◆ regionstack

std::vector< std::string > amrex::TinyProfiler::regionstack
staticprivate

◆ stats

std::vector<Stats*> amrex::TinyProfiler::stats
private

◆ statsmap

std::map< std::string, std::map< std::string, TinyProfiler::Stats > > amrex::TinyProfiler::statsmap
staticprivate

◆ t_init

double amrex::TinyProfiler::t_init = std::numeric_limits<double>::max()
staticprivate

◆ ttstack

std::deque< std::tuple< double, double, std::string * > > amrex::TinyProfiler::ttstack
staticprivate

◆ verbose

int amrex::TinyProfiler::verbose = 0
staticprivate

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