DbiTimer Class Reference

#include <DbiTimer.h>

List of all members.

Public Member Functions

 DbiTimer ()
virtual ~DbiTimer ()
void RecBegin (string tableName, UInt_t rowSize)
void RecEnd (UInt_t numRows)
void RecFillAgg (Int_t aggNo)
void RecMainQuery ()
void Resume ()
void StartSubWatch (UInt_t subWatch)
void Suspend ()

Private Types

enum  QueryStage { kPassive, kInitialQuery, kMainQuery }
enum  { kMaxSubWatch = 4 }

Private Attributes

Int_t fCurSubWatch
UInt_t fRowSize
QueryStage fQueryStage
TStopwatch fSubWatches [kMaxSubWatch]
string fTableName
TStopwatch fWatch

Detailed Description

Definition at line 26 of file DbiTimer.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kMaxSubWatch 

Definition at line 51 of file DbiTimer.h.

00051 { kMaxSubWatch = 4 };  // Must be > 0.

enum DbiTimer::QueryStage [private]
Enumerator:
kPassive 
kInitialQuery 
kMainQuery 

Definition at line 50 of file DbiTimer.h.


Constructor & Destructor Documentation

DbiTimer::DbiTimer (  ) 

Definition at line 34 of file DbiTimer.cxx.

References Msg::kVerbose, LEA_CTOR, and MSG.

00034                    :
00035 fCurSubWatch(0),
00036 fRowSize(0),
00037 fQueryStage(kPassive)
00038 {
00039 //
00040 //
00041 //  Purpose:  Default constructor
00042 //
00043 //  Contact:   N. West
00044 //
00045 
00046   LEA_CTOR    //Leak Checker
00047 
00048   MSG("Dbi", Msg::kVerbose) << "Creating DbiTimer" << endl;
00049 
00050   fWatch.Stop();
00051   for ( int subWatch = 0; subWatch <  kMaxSubWatch; ++subWatch) {
00052     fSubWatches[subWatch].Stop();
00053   }
00054 
00055 }

DbiTimer::~DbiTimer (  )  [virtual]

Definition at line 60 of file DbiTimer.cxx.

References Msg::kVerbose, LEA_DTOR, and MSG.

00060                     {
00061 //
00062 //
00063 //  Purpose: Destructor
00064 //
00065 //  Contact:   N. West
00066 //
00067 
00068   LEA_DTOR    //Leak Checker
00069 
00070   MSG("Dbi", Msg::kVerbose) << "Destroying DbiTimer" << endl;
00071 
00072 }


Member Function Documentation

void DbiTimer::RecBegin ( string  tableName,
UInt_t  rowSize 
)

Definition at line 76 of file DbiTimer.cxx.

References fCurSubWatch, fQueryStage, fRowSize, fSubWatches, fTableName, fWatch, kInitialQuery, kMaxSubWatch, and StartSubWatch().

Referenced by DbiTimerManager::RecBegin().

00076                                                         {
00077 //
00078 //
00079 //  Purpose:  Record the start of initial query on supplied table.
00080 //
00081 //  Arguments: 
00082 //    tableName    in    Name of table.
00083 //    rowSize      in    Size of row object
00084 //
00085 //  Contact:   N. West
00086 
00087   fQueryStage = kInitialQuery;
00088   fTableName = tableName;
00089   fRowSize = rowSize;
00090   fWatch.Start();
00091   for ( int subWatch = 0; subWatch <  kMaxSubWatch; ++subWatch) {
00092     // Use Start to reset the counter (Reset doesn't do this).
00093     fSubWatches[subWatch].Start();
00094     fSubWatches[subWatch].Stop();
00095   }
00096   if ( fCurSubWatch >= 0 ) this->StartSubWatch(0);
00097   
00098 }

void DbiTimer::RecEnd ( UInt_t  numRows  ) 

Definition at line 101 of file DbiTimer.cxx.

References fCurSubWatch, fQueryStage, fRowSize, fSubWatches, fTableName, fWatch, Msg::kInfo, kMainQuery, kMaxSubWatch, kPassive, and MSG.

Referenced by DbiTimerManager::RecEnd().

