00001 // $Id: TDbiTimer.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $ 00002 00003 #ifndef DBITIMER 00004 #define DBITIMER 00005 00006 //////////////////////////////////////////////////////////////////////// 00007 /// \class TDbiTimer 00008 /// 00009 /// 00010 /// \brief <b> Concept: </b> Simple timer, record query progress and final times. 00011 /// 00012 /// <b> Purpose: </b> To find out why this is all soooo sssllloooowwww! 00013 /// 00014 //////////////////////////////////////////////////////////////////////// 00015 00016 #include <string> 00017 00018 #include "TStopwatch.h" 00019 #include "TDbiFieldType.hxx" 00020 00021 00022 class TDbiTableMetaData; 00023 00024 class TDbiTimer 00025 { 00026 00027 public: 00028 00029 // Constructors and destructors. 00030 TDbiTimer(); 00031 virtual ~TDbiTimer(); 00032 00033 // State testing member functions 00034 00035 // State changing member functions 00036 void RecBegin(string tableName, UInt_t rowSize); 00037 void RecEnd(UInt_t numRows); 00038 void RecFillAgg(Int_t aggNo); 00039 void RecMainQuery(); 00040 void Resume(); 00041 void StartSubWatch(UInt_t subWatch); 00042 void Suspend(); 00043 00044 // Global timer used for all queries to the DBI. 00045 00046 private: 00047 00048 enum QueryStage { kPassive, kInitialQuery, kMainQuery }; 00049 enum { kMaxSubWatch = 4 }; // Must be > 0. 00050 00051 // Data members 00052 00053 Int_t fCurSubWatch; // Current SubWatch or -1 if disabled. 00054 UInt_t fRowSize; // Size of row object 00055 QueryStage fQueryStage; // Query stage 00056 TStopwatch fSubWatches[kMaxSubWatch]; // Partial timers 00057 string fTableName; // Current table 00058 TStopwatch fWatch; // Timer 00059 00060 ClassDef(TDbiTimer,0) // Simple query timer 00061 00062 }; 00063 00064 00065 00066 #endif // DBITIMER 00067 00068