converted static variable to class member in pqihandler

This commit is contained in:
csoler 2016-06-11 18:07:57 -04:00
parent 34f49d4ae8
commit 972de42864
2 changed files with 12 additions and 10 deletions

View File

@ -70,18 +70,19 @@ static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ;
pqihandler::pqihandler() : coreMtx("pqihandler") pqihandler::pqihandler() : coreMtx("pqihandler")
{ {
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/ RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
// setup minimal total+individual rates. // setup minimal total+individual rates.
rateIndiv_out = 0.01; rateIndiv_out = 0.01;
rateIndiv_in = 0.01; rateIndiv_in = 0.01;
rateMax_out = 0.01; rateMax_out = 0.01;
rateMax_in = 0.01; rateMax_in = 0.01;
rateTotal_in = 0.0 ; rateTotal_in = 0.0 ;
rateTotal_out = 0.0 ; rateTotal_out = 0.0 ;
last_m = time(NULL) ; last_m = time(NULL) ;
nb_ticks = 0 ; nb_ticks = 0 ;
ticks_per_sec = 5 ; // initial guess mLastRateCapUpdate = 0 ;
ticks_per_sec = 5 ; // initial guess
return; return;
} }
@ -116,9 +117,9 @@ int pqihandler::tick()
#endif #endif
} }
static time_t last_print_time = 0 ;
time_t now = time(NULL) ; time_t now = time(NULL) ;
if(now > last_print_time + 5)
if(now > mLastRateCapUpdate + 5)
{ {
// every 5 secs, update the max rates for all modules // every 5 secs, update the max rates for all modules
@ -133,7 +134,7 @@ int pqihandler::tick()
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up. it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
} }
last_print_time = now ; mLastRateCapUpdate = now ;
} }
UpdateRates(); UpdateRates();

View File

@ -121,6 +121,7 @@ protected:
uint32_t nb_ticks ; uint32_t nb_ticks ;
time_t last_m ; time_t last_m ;
time_t mLastRateCapUpdate ;
float ticks_per_sec ; float ticks_per_sec ;
}; };