21 #ifndef _libint2_src_lib_libint_timer_h_ 22 #define _libint2_src_lib_libint_timer_h_ 26 #include <libint2/util/cxxstd.h> 28 #if LIBINT2_CPLUSPLUS_STD >= 2011 40 typedef std::chrono::duration<double> dur_t;
41 typedef std::chrono::high_resolution_clock clock_t;
42 typedef std::chrono::time_point<clock_t> time_point_t;
50 static time_point_t
now() {
51 return clock_t::now();
58 overhead_ = std::chrono::nanoseconds(ns);
68 const auto tstop =
now();
69 const dur_t result = (tstop - tstart_[t]) - overhead_;
74 double read(
size_t t)
const {
75 return timers_[t].count();
79 for(
auto t=0; t!=ntimers; ++t) {
80 timers_[t] = dur_t::zero();
81 tstart_[t] = time_point_t();
86 constexpr
static auto ntimers = N;
87 dur_t timers_[ntimers];
88 time_point_t tstart_[ntimers];
94 #endif // C++11 or later 96 #endif // defined(__cplusplus) 98 #endif // header guard void clear()
resets timers to zero
Definition: timer.h:78
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
dur_t stop(size_t t)
stops timer t
Definition: timer.h:67
double read(size_t t) const
reads value (in seconds) of timer t , converted to double
Definition: timer.h:74
static time_point_t now()
returns the current time point
Definition: timer.h:50
void start(size_t t)
starts timer t
Definition: timer.h:62
void set_now_overhead(size_t ns)
use this to report the overhead of now() call; if set, the reported timings will be adjusted for this...
Definition: timer.h:57
Timers aggregates N C++11 "timers"; used to high-resolution profile stages of integral computation.
Definition: timer.h:38