5 #define SMOOTH(s) for(int _smooth=0;_smooth<s;++_smooth) 8 inline double operator- (
const struct timeval & t1,
const struct timeval & t0)
10 return (t1.tv_sec - t0.tv_sec)+1e-6*(t1.tv_usec - t0.tv_usec);
18 {
switch(u) {
case S:
return "s";
case MS:
return "ms";
case US:
return "us"; }
return ""; }
20 std::stack<struct timeval>
stack;
21 mutable struct timeval
t0;
27 gettimeofday(&(stack.top()),NULL);
32 gettimeofday(&
t0,NULL);
33 double dt = (
t0-stack.top())*factor;
37 inline void toc( std::ostream& os,
double SMOOTH=1 )
static std::string unitName(Unit u)
double toc(const Unit factor)
void toc(std::ostream &os, double SMOOTH=1)
std::stack< struct timeval > stack
double operator-(const struct timeval &t1, const struct timeval &t0)