14 Timers(std::ostream &out=std::cout) : fOut(out) { fSum[0] = fSum[1] = fCnt = fNwait = 0; }
18 void Proc(
bool cond,
int maxwait=5000,
int interval=10000)
22 fSum[0] += (fT[2]-fT[1]).total_microseconds();
23 fSum[1] += (fT[1]-fT[3]).total_microseconds();
28 usleep(std::max(maxwait-(
int)(fT[2]-fT[3]).total_microseconds(), 1));
32 const int diff = (fT[2]-fT[0]).total_milliseconds();
35 fOut <<
"Rate(10s): poll=" << fSum[0]/fCnt <<
"us exec=" << fSum[1]/fCnt <<
"us (" << fNwait <<
"/" << fCnt <<
")" << std::endl;
37 fSum[0] = fSum[1] = fCnt = fNwait = 0;
Adds some functionality to boost::posix_time::ptime for our needs.
Timers(std::ostream &out=std::cout)
void Proc(bool cond, int maxwait=5000, int interval=10000)
static pthread_cond_t cond