19#ifndef LIBSEMIGROUPS_SRC_TIMER_H_
20#define LIBSEMIGROUPS_SRC_TIMER_H_
35 Timer() : _start(
std::chrono::high_resolution_clock::now()) {}
38 void reset() { _start = std::chrono::high_resolution_clock::now(); }
41 std::chrono::nanoseconds
elapsed()
const {
42 return std::chrono::duration_cast<std::chrono::nanoseconds>(
43 std::chrono::high_resolution_clock::now() - _start);
50 if (string_it<std::chrono::hours>(out,
elapsed,
"h ", 0)) {
51 string_it<std::chrono::minutes>(out,
elapsed,
"m", 0);
53 }
else if (string_it<std::chrono::minutes>(out,
elapsed,
"m ", 0)) {
54 string_it<std::chrono::seconds>(out,
elapsed,
"s", 0);
56 }
else if (string_it<std::chrono::milliseconds>(out,
elapsed,
"ms",
59 }
else if (string_it<std::chrono::microseconds>(out,
elapsed,
"\u03BCs",
62 }
else if (string_it<std::chrono::nanoseconds>(out,
elapsed,
"ns", 0)) {
80 std::chrono::high_resolution_clock::time_point _start;
83 bool string_it(std::string &str, std::chrono::nanoseconds &
elapsed,
84 std::string unit,
size_t threshold)
const {
85 T x = std::chrono::duration_cast<T>(
elapsed);
86 if (x > T(threshold)) {
void reset()
Definition timer.h:38
Timer()
Definition timer.h:35
std::string string() const
Definition timer.h:70
friend std::ostream & operator<<(std::ostream &os, Timer const &t)
Definition timer.h:74
std::chrono::nanoseconds elapsed() const
Definition timer.h:41
std::string string(std::chrono::nanoseconds elapsed) const
Definition timer.h:48
std::string to_string(HPCombi::epu8 const &a)
Definition epu8_impl.hpp:550