00101                                     {
00102 //
00103 //
00104 //  Purpose:  Record the end of query.
00105 //
00106 //  Arguments: 
00107 //    numRows    in    Number of rows found in query
00108 //
00109 //  Contact:   N. West
00110 //
00111 //  Specification:-
00112 //  =============
00113 //
00114 //  o Record the end of query.  If query never reached the Main Query
00115 //    phase then quit as query must have been satisfied
00116 //    by the cache.
00117 //
00118 // o  If SubWatches enabled print them out if the main timer has 
00119 //    recorded significant activity.
00120 
00121 //  None.
00122 
00123   if ( fQueryStage != kMainQuery ) return;
00124 
00125   Float_t tableSize = numRows * fRowSize/1.0e+3;
00126   string units = "Kb";
00127   if ( tableSize > 1000. ) {
00128     tableSize /= 1000.;
00129     units = "Mb";
00130   }
00131   MsgFormat ffmt("%6.1f");
00132   
00133   MSG("Dbi",Msg::kInfo) << "DbiTimer:" <<  fTableName
00134                         << ": Query done. "  << numRows
00135                         << "rows, " << ffmt(tableSize) << units
00136                         << " Cpu" << ffmt(fWatch.CpuTime())
00137                         << " , elapse" << ffmt(fWatch.RealTime()) 
00138                         << endl;
00139 
00140   fWatch.Stop();
00141   fQueryStage = kPassive;
00142 
00143   if ( fCurSubWatch >= 0 && fWatch.RealTime() > 5. ) {
00144     for ( int subWatch = 0; subWatch <  kMaxSubWatch; ++subWatch) {
00145     static const Char_t* subWatchNames[kMaxSubWatch] 
00146       = { "Query database     ",
00147           "Create row objects ",
00148           "Retrieve TSQL rows ",
00149           "Fill row objects   "};
00150        MSG("Dbi",Msg::kInfo) 
00151             << "      SubWatch " <<  subWatchNames[subWatch]
00152             << ": Cpu" << ffmt(fSubWatches[subWatch].CpuTime())
00153             << " , elapse" << ffmt(fSubWatches[subWatch].RealTime())
00154             << " , Starts " << fSubWatches[subWatch].Counter()
00155             << endl; 
00156     }
00157   }
00158 }

void DbiTimer::RecFillAgg ( Int_t  aggNo  ) 

Definition at line 173 of file DbiTimer.cxx.

00173                                            {
00174 //
00175 //
00176 //  Purpose:  Record filling of aggregate.
00177 //
00178 //  Arguments: 
00179 //    aggNo        in    Aggregate number.
00180 //
00181 //  Contact:   N. West
00182 
00183 }

void DbiTimer::RecMainQuery (  ) 

Definition at line 161 of file DbiTimer.cxx.

References fQueryStage, and kMainQuery.

Referenced by DbiTimerManager::RecMainQuery().

00161                             {
00162 //
00163 //
00164 //  Purpose:  Record the start of main query.
00165 //
00166 //  Contact:   N. West
00167 
00168   fQueryStage = kMainQuery;
00169 
00170 }

void DbiTimer::Resume (  ) 

Definition at line 185 of file DbiTimer.cxx.

References fCurSubWatch, fSubWatches, and fWatch.

Referenced by DbiTimerManager::Pop().

00185                       {
00186 //
00187 //
00188 //  Purpose:  Resume timer and any partial timer.
00189 //
00190 //  Contact:   N. West
00191 
00192   if ( fCurSubWatch >= 0 ) fSubWatches[fCurSubWatch].Start(kFALSE);
00193   fWatch.Start(kFALSE);
00194 }

void DbiTimer::StartSubWatch ( UInt_t  subWatch  ) 

Definition at line 198 of file DbiTimer.cxx.

References fCurSubWatch, fSubWatches, and kMaxSubWatch.

Referenced by RecBegin(), and DbiTimerManager::StartSubWatch().

00198                                             {
00199 //
00200 //
00201 //  Purpose:  Start specified SubWatch if SubWatch timers enabled.
00202 //
00203 //  Arguments: 
00204 //    subWatch     in    SubWatch number ( 0 .. kMaxSubWatch-1 ).
00205 //
00206 //  Contact:   N. West
00207 
00208   if (     fCurSubWatch < 0 
00209         || subWatch >= kMaxSubWatch ) return;
00210 
00211   fSubWatches[fCurSubWatch].Stop();
00212   fCurSubWatch = subWatch;
00213   fSubWatches[fCurSubWatch].Start(kFALSE);
00214 
00215 }

void DbiTimer::Suspend (  ) 

Definition at line 217 of file DbiTimer.cxx.

References fCurSubWatch, fSubWatches, and fWatch.

Referenced by DbiTimerManager::Push().

00217                        {
00218 //
00219 //
00220 //  Purpose:  Suspend timer and any partial timer.
00221 //
00222 //  Contact:   N. West
00223 
00224   if ( fCurSubWatch >= 0 ) fSubWatches[fCurSubWatch].Stop();
00225   fWatch.Stop();
00226 }


Member Data Documentation

Int_t DbiTimer::fCurSubWatch [private]

Definition at line 55 of file DbiTimer.h.

Referenced by RecBegin(), RecEnd(), Resume(), StartSubWatch(), and Suspend().

Definition at line 57 of file DbiTimer.h.

Referenced by RecBegin(), RecEnd(), and RecMainQuery().

UInt_t DbiTimer::fRowSize [private]

Definition at line 56 of file DbiTimer.h.

Referenced by RecBegin(), and RecEnd().

TStopwatch DbiTimer::fSubWatches[kMaxSubWatch] [private]

Definition at line 58 of file DbiTimer.h.

Referenced by RecBegin(), RecEnd(), Resume(), StartSubWatch(), and Suspend().

string DbiTimer::fTableName [private]

Definition at line 59 of file DbiTimer.h.

Referenced by RecBegin(), and RecEnd().

TStopwatch DbiTimer::fWatch [private]

Definition at line 60 of file DbiTimer.h.

Referenced by RecBegin(), RecEnd(), Resume(), and Suspend().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1