Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Bench_Timer Class Reference

Tiny start/stop wall-clock timer. More...

#include <ca-bench.H>

Public Member Functions

void restart () noexcept
 Restart the timer to now().
 
double elapsed_seconds () const noexcept
 
double elapsed_milliseconds () const noexcept
 

Private Types

using clock_type = std::chrono::steady_clock
 
using time_point = clock_type::time_point
 

Private Attributes

time_point start_ = clock_type::now()
 

Detailed Description

Tiny start/stop wall-clock timer.

Wraps std::chrono::steady_clock so the timer cannot be tricked by wall-clock adjustments. Construction starts the timer; restart() resets it to now(); elapsed_seconds() and elapsed_milliseconds() read the duration without stopping the clock.

Definition at line 72 of file ca-bench.H.

Member Typedef Documentation

◆ clock_type

using Aleph::CA::Bench_Timer::clock_type = std::chrono::steady_clock
private

Definition at line 74 of file ca-bench.H.

◆ time_point

using Aleph::CA::Bench_Timer::time_point = clock_type::time_point
private

Definition at line 75 of file ca-bench.H.

Member Function Documentation

◆ elapsed_milliseconds()

double Aleph::CA::Bench_Timer::elapsed_milliseconds ( ) const
inlinenoexcept
Returns
milliseconds elapsed since the last restart().

Definition at line 94 of file ca-bench.H.

References Aleph::blossom_maximum_cardinality_matching(), and elapsed_seconds().

◆ elapsed_seconds()

double Aleph::CA::Bench_Timer::elapsed_seconds ( ) const
inlinenoexcept
Returns
seconds elapsed since the last restart() (or construction).

Definition at line 86 of file ca-bench.H.

References Aleph::blossom_maximum_cardinality_matching(), and start_.

Referenced by Aleph::CA::bench_seconds(), and elapsed_milliseconds().

◆ restart()

void Aleph::CA::Bench_Timer::restart ( )
inlinenoexcept

Restart the timer to now().

Definition at line 80 of file ca-bench.H.

References start_.

Member Data Documentation

◆ start_

time_point Aleph::CA::Bench_Timer::start_ = clock_type::now()
private

Definition at line 76 of file ca-bench.H.

Referenced by elapsed_seconds(), and restart().


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