bm::chrono_taker< TOut > Class Template 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 (TOut &tout, 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

template<typename DT>
static void | print_duration (TOut &tout, const std::string &name, DT ms)
static void | print_duration_map (TOut &tout, const duration_map_type &dmap, format fmt=ct_time)

## Protected Attributes

TOut & | tout_
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

template<typename TOut = std::ostream>
class bm::chrono_taker< TOut >

Utility class to collect performance measurements and statistics.

Examples
  inv_list.cpp, sample11.cpp, sample12.cpp, strsvsample02a.cpp, strsvsample07.cpp, strsvsample08.cpp, strsvsample09.cpp, svsample06.cpp, xsample01.cpp, xsample02.cpp, xsample03.cpp, xsample04.cpp, xsample04a.cpp, xsample05.cpp, xsample06.cpp, xsample07.cpp, xsample07a.cpp, and xsample09.cpp.

Definition at line 40 of file bmtimer.h.

## Member Typedef Documentation

## duration_map_type

template<typename TOut = std::ostream>

typedef std::map<std::string, statistics > bm::chrono_taker< TOut >::duration_map_type

test name to duration map

Examples
  inv_list.cpp, sample11.cpp, sample12.cpp, strsvsample09.cpp, svsample06.cpp, xsample01.cpp, xsample02.cpp, xsample03.cpp, xsample04.cpp, xsample04a.cpp, xsample05.cpp, xsample06.cpp, xsample07.cpp, xsample07a.cpp, and xsample09.cpp.

Definition at line 66 of file bmtimer.h.

## Member Enumeration Documentation

## format

template<typename TOut = std::ostream>

enum bm::chrono_taker::format

Enumerator
ct_time |
ct_ops_per_sec |
ct_all |

Definition at line 57 of file bmtimer.h.

## Constructor & Destructor Documentation

## chrono_taker() [1/2]

template<typename TOut = std::ostream>

bm::chrono_taker< TOut >::chrono_taker | ( | TOut & | tout,
|  | const std::string | name,
|  | unsigned | repeats = 1,
|  | duration_map_type * | dmap = 0 )

inline

Definition at line 69 of file bmtimer.h.

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

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

## ~chrono_taker()

template<typename TOut = std::ostream>

bm::chrono_taker< TOut >::~chrono_taker | ( |  | ) |

inline

Definition at line 82 of file bmtimer.h.

References is_stopped_, and stop().

## chrono_taker() [2/2]

template<typename TOut = std::ostream>

bm::chrono_taker< TOut >::chrono_taker | ( | const chrono_taker< TOut > & |  | ) |

delete

References chrono_taker().

## Member Function Documentation

## add_repeats()

template<typename TOut = std::ostream>

void bm::chrono_taker< TOut >::add_repeats | ( | unsigned | inc | ) |

inline

Definition at line 125 of file bmtimer.h.

References repeats_.

Referenced by speed_test_bv_index(), speed_test_bvs_index(), speed_test_sv_index(), and speed_test_vect_index().

## operator=()

template<typename TOut = std::ostream>

chrono_taker & bm::chrono_taker< TOut >::operator= | ( | const chrono_taker< TOut > |  | ) |

delete

References chrono_taker().

## print_duration()

template<typename TOut = std::ostream>
template<typename DT>

void bm::chrono_taker< TOut >::print_duration | ( | TOut & | tout,
|  | const std::string & | name,
|  | DT | ms )

inline static

Definition at line 131 of file bmtimer.h.

Referenced by print_duration_map(), and stop().

## print_duration_map()

template<typename TOut = std::ostream>

void bm::chrono_taker< TOut >::print_duration_map | ( | TOut & | tout,
|  | const duration_map_type & | dmap,
|  | format | fmt = ct_time )

inline static

Examples
  inv_list.cpp, sample11.cpp, sample12.cpp, strsvsample09.cpp, svsample06.cpp, xsample01.cpp, xsample02.cpp, xsample03.cpp, xsample04.cpp, xsample04a.cpp, xsample05.cpp, xsample06.cpp, xsample07.cpp, xsample07a.cpp, and xsample09.cpp.

Definition at line 150 of file bmtimer.h.

References ct_all, ct_ops_per_sec, ct_time, print_duration(), and bm::chrono_taker< TOut >::statistics::repeats.

Referenced by main(), and main().

## stop()

template<typename TOut = std::ostream>

void bm::chrono_taker< TOut >::stop | ( | bool | silent = false | ) |

inline

Definition at line 96 of file bmtimer.h.

References dmap_, bm::chrono_taker< TOut >::statistics::duration, finish_, is_stopped_, name_, print_duration(), repeats_, start_, and tout_.

Referenced by ~chrono_taker().

## Field Documentation

## dmap_

template<typename TOut = std::ostream>

duration_map_type* bm::chrono_taker< TOut >::dmap_

protected

Definition at line 225 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

## finish_

template<typename TOut = std::ostream>

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

protected

Definition at line 223 of file bmtimer.h.

Referenced by stop().

## is_stopped_

template<typename TOut = std::ostream>

bool bm::chrono_taker< TOut >::is_stopped_

protected

Definition at line 226 of file bmtimer.h.

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

## name_

template<typename TOut = std::ostream>

std::string bm::chrono_taker< TOut >::name_

protected

Definition at line 221 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

## repeats_

template<typename TOut = std::ostream>

unsigned bm::chrono_taker< TOut >::repeats_

protected

Definition at line 224 of file bmtimer.h.

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

## start_

template<typename TOut = std::ostream>

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

protected

Definition at line 222 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

## tout_

template<typename TOut = std::ostream>

TOut& bm::chrono_taker< TOut >::tout_

protected

Definition at line 220 of file bmtimer.h.

Referenced by chrono_taker(), and stop().

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

- bmtimer.h