#include <RooGKCounter.h>
Public Member Functions | |
void | count (void) |
unsigned long int | getCount (void) |
void | increment (long int _incr) |
RooGKCounter () | |
RooGKCounter (const char *message) | |
RooGKCounter (unsigned long int theFirst, unsigned long int theDivider) | |
void | setCounter (unsigned long int) |
void | setDivider (unsigned int) |
void | setMessage (const char *) |
void | setNewLine (bool newLine) |
void | setPrintCount (bool _printCount) |
~RooGKCounter () | |
Private Member Functions | |
void | init (void) |
Private Attributes | |
unsigned long int | _count |
unsigned int | _divider |
unsigned long int | _firstCount |
std::string | _message |
bool | _newLine |
bool | firstCountEntry |
time_t | firstTickTime |
time_t | initTime |
time_t | lastPrintTime |
time_t | lastTickTime |
bool | printCount |
Definition at line 10 of file RooGKCounter.h.
RooGKCounter::RooGKCounter | ( | ) |
RooGKCounter::RooGKCounter | ( | const char * | message | ) |
Definition at line 16 of file RooGKCounter.cc.
References _message, init(), python::rootplot::argparse::message, and printCount.
{ init(); _message = message; if ( _message . length() == 0 ) printCount = false; }
RooGKCounter::RooGKCounter | ( | unsigned long int | theFirst, |
unsigned long int | theDivider | ||
) |
Definition at line 22 of file RooGKCounter.cc.
References _count, _divider, _firstCount, init(), and printCount.
{ init(); _count = theFirst; _firstCount = theFirst; _divider = theDivider; printCount = true; }
RooGKCounter::~RooGKCounter | ( | ) |
Definition at line 117 of file RooGKCounter.cc.
{ }
void RooGKCounter::count | ( | void | ) |
Definition at line 66 of file RooGKCounter.cc.
References _count, _divider, _firstCount, _message, _newLine, gather_cfg::cout, firstCountEntry, firstTickTime, lastPrintTime, lastTickTime, NULL, printCount, and cond::rpcobgas::time.
Referenced by HcalLutManager::getCompressionLutXmlFromAsciiMaster(), HcalLutManager::getCompressionLutXmlFromCoder(), HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap(), HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap_new(), HcalLutManager::getLinearizationLutXmlFromCoder(), HcalLutManager::getLinearizationLutXmlFromCoderEmap(), HcalLutManager::getLutXmlFromAsciiMaster(), and HcalLutManager::getZdcLutXml().
{ _count++; double _number; double _freq; double _limit = 1./(double)_divider; _number = (double)_count; _freq = (double)_divider; if (firstCountEntry){ if ( printCount ) std::cout << "Counter is on:" << std::endl; firstCountEntry = false; firstTickTime = time( NULL ); } if ( printCount ){ if ( fmod( _number, _freq ) < _limit ){ double averageTimeSinceFirstTick = 0.0; if ( _count > _firstCount ) { averageTimeSinceFirstTick = ( time( NULL ) - firstTickTime ) / (double)( _count - _firstCount ); } if ( !_newLine ) { std::cout << char(13) << _message . c_str() << _count; if ( _count > _firstCount ) std::cout << ", average time per count, sec: " << averageTimeSinceFirstTick; fflush(stdout); } else { std::cout << _message . c_str() << _count; if ( _count > _firstCount ) std::cout << ", average time per count, sec: " << averageTimeSinceFirstTick; std::cout << std::endl; } lastPrintTime = time( NULL ); } } lastTickTime = time( NULL ); }
unsigned long int RooGKCounter::getCount | ( | void | ) |
Definition at line 109 of file RooGKCounter.cc.
References _count.
Referenced by HcalLutManager::getCompressionLutXmlFromAsciiMaster(), HcalLutManager::getCompressionLutXmlFromCoder(), HcalQIEManager::getHfQieTable(), HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap(), HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap_new(), HcalLutManager::getLinearizationLutXmlFromCoder(), HcalLutManager::getLinearizationLutXmlFromCoderEmap(), HcalLutManager::getLutXmlFromAsciiMaster(), HcalQIEManager::getTableFromDb(), and HcalLutManager::getZdcLutXml().
{ return _count; }
void RooGKCounter::increment | ( | long int | _incr | ) |
void RooGKCounter::init | ( | void | ) | [private] |
Definition at line 50 of file RooGKCounter.cc.
References _count, _divider, _firstCount, _message, _newLine, firstCountEntry, firstTickTime, initTime, lastPrintTime, lastTickTime, NULL, printCount, and cond::rpcobgas::time.
Referenced by RooGKCounter().
{ _count = 0; _firstCount = 0; _divider = 1; printCount = false; firstCountEntry = true; _message = "processing entry #"; _newLine = true; initTime = time( NULL ); firstTickTime = 1; lastTickTime = 1; lastPrintTime = 1; }
void RooGKCounter::setCounter | ( | unsigned long int | theCount | ) |
void RooGKCounter::setDivider | ( | unsigned int | theDivider | ) |
void RooGKCounter::setMessage | ( | const char * | message | ) |
Definition at line 46 of file RooGKCounter.cc.
References _message, and python::rootplot::argparse::message.
void RooGKCounter::setNewLine | ( | bool | newLine | ) |
void RooGKCounter::setPrintCount | ( | bool | _printCount | ) |
unsigned long int RooGKCounter::_count [private] |
Definition at line 28 of file RooGKCounter.h.
Referenced by count(), getCount(), increment(), init(), RooGKCounter(), and setCounter().
unsigned int RooGKCounter::_divider [private] |
Definition at line 30 of file RooGKCounter.h.
Referenced by count(), init(), RooGKCounter(), and setDivider().
unsigned long int RooGKCounter::_firstCount [private] |
Definition at line 29 of file RooGKCounter.h.
Referenced by count(), init(), and RooGKCounter().
std::string RooGKCounter::_message [private] |
Definition at line 33 of file RooGKCounter.h.
Referenced by count(), init(), RooGKCounter(), and setMessage().
bool RooGKCounter::_newLine [private] |
Definition at line 34 of file RooGKCounter.h.
Referenced by count(), init(), and setNewLine().
bool RooGKCounter::firstCountEntry [private] |
Definition at line 32 of file RooGKCounter.h.
time_t RooGKCounter::firstTickTime [private] |
Definition at line 36 of file RooGKCounter.h.
time_t RooGKCounter::initTime [private] |
Definition at line 36 of file RooGKCounter.h.
Referenced by init().
time_t RooGKCounter::lastPrintTime [private] |
Definition at line 36 of file RooGKCounter.h.
time_t RooGKCounter::lastTickTime [private] |
Definition at line 36 of file RooGKCounter.h.
bool RooGKCounter::printCount [private] |
Definition at line 31 of file RooGKCounter.h.
Referenced by count(), init(), RooGKCounter(), and setPrintCount().