1 #ifndef AMREX_TINY_PROFILER_H_
2 #define AMREX_TINY_PROFILER_H_
3 #include <AMReX_Config.H>
34 TinyProfiler (std::string funcname,
bool start_) noexcept;
36 TinyProfiler (
const char* funcname,
bool start_) noexcept;
44 void start () noexcept;
45 void stop () noexcept;
51 std::map<std::
string,
MemStat>& memstats) noexcept;
55 static
void Finalize (
bool bFlushing = false) noexcept;
61 std::map<std::
string,
MemStat>& memstats) noexcept;
65 static
void StartRegion (std::
string regname) noexcept;
66 static
void StopRegion (const std::
string& regname) noexcept;
124 struct aligned_deque {
126 alignas(64) std::deque<const TinyProfiler*> deque;
129 static std::vector<aligned_deque> mem_stack_thread_private;
135 static std::deque<std::tuple<double,double,std::string*> >
ttstack;
136 static std::map<std::string,std::map<std::string, Stats> >
statsmap;
147 static void PrintStats (std::map<std::string,Stats>& regstats,
double dt_max,
149 static void PrintMemStats (std::map<std::string, MemStat>& memstats,
150 std::string
const& memname,
double dt_max,
151 double t_final, std::ostream* os);
Definition: AMReX_TinyProfiler.H:155
~TinyProfileRegion()
Definition: AMReX_TinyProfiler.cpp:940
TinyProfileRegion(TinyProfileRegion const &)=delete
TinyProfileRegion(std::string a_regname) noexcept
Definition: AMReX_TinyProfiler.cpp:924
TinyProfileRegion & operator=(TinyProfileRegion const &)=delete
TinyProfileRegion(TinyProfileRegion &&)=delete
std::string regname
Definition: AMReX_TinyProfiler.H:165
TinyProfiler tprof
Definition: AMReX_TinyProfiler.H:166
A simple profiler that returns basic performance information (e.g. min, max, and average running time...
Definition: AMReX_TinyProfiler.H:31
static bool memprof_enabled
Definition: AMReX_TinyProfiler.H:143
static std::vector< std::string > regionstack
Definition: AMReX_TinyProfiler.H:134
static bool RegisterArena(const std::string &memory_name, std::map< std::string, MemStat > &memstats) noexcept
Definition: AMReX_TinyProfiler.cpp:492
static void MemoryInitialize() noexcept
Definition: AMReX_TinyProfiler.cpp:335
static bool device_synchronize_around_region
Definition: AMReX_TinyProfiler.H:138
static std::deque< const TinyProfiler * > mem_stack
Definition: AMReX_TinyProfiler.H:121
static std::string const & get_output_file()
Definition: AMReX_TinyProfiler.cpp:958
static void PrintMemStats(std::map< std::string, MemStat > &memstats, std::string const &memname, double dt_max, double t_final, std::ostream *os)
Definition: AMReX_TinyProfiler.cpp:732
TinyProfiler & operator=(TinyProfiler const &)=delete
static void Finalize(bool bFlushing=false) noexcept
Definition: AMReX_TinyProfiler.cpp:354
static void MemoryFinalize(bool bFlushing=false) noexcept
Definition: AMReX_TinyProfiler.cpp:447
static bool enabled
Definition: AMReX_TinyProfiler.H:142
static int verbose
Definition: AMReX_TinyProfiler.H:140
static std::vector< std::string > all_memnames
Definition: AMReX_TinyProfiler.H:132
static double print_threshold
Definition: AMReX_TinyProfiler.H:141
std::vector< Stats * > stats
Definition: AMReX_TinyProfiler.H:119
static std::deque< std::tuple< double, double, std::string * > > ttstack
Definition: AMReX_TinyProfiler.H:135
TinyProfiler(TinyProfiler const &)=delete
static void PrintStats(std::map< std::string, Stats > ®stats, double dt_max, std::ostream *os)
Definition: AMReX_TinyProfiler.cpp:518
static MemStat * memory_alloc(std::size_t nbytes, std::map< std::string, MemStat > &memstats) noexcept
Definition: AMReX_TinyProfiler.cpp:267
void stop() noexcept
Definition: AMReX_TinyProfiler.cpp:155
std::string fname
Definition: AMReX_TinyProfiler.H:116
static void PrintCallStack(std::ostream &os)
Definition: AMReX_TinyProfiler.cpp:947
TinyProfiler(std::string funcname) noexcept
Definition: AMReX_TinyProfiler.cpp:64
bool in_parallel_region
Definition: AMReX_TinyProfiler.H:117
void start() noexcept
Definition: AMReX_TinyProfiler.cpp:94
static double t_init
Definition: AMReX_TinyProfiler.H:137
void memory_start() const noexcept
Definition: AMReX_TinyProfiler.cpp:228
void memory_stop() const noexcept
Definition: AMReX_TinyProfiler.cpp:245
static void StartRegion(std::string regname) noexcept
Definition: AMReX_TinyProfiler.cpp:905
static std::map< std::string, std::map< std::string, Stats > > statsmap
Definition: AMReX_TinyProfiler.H:136
~TinyProfiler()
Definition: AMReX_TinyProfiler.cpp:88
static void StopRegion(const std::string ®name) noexcept
Definition: AMReX_TinyProfiler.cpp:915
static void memory_free(std::size_t nbytes, MemStat *stat) noexcept
Definition: AMReX_TinyProfiler.cpp:296
static std::vector< std::map< std::string, MemStat > * > all_memstats
Definition: AMReX_TinyProfiler.H:131
static void Initialize() noexcept
Definition: AMReX_TinyProfiler.cpp:311
int global_depth
Definition: AMReX_TinyProfiler.H:118
TinyProfiler(TinyProfiler &&)=delete
static std::string output_file
Definition: AMReX_TinyProfiler.H:144
static int n_print_tabs
Definition: AMReX_TinyProfiler.H:139
static void DeregisterArena(std::map< std::string, MemStat > &memstats) noexcept
Definition: AMReX_TinyProfiler.cpp:503
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
Definition: AMReX_Arena.H:12
Long currentmem
amount of currently used memory in bytes
Definition: AMReX_TinyProfiler.H:24
Long maxmem
running maximum of currentmem
Definition: AMReX_TinyProfiler.H:26
Long nalloc
number of allocations
Definition: AMReX_TinyProfiler.H:22
Long nfree
number of frees
Definition: AMReX_TinyProfiler.H:23
double avgmem
memory used (bytes) times time in use (seconds)
Definition: AMReX_TinyProfiler.H:25
Definition: AMReX_TinyProfiler.H:101
static bool compmem(const MemProcStats &lhs, const MemProcStats &rhs)
Definition: AMReX_TinyProfiler.H:111
Long avgmem_avg
Definition: AMReX_TinyProfiler.H:105
Long maxmem_avg
Definition: AMReX_TinyProfiler.H:108
Long nalloc
Definition: AMReX_TinyProfiler.H:102
Long avgmem_max
Definition: AMReX_TinyProfiler.H:106
Long maxmem_min
Definition: AMReX_TinyProfiler.H:107
Long nfree
Definition: AMReX_TinyProfiler.H:103
Long maxmem_max
Definition: AMReX_TinyProfiler.H:109
Long avgmem_min
Definition: AMReX_TinyProfiler.H:104
std::string fname
Definition: AMReX_TinyProfiler.H:110
stats across processes
Definition: AMReX_TinyProfiler.H:82
double dtexmin
Definition: AMReX_TinyProfiler.H:88
Long navg
Definition: AMReX_TinyProfiler.H:85
double dtexavg
Definition: AMReX_TinyProfiler.H:89
std::string fname
Definition: AMReX_TinyProfiler.H:91
static bool compin(const ProcStats &lhs, const ProcStats &rhs)
Definition: AMReX_TinyProfiler.H:95
Long nmin
Definition: AMReX_TinyProfiler.H:84
Long nmax
Definition: AMReX_TinyProfiler.H:85
double dtexmax
Definition: AMReX_TinyProfiler.H:89
bool do_print
Definition: AMReX_TinyProfiler.H:90
double dtinavg
Definition: AMReX_TinyProfiler.H:87
double dtinmax
Definition: AMReX_TinyProfiler.H:87
double dtinmin
Definition: AMReX_TinyProfiler.H:86
static bool compex(const ProcStats &lhs, const ProcStats &rhs)
Definition: AMReX_TinyProfiler.H:92
Definition: AMReX_TinyProfiler.H:72