00001 // $Id: Chrono.h,v 1.6 2008/05/13 12:36:54 marcocle Exp $ 00002 // ============================================================================ 00003 #ifndef GAUDIKERNEL_CHRONO_H 00004 #define GAUDIKERNEL_CHRONO_H 00005 // ============================================================================ 00006 // Include files 00007 // ============================================================================ 00008 // STD& STL 00009 // ============================================================================ 00010 #include <string> 00011 // ============================================================================ 00012 // GaudiKernel 00013 // ============================================================================ 00014 #include "GaudiKernel/Kernel.h" 00015 #include "GaudiKernel/IChronoSvc.h" 00016 #include "GaudiKernel/ChronoEntity.h" 00017 // ============================================================================ 00027 class Chrono 00028 { 00029 public: 00030 // ========================================================================= 00052 Chrono 00053 ( IChronoSvc* svc = 0 , // the service 00054 const std::string& tag = "CHRONO::UNNAMED" ) // the unique tag/name 00055 : m_chrono ( 0 ) 00056 { if ( 0 != svc ) { m_chrono = svc -> chronoStart ( tag ) ; } } 00057 // ========================================================================= 00079 Chrono 00080 ( const std::string& tag , // the unique tag/name 00081 IChronoSvc* svc ) // the service 00082 : m_chrono ( 0 ) 00083 { if ( 0 != svc ) { m_chrono = svc -> chronoStart ( tag ) ; } } 00084 // ========================================================================= 00105 Chrono ( ChronoEntity* c ) : m_chrono ( c ) 00106 { if ( 0 != m_chrono ) { m_chrono -> start () ; } } 00107 // ========================================================================= 00128 Chrono ( ChronoEntity& c ) : m_chrono ( &c ) { m_chrono -> start () ; } 00129 // ========================================================================= 00131 ~Chrono () { if ( 0 != m_chrono ) { m_chrono->stop() ; } } 00132 // ========================================================================= 00133 private: 00134 // ========================================================================= 00136 Chrono ( const Chrono& ) ; // no copy constructor 00138 Chrono& operator=( const Chrono& ) ; // no assignement 00139 // ========================================================================= 00140 private: 00141 // ========================================================================== 00143 ChronoEntity* m_chrono; // The actual chronometer 00144 // ========================================================================== 00145 }; 00146 // ============================================================================ 00147 // The END 00148 // ============================================================================ 00149 #endif // GAUDIKERNEL_CHRONO_H 00150 // ============================================================================ 00151 00152