BitMagic-C++
bm::chrono_taker Class Reference

Utility class to collect performance measurements and statistics. More...

#include <bmtimer.h>

Data Structures

struct  statistics
 collected statistics More...

Public Types

enum  format { ct_time = 0 , ct_ops_per_sec , ct_all }
typedef std::map< std::string, statistics > duration_map_type
 test name to duration map

Public Member Functions

 chrono_taker (const std::string name, unsigned repeats=1, duration_map_type *dmap=0)
 ~chrono_taker ()
void stop (bool silent=false)
void add_repeats (unsigned inc)
 chrono_taker (const chrono_taker &)=delete
chrono_taker & operator= (const chrono_taker)=delete

Static Public Member Functions

static void print_duration_map (const duration_map_type &dmap, format fmt=ct_time)

Protected Attributes

std::string name_
std::chrono::time_point< std::chrono::steady_clock > start_
std::chrono::time_point< std::chrono::steady_clock > finish_
unsigned repeats_
duration_map_type * dmap_
bool is_stopped_

Detailed Description

Utility class to collect performance measurements and statistics.

Examples
sample11.cpp, sample12.cpp, svsample06.cpp, xsample01.cpp, xsample02.cpp, xsample03.cpp, xsample04.cpp, xsample04a.cpp, xsample05.cpp, and xsample06.cpp.

Definition at line 39 of file bmtimer.h.

Member Typedef Documentation

◆ duration_map_type

Member Enumeration Documentation

◆ format

Enumerator
ct_time 
ct_ops_per_sec 
ct_all 

Definition at line 56 of file bmtimer.h.

Constructor & Destructor Documentation

◆ chrono_taker() [1/2]

bm::chrono_taker::chrono_taker ( const std::string name,
unsigned repeats = 1,
duration_map_type * dmap = 0 )
inline

Definition at line 68 of file bmtimer.h.

References dmap_, is_stopped_, name_, repeats, repeats_, and start_.

Referenced by chrono_taker(), and operator=().

◆ ~chrono_taker()

bm::chrono_taker::~chrono_taker ( )
inline

Definition at line 79 of file bmtimer.h.

References is_stopped_, and stop().

◆ chrono_taker() [2/2]

bm::chrono_taker::chrono_taker ( const chrono_taker & )
delete

References chrono_taker().

Member Function Documentation

◆ add_repeats()

void bm::chrono_taker::add_repeats ( unsigned inc)
inline

◆ operator=()

chrono_taker & bm::chrono_taker::operator= ( const chrono_taker )
delete

References chrono_taker().

◆ print_duration_map()

void bm::chrono_taker::print_duration_map ( const duration_map_type & dmap,
format fmt = ct_time )
inlinestatic

◆ stop()

void bm::chrono_taker::stop ( bool silent = false)
inline

Definition at line 93 of file bmtimer.h.

References dmap_, bm::chrono_taker::statistics::duration, finish_, is_stopped_, name_, repeats_, and start_.

Referenced by ~chrono_taker().

Field Documentation

◆ dmap_

duration_map_type* bm::chrono_taker::dmap_
protected

Definition at line 208 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

◆ finish_

std::chrono::time_point<std::chrono::steady_clock> bm::chrono_taker::finish_
protected

Definition at line 206 of file bmtimer.h.

Referenced by stop().

◆ is_stopped_

bool bm::chrono_taker::is_stopped_
protected

Definition at line 209 of file bmtimer.h.

Referenced by chrono_taker(), stop(), and ~chrono_taker().

◆ name_

std::string bm::chrono_taker::name_
protected

Definition at line 204 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

◆ repeats_

unsigned bm::chrono_taker::repeats_
protected

Definition at line 207 of file bmtimer.h.

Referenced by add_repeats(), chrono_taker(), and stop().

◆ start_

std::chrono::time_point<std::chrono::steady_clock> bm::chrono_taker::start_
protected

Definition at line 205 of file bmtimer.h.

Referenced by chrono_taker(), and stop().


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