FACT++  1.0
void Timers::Proc ( bool  cond,
int  maxwait = 5000,
int  interval = 10000 
)
inline

Definition at line 18 of file Timers.h.

Referenced by StateMachineFAD< T >::Execute().

19  {
20  fT[2] = Time();
21 
22  fSum[0] += (fT[2]-fT[1]).total_microseconds();
23  fSum[1] += (fT[1]-fT[3]).total_microseconds();
24  fCnt++;
25 
26  if (cond)
27  {
28  usleep(std::max(maxwait-(int)(fT[2]-fT[3]).total_microseconds(), 1));
29  fNwait++;
30  }
31 
32  const int diff = (fT[2]-fT[0]).total_milliseconds();
33  if (diff > interval)
34  {
35  fOut << "Rate(10s): poll=" << fSum[0]/fCnt << "us exec=" << fSum[1]/fCnt << "us (" << fNwait <<"/" << fCnt << ")" << std::endl;
36 
37  fSum[0] = fSum[1] = fCnt = fNwait = 0;
38  fT[0] = Time();
39  }
40 
41  fT[3] = Time();
42  }
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
int fCnt
Definition: Timers.h:9
Time fT[4]
Definition: Timers.h:6
int fSum[2]
Definition: Timers.h:8
int fNwait
Definition: Timers.h:11
static pthread_cond_t cond
Definition: feeserver.c:242
std::ostream & fOut
Definition: Timers.h:4

+ Here is the caller graph for this function: