BitMagic-C++: bm::chrono_taker Class Reference

BitMagic-C++

Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
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 More...

## 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

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

test name to duration map

Definition at line 65 of file bmtimer.h.

## Member Enumeration Documentation

## ◆ format

enum bm::chrono_taker::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 start_.

## ◆ ~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

## Member Function Documentation

## ◆ add_repeats()

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

Definition at line 121 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=()

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

## ◆ print_duration_map()

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

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 127 of file bmtimer.h.

References ct_all, ct_ops_per_sec, ct_time, and bm::chrono_taker::statistics::repeats.

Referenced by main().

## ◆ 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_, bm::chrono_taker::statistics::repeats, 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 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 stop(), and ~chrono_taker().

## ◆ name_

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

Definition at line 204 of file bmtimer.h.

Referenced by stop().

## ◆ repeats_

unsigned bm::chrono_taker::repeats_
| protected

Definition at line 207 of file bmtimer.h.

Referenced by add_repeats(), 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:

- bmtimer.h