9 #include "cetlib_except/exception.h" 11 #include <sys/resource.h> 32 if (getrusage(RUSAGE_SELF, &theUsage) != 0) {
33 throw exception(
"cpu_timer",
"Failure in get_current_stats") <<
errno;
37 now.tv_sec = theUsage.ru_stime.tv_sec + theUsage.ru_utime.tv_sec;
38 now.tv_usec = theUsage.ru_stime.tv_usec + theUsage.ru_utime.tv_usec;
45 double constexpr microsec_per_sec{1
E-6};
46 return t1.tv_sec - t2.tv_sec + (t1.tv_usec - t2.tv_usec) * microsec_per_sec;
double accumulated_cpu_time_
int errno
Contains the last error code.
QuadExpr operator-(double v, const QuadExpr &e)
double accumulated_cpu_time() const
double elapsed_cpu_time() const
double accumulated_real_time_
double accumulated_real_time() const
double elapsed_real_time() const
int gettimeofday(struct timeval *, struct timezone *)
cet::coded_exception< error, detail::translate > exception