|
Gaudi Framework, version v23r0 |
| Home | Generated: Mon Jan 30 2012 |
00001 // ChronoAuditor: 00002 // An auditor that monitors time 00003 00004 #ifdef __ICC 00005 // disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C" 00006 // TODO: there is only a partial overload of IAuditor::before and IAuditor::after 00007 #pragma warning(disable:654) 00008 #endif 00009 00010 #include "ChronoAuditor.h" 00011 #include "GaudiKernel/AudFactory.h" 00012 00013 DECLARE_AUDITOR_FACTORY(ChronoAuditor) 00014 00015 ChronoAuditor::ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator) 00016 : CommonAuditor(name, pSvcLocator) { 00017 } 00018 00019 ChronoAuditor::~ChronoAuditor() {} 00020 00021 StatusCode ChronoAuditor::initialize() { 00022 StatusCode sc = CommonAuditor::initialize(); 00023 if (UNLIKELY(sc.isFailure())) return sc; 00024 00025 m_chronoSvc = serviceLocator()->service("ChronoStatSvc"); 00026 if (UNLIKELY(!m_chronoSvc.get())) { 00027 MsgStream log(msgSvc(), name()); 00028 log << MSG::ERROR << "Cannot get ChronoStatSvc" << endmsg; 00029 return StatusCode::FAILURE; 00030 } 00031 return StatusCode::SUCCESS; 00032 } 00033 00034 void ChronoAuditor::i_before(CustomEventTypeRef evt, const std::string& caller) 00035 { 00036 chronoSvc()->chronoStart(i_id(evt, caller)); 00037 } 00038 00039 void ChronoAuditor::i_after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) 00040 { 00041 chronoSvc()->chronoStop(i_id(evt, caller)); 00042 }