mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
m::Timer Struct Reference

Collect timings of events. More...

#include <Timer.hpp>

Collaboration diagram for m::Timer:
[legend]

Data Structures

struct  Measurement
 
struct  TimingProcess
 A proxy class to record a Measurement with a Timer. More...
 

Public Types

using clock = std::chrono::high_resolution_clock
 
using duration = clock::duration
 
using time_point = clock::time_point
 

Public Member Functions

auto begin () const
 
auto end () const
 
auto cbegin () const
 
auto cend () const
 
const std::vector< Measurement > & measurements () const
 
const Measurementget (std::size_t i) const
 
const Measurementget (const std::string &name) const
 
void clear ()
 Erase all Measurements from this Timer.
 
TimingProcess create_timing (std::string name)
 Creates a new TimingProcess with the given name.
 
void dump (std::ostream &out) const
 
void dump () const
 
M_LCOV_EXCL_STOP duration total () const
 Computes the total duration of all Measurements.
 

Private Member Functions

std::size_t start (std::string name)
 Start a new Measurement with the name name.
 
void stop (std::size_t id)
 Stops the Measurement with the given ID.
 

Private Attributes

std::vector< Measurementmeasurements_
 

Friends

M_LCOV_EXCL_START friend std::ostream & operator<< (std::ostream &out, const Timer &timer)
 Print all finished and in-process timings of timer to out.
 

Detailed Description

Collect timings of events.

Definition at line 16 of file Timer.hpp.

Member Typedef Documentation

◆ clock

using m::Timer::clock = std::chrono::high_resolution_clock

Definition at line 39 of file Timer.hpp.

◆ duration

using m::Timer::duration = clock::duration

Definition at line 40 of file Timer.hpp.

◆ time_point

using m::Timer::time_point = clock::time_point

Definition at line 41 of file Timer.hpp.

Member Function Documentation

◆ begin()

auto m::Timer::begin ( ) const
inline

Definition at line 99 of file Timer.hpp.

References measurements_.

◆ cbegin()

auto m::Timer::cbegin ( ) const
inline

Definition at line 101 of file Timer.hpp.

References measurements_.

◆ cend()

auto m::Timer::cend ( ) const
inline

Definition at line 102 of file Timer.hpp.

References measurements_.

◆ clear()

void m::Timer::clear ( )
inline

Erase all Measurements from this Timer.

Definition at line 119 of file Timer.hpp.

References measurements_.

◆ create_timing()

TimingProcess m::Timer::create_timing ( std::string  name)
inline

Creates a new TimingProcess with the given name.

Definition at line 152 of file Timer.hpp.

References start().

Referenced by m::QueryDatabase::execute().

◆ dump() [1/2]

void Timer::dump ( ) const

Definition at line 27 of file Timer.cpp.

References dump().

Referenced by m::Timer::Measurement::dump(), and dump().

◆ dump() [2/2]

void Timer::dump ( std::ostream &  out) const

Definition at line 26 of file Timer.cpp.

◆ end()

auto m::Timer::end ( ) const
inline

Definition at line 100 of file Timer.hpp.

References measurements_.

◆ get() [1/2]

const Measurement & m::Timer::get ( const std::string &  name) const
inline

Definition at line 110 of file Timer.hpp.

References measurements_.

◆ get() [2/2]

const Measurement & m::Timer::get ( std::size_t  i) const
inline

Definition at line 105 of file Timer.hpp.

References measurements_.

Referenced by m::Timer::TimingProcess::~TimingProcess().

◆ measurements()

const std::vector< Measurement > & m::Timer::measurements ( ) const
inline

Definition at line 104 of file Timer.hpp.

References measurements_.

◆ start()

std::size_t m::Timer::start ( std::string  name)
inlineprivate

Start a new Measurement with the name name.

Returns the ID assigned to that Measurement.

Definition at line 123 of file Timer.hpp.

References id, and measurements_.

Referenced by create_timing().

◆ stop()

void m::Timer::stop ( std::size_t  id)
inlineprivate

Stops the Measurement with the given ID.

Definition at line 143 of file Timer.hpp.

References id, M_insist, and measurements_.

Referenced by m::Timer::TimingProcess::stop(), and m::Timer::TimingProcess::~TimingProcess().

◆ total()

M_LCOV_EXCL_STOP duration m::Timer::total ( ) const
inline

Computes the total duration of all Measurements.

Definition at line 169 of file Timer.hpp.

References measurements_.

Friends And Related Function Documentation

◆ operator<<

M_LCOV_EXCL_START friend std::ostream & operator<< ( std::ostream &  out,
const Timer timer 
)
friend

Print all finished and in-process timings of timer to out.

Definition at line 156 of file Timer.hpp.

Field Documentation

◆ measurements_

std::vector<Measurement> m::Timer::measurements_
private

Definition at line 96 of file Timer.hpp.

Referenced by begin(), cbegin(), cend(), clear(), end(), get(), measurements(), start(), stop(), and total().


The documentation for this struct was generated from the following files: