/////////////////////////////////////////////////////////////////////// // $Id: IDbiTimerManager.cxx,v 1.1 2011/01/18 05:49:20 finch Exp $ // // COMET::IDbiTimerManager // // Package: COMET::IDbi (Database Interface). // // N. West 01/2002 // // Concept: Manager of a set of simple timers. // // Purpose: To find out why this is all soooo sssllloooowwww! // /////////////////////////////////////////////////////////////////////// #include "IDbiTimer.hxx" #include "IDbiTimerManager.hxx" #include #include #include using std::endl; ClassImp(COMET::IDbiTimerManager) // Definition of static data members // ********************************* COMET::IDbiTimerManager COMET::IDbiTimerManager::gTimerManager; // Definition of member functions (alphabetical order) // *************************************************** //..................................................................... COMET::IDbiTimerManager::IDbiTimerManager() : fEnabled(kTRUE) { // // // Purpose: Default constructor // // Contact: N. West // COMETTrace( "Creating COMET::IDbiTimerManager" << " "); } //..................................................................... COMET::IDbiTimerManager::~IDbiTimerManager() { // // // Purpose: Destructor // // Contact: N. West // COMETTrace( "Destroying COMET::IDbiTimerManager" << " "); while ( this->GetCurrent() ) this->Pop(); } //..................................................................... COMET::IDbiTimer* COMET::IDbiTimerManager::GetCurrent() { // // // Purpose: Get the current timer if any. // // Return: Curent timer or null if none. // // Contact: N. West return fTimers.empty() ? 0 : *(fTimers.begin()); } //..................................................................... COMET::IDbiTimer* COMET::IDbiTimerManager::Pop() { // // // Purpose: Remove the most recent timer, and resume the previous. // // Return: Previous timer (if any). // if ( fTimers.empty() ) return 0; COMET::IDbiTimer* timer = this->GetCurrent(); delete timer; timer = 0; fTimers.pop_front(); timer = this->GetCurrent(); if ( timer ) timer->Resume(); return timer; } //..................................................................... COMET::IDbiTimer* COMET::IDbiTimerManager::Push() { // // // Purpose: Suspend current time and add new timer to stack. // // Return: New timer. // COMET::IDbiTimer* timer = this->GetCurrent(); if ( timer ) timer->Suspend(); fTimers.push_front(new COMET::IDbiTimer); return this->GetCurrent(); } //..................................................................... void COMET::IDbiTimerManager::RecBegin(string tableName, UInt_t rowSize) { // // // Purpose: Record the start of initial query on supplied table. // // Arguments: // tableName in Name of table. // rowSize in Size of row object // // Contact: N. West // Suspend current timer, if any, and start a new one. if ( ! fEnabled ) return; COMET::IDbiTimer* timer = this->Push(); timer->RecBegin(tableName, rowSize); } //..................................................................... void COMET::IDbiTimerManager::RecEnd(UInt_t numRows) { // // // Purpose: Record the end of query. // // Arguments: // numRows in Number of rows found in query // // Contact: N. West if ( ! fEnabled ) return; // Terminate the current timer and resume the previous one. COMET::IDbiTimer* timer = this->GetCurrent(); if ( timer ) timer->RecEnd(numRows); timer = this->Pop(); } //..................................................................... void COMET::IDbiTimerManager::RecFillAgg(Int_t /* aggNo */) { // // // Purpose: Record filling of aggregate. // // Arguments: // aggNo in Aggregate number. // // Contact: N. West if ( ! fEnabled ) return; // Currently a no-op. } //..................................................................... void COMET::IDbiTimerManager::RecMainQuery() { // // // Purpose: Record the start of main query. // // Contact: N. West if ( ! fEnabled ) return; COMET::IDbiTimer* timer = this->GetCurrent(); if ( timer ) timer->RecMainQuery(); } //..................................................................... void COMET::IDbiTimerManager::StartSubWatch(UInt_t subWatch) { // // // Purpose: Start specified SubWatch if SubWatch timers enabled. // // Arguments: // subWatch in SubWatch number ( 0 .. kMaxSubWatch-1 ). // // Contact: N. West if ( ! fEnabled ) return; COMET::IDbiTimer* timer = this->GetCurrent(); if ( timer ) timer->StartSubWatch(subWatch); } /* Template for New Member Function //..................................................................... COMET::IDbiTimerManager:: { // // // Purpose: // // Arguments: // xxxxxxxxx in yyyyyy // // Return: // // Contact: N. West // // Specification:- // ============= // // o // Program Notes:- // ============= // None. } */