SASC
DVBSoftCAM

cLogStats Class Reference

Inheritance diagram for cLogStats:

List of all members.

Public Member Functions

 cLogStats (void)
 ~cLogStats ()
void Count (void)
 cLogStats (void)
 ~cLogStats ()
void Count (void)

Protected Member Functions

virtual void Action (void)
virtual void Action (void)

Detailed Description

Definition at line 88 of file cam.c.


Constructor & Destructor Documentation

cLogStats::cLogStats ( void  )

Definition at line 117 of file cam.c.

References COUNTS, i, SAMPLE, cThread::SetDescription(), and cThread::Start().

{
  sCount=sIdx=0;
  for(int i=0; i<COUNTS; i++) { sCounts[i][0]=0; sCounts[i][1]=SAMPLE; }
  SetDescription("logger stats");
  Start();
}
cLogStats::~cLogStats ( )

Definition at line 125 of file cam.c.

References cThread::Cancel().

{
  Cancel(2);
}
cLogStats::cLogStats ( void  )
cLogStats::~cLogStats ( )

Member Function Documentation

void cLogStats::Action ( void  ) [protected, virtual]

A derived cThread class must implement the code it wants to execute as a separate thread in this function. If this is a loop, it must check Running() repeatedly to see whether it's time to stop.

Implements cThread.

Definition at line 135 of file cam.c.

References AVR1, AVR2, AVR3, COUNTS, cTimeMs::Elapsed(), i, L_CORE_AUSTATS, LBEND, LBPUT, LBSTART, REPORT, cThread::Running(), SAMPLE, cTimeMs::Set(), and cCondWait::SleepMs().

{
  while(Running()) {
    cCondWait::SleepMs(50);
    if(sTime.Elapsed()>SAMPLE) {
      sCounts[sIdx][0]=sCount;          sCount=0;
      sCounts[sIdx][1]=sTime.Elapsed(); sTime.Set();
      if(++sIdx >= COUNTS) sIdx=0;
      }
    if(repTime.Elapsed()>REPORT) {
      repTime.Set();
      if(sCounts[(sIdx+COUNTS-1)%COUNTS][0]>0) {
        LBSTART(L_CORE_AUSTATS);
        LBPUT("EMM packet load average (%d/%d/%dmin)",AVR1/60000,AVR2/60000,AVR3/60000);
        int s=0, t=0;
        for(int i=1; i<=COUNTS; i++) {
          s+=sCounts[(sIdx+COUNTS-i)%COUNTS][0];
          t+=sCounts[(sIdx+COUNTS-i)%COUNTS][1];
          if(i==(AVR1/SAMPLE) || i==(AVR2/SAMPLE) || i==(AVR3/SAMPLE))
            LBPUT(" %4d",(int)((float)s/(float)t*1000.0));
          }
        LBPUT(" pks/s");
        LBEND();
        }
      }
    }
}
virtual void cLogStats::Action ( void  ) [protected, virtual]

A derived cThread class must implement the code it wants to execute as a separate thread in this function. If this is a loop, it must check Running() repeatedly to see whether it's time to stop.

Implements cThread.

void cLogStats::Count ( void  )
void cLogStats::Count ( void  )

Definition at line 130 of file cam.c.

Referenced by cLogger::Process().

{
  sCount++;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines