1#ifndef CGMRES__TIMER_HPP_
2#define CGMRES__TIMER_HPP_
32 void disp(std::ostream& os)
const {
33 os <<
"TimingProfile: " << std::endl;
35 os <<
" max time: " <<
max_time_ms <<
" [ms]" << std::endl;
36 os <<
" counts: " <<
counts << std::endl;
64 total_elapsed_time_ = 0;
65 max_elapsed_time_ = 0;
72 time_point_ = std::chrono::high_resolution_clock::now();
79 const auto now = std::chrono::high_resolution_clock::now();
80 const std::chrono::duration<Scalar, std::milli> elapsed_time = now - time_point_;
81 total_elapsed_time_ += elapsed_time.count();
82 max_elapsed_time_ = std::max(max_elapsed_time_, elapsed_time.count());
101 unsigned long counts_;
102 Scalar total_elapsed_time_, max_elapsed_time_;
103 std::chrono::high_resolution_clock::time_point time_point_;
A timer for benchmarks.
Definition: timer.hpp:50
void reset()
Definition: timer.hpp:62
void tick()
Start timer (tick).
Definition: timer.hpp:71
Timer()
Default constructor.
Definition: timer.hpp:55
TimingProfile getProfile() const
Get timing result as TimingProfile.
Definition: timer.hpp:90
~Timer()=default
Default destructor.
void tock()
Stop the timer (tock).
Definition: timer.hpp:78
Definition: continuation_gmres.hpp:11
double Scalar
Alias of double.
Definition: types.hpp:11
A profile of the timing benchmark.
Definition: timer.hpp:16
Scalar max_time_ms
Maximum computational time in milliseconds.
Definition: timer.hpp:25
void disp(std::ostream &os) const
Definition: timer.hpp:32
Scalar average_time_ms
Average computational time in milliseconds.
Definition: timer.hpp:20
unsigned long counts
Number of timing counts.
Definition: timer.hpp:30
friend std::ostream & operator<<(std::ostream &os, const TimingProfile &profile)
Definition: timer.hpp:39