4 #include <sys/resource.h> 13 Timer() : state_(uninitialized), t1_(0), t2_(0) {;}
14 Timer(
double floating_ops1 ) : floating_ops(floating_ops1) {}
39 void report(
char const* what )
const 42 std::cout <<
"Time for " 49 << floating_ops/t/1000000
59 getrusage(RUSAGE_SELF, &resourceUsage_);
60 double seconds = resourceUsage_.ru_utime.tv_sec
61 + resourceUsage_.ru_stime.tv_sec;
62 double micros = resourceUsage_.ru_utime.tv_usec
63 + resourceUsage_.ru_stime.tv_usec;
64 return seconds + micros/1.0e6;
71 struct rusage resourceUsage_;
void report(char const *what) const
Timer(double floating_ops1)