profiler  0.0
molpro::profiler Namespace Reference

Namespaces

 detail
 
 dotgraph
 

Classes

class  Node
 A node in a parameter tree storing a Counter object aliased by a name. More...
 
class  Profiler
 Instrumental profiler for timing sections of code. More...
 
class  Timer
 Measures cpu or wall time. Can be constructed as a dummy that is always stopped. More...
 
class  Counter
 Resource counter used for storing operation count, call count, timing information. More...
 
struct  NodePathError
 
struct  WeakSingleton
 Implements the mechanism for the weak singleton pattern. More...
 

Enumerations

enum class  SortBy {
  wall ,
  cpu ,
  calls ,
  operations ,
  none
}
 

Functions

void report (const std::shared_ptr< Node< Counter >> &root, const std::string &description, std::ostream &out, bool cumulative=true, SortBy sort_by=SortBy::wall)
 Reports the content of a Profiler call subtree. More...
 
void report (const Profiler &prof, std::ostream &out, bool cumulative=true, SortBy sort_by=SortBy::wall)
 Reports content of Profiler. More...
 
void report (const Profiler &prof, std::ostream &out, MPI_Comm communicator, bool cumulative=true, SortBy sort_by=SortBy::wall)
 
void report_root_process (const Profiler &prof, std::ostream &out, MPI_Comm communicator, int root_process, bool cumulative=true, SortBy sort_by=SortBy::wall)
 Reports collective content of Profiler but writing on the root process only. More...
 
std::string get_dotgraph (const Profiler &prof, MPI_Comm communicator, int root_process, int *hot, int *cool, double threshold, bool get_percentage_time)
 
std::string get_dotgraph (const Profiler &prof, int hot[3], int cool[3], double threshold, bool get_percentage_time)
 
std::ostream & operator<< (std::ostream &os, const Profiler &obj)
 

Variables

std::shared_ptr< Profilers_saver
 

Enumeration Type Documentation

◆ SortBy

Enumerator
wall 
cpu 
calls 
operations 
none 

Function Documentation

◆ get_dotgraph() [1/2]

std::string molpro::profiler::get_dotgraph ( const Profiler prof,
int  hot[3],
int  cool[3],
double  threshold,
bool  get_percentage_time 
)

◆ get_dotgraph() [2/2]

std::string molpro::profiler::get_dotgraph ( const Profiler prof,
MPI_Comm  communicator,
int  root_process,
int *  hot,
int *  cool,
double  threshold,
bool  get_percentage_time 
)

◆ operator<<()

std::ostream& molpro::profiler::operator<< ( std::ostream &  os,
const Profiler obj 
)

◆ report() [1/3]

void molpro::profiler::report ( const Profiler prof,
std::ostream &  out,
bool  cumulative = true,
SortBy  sort_by = SortBy::wall 
)

Reports content of Profiler.

Parameters
profprofiler to analyse and write
outoutput stream to write to
sort_bywhat parameter to use for sorting. Sorting is done on the same level only.
cumulativewhether cumulative timings should be used or only time spend by the node and not its children

◆ report() [2/3]

void molpro::profiler::report ( const Profiler prof,
std::ostream &  out,
MPI_Comm  communicator,
bool  cumulative = true,
SortBy  sort_by = SortBy::wall 
)

◆ report() [3/3]

void molpro::profiler::report ( const std::shared_ptr< Node< Counter >> &  root,
const std::string &  description,
std::ostream &  out,
bool  cumulative = true,
SortBy  sort_by = SortBy::wall 
)

Reports the content of a Profiler call subtree.

In case only part of the call tree needs to be reported. You can use Node<Counter>::find_parent, Node<Counter::walk, Node<Counter::child and Node<Counter::walk_up to navigate to the desired node.

Example usage

Profiler p("Example of report");
p.start("A").start("B").start("C");
// do some work that uses profiler p
report(p.active_node, std::cout);
void report(const std::shared_ptr< Node< Counter >> &root, const std::string &description, std::ostream &out, bool cumulative=true, SortBy sort_by=SortBy::wall)
Reports the content of a Profiler call subtree.
Definition: report.cpp:209
profiler::Profiler Profiler
Definition: Profiler.h:6
Parameters
rootroot node of the tree, can be different from Profiler::root
descriptiondescription to use for profiler
outoutput stream to write to
cumulativewhether cumulative timings should be used or only time spend by the node and not its children
sort_bywhat parameter to use for sorting. Sorting is done on the same level only.

◆ report_root_process()

void molpro::profiler::report_root_process ( const Profiler prof,
std::ostream &  out,
MPI_Comm  communicator,
int  root_process,
bool  cumulative = true,
SortBy  sort_by = SortBy::wall 
)

Reports collective content of Profiler but writing on the root process only.

Variable Documentation

◆ s_saver

std::shared_ptr<Profiler> molpro::profiler::s_saver