TablePrinter Class Reference

CPP API: mio::timing::TablePrinter Class Reference

#include <table_printer.h>

Inheritance diagram for mio::timing::TablePrinter:
Collaboration diagram for mio::timing::TablePrinter:

Public Member Functions

void print (const std::list< TimerRegistration > &timer_register, std::ostream &out=std::cout) override
 Print a table with timing results (aggregated over threads). More...
 
void set_time_format (std::string format_string)
 Change the format_string used for printed time values. More...
 
- Public Member Functions inherited from mio::timing::Printer
virtual ~Printer ()
 

Static Private Member Functions

static std::tuple< details::Table< double >, bool, size_t, double > create_table (const std::list< TimerRegistration > &timer_register)
 The first part of the print function, separated as a somewhat independent step. More...
 

Private Attributes

std::string m_time_format = "{:e}"
 Format string used to print elapsed time and other timing statistics. More...
 

Member Function Documentation

◆ create_table()

static std::tuple<details::Table<double>, bool, size_t, double> mio::timing::TablePrinter::create_table ( const std::list< TimerRegistration > &  timer_register)
inlinestaticprivate

The first part of the print function, separated as a somewhat independent step.

Parameters
[in]timer_registerThe list of all timers that should be converted to a table.
Returns
Returns the table of timers, whether multiple threads were used, the width of the name column, and the largest value found in the table.

◆ print()

void mio::timing::TablePrinter::print ( const std::list< TimerRegistration > &  timer_register,
std::ostream &  out = std::cout 
)
inlineoverridevirtual

Print a table with timing results (aggregated over threads).

If multiple threads were used for timing, adds columns with min, max and average time measured per thread, and a column with the number of threads.

Parameters
[in]timer_registerTimerRegistrar's register of timers.
[in,out]outThe stream to write to.

Implements mio::timing::Printer.

◆ set_time_format()

void mio::timing::TablePrinter::set_time_format ( std::string  format_string)
inline

Change the format_string used for printed time values.

Default is scientific notation "{:e}".

Parameters
[in]format_stringA format string for printing double values. Should have fixed width, like "{:16.4f}".

Member Data Documentation

◆ m_time_format

std::string mio::timing::TablePrinter::m_time_format = "{:e}"
private

Format string used to print elapsed time and other timing statistics.