| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# ChronoAuditor.cpp

Go to the documentation of this file.

    00001 // ChronoAuditor:
    00002 //  An auditor that monitors memory usage
    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/MsgStream.h"
    00012 #include "GaudiKernel/AudFactory.h"
    00013 #include "GaudiKernel/IChronoStatSvc.h"
    00014 #include "GaudiKernel/Chrono.h"
    00015
    00016 DECLARE_AUDITOR_FACTORY(ChronoAuditor)
    00017
    00018 ChronoAuditor::ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator)
    00019 : Auditor(name, pSvcLocator) {
    00020   service( "ChronoStatSvc", m_chronoSvc, true).ignore();
    00021   declareProperty("CustomEventTypes",m_types);
    00022 }
    00023
    00024 ChronoAuditor::~ChronoAuditor(){
    00025   m_chronoSvc->release();
    00026 }
    00027
    00028 void ChronoAuditor::beforeInitialize(INamedInterface* alg) {
    00029   chronoSvc( )->chronoStart( alg->name() + ":initialize" ) ;
    00030 }
    00031 void ChronoAuditor:: afterInitialize(INamedInterface* alg){
    00032   chronoSvc( )->chronoStop( alg->name() + ":initialize" ) ;
    00033 }
    00034
    00035 void ChronoAuditor::beforeReinitialize(INamedInterface* alg) {
    00036   chronoSvc( )->chronoStart( alg->name() + ":reinitialize" ) ;
    00037 }
    00038 void ChronoAuditor:: afterReinitialize(INamedInterface* alg){
    00039   chronoSvc( )->chronoStop( alg->name() + ":reinitialize" ) ;
    00040 }
    00041
    00042 void ChronoAuditor:: beforeExecute(INamedInterface* alg){
    00043   chronoSvc( )->chronoStart( alg->name() + ":execute" ) ;
    00044 }
    00045 void ChronoAuditor:: afterExecute(INamedInterface* alg, const StatusCode& ) {
    00046   chronoSvc( )->chronoStop( alg->name() + ":execute" ) ;
    00047 }
    00048
    00049 void ChronoAuditor::beforeBeginRun(INamedInterface* alg) {
    00050   chronoSvc( )->chronoStart( alg->name() + ":beginRun" ) ;
    00051 }
    00052 void ChronoAuditor:: afterBeginRun(INamedInterface* alg){
    00053   chronoSvc( )->chronoStop( alg->name() + ":beginRun" ) ;
    00054 }
    00055 void ChronoAuditor::beforeEndRun(INamedInterface* alg) {
    00056   chronoSvc( )->chronoStart( alg->name() + ":endRun" ) ;
    00057 }
    00058 void ChronoAuditor:: afterEndRun(INamedInterface* alg){
    00059   chronoSvc( )->chronoStop( alg->name() + ":endRun" ) ;
    00060 }
    00061
    00062
    00063 void ChronoAuditor:: beforeFinalize(INamedInterface* alg) {
    00064   chronoSvc( )->chronoStart( alg->name() + ":finalize" ) ;
    00065 }
    00066 void ChronoAuditor:: afterFinalize(INamedInterface* alg){
    00067   chronoSvc( )->chronoStop( alg->name() + ":finalize" ) ;
    00068 }
    00069
    00070 void
    00071 ChronoAuditor::before(CustomEventTypeRef evt, const std::string& caller) {
    00072
    00073   if (m_types.value().size() != 0) {
    00074     if ( (m_types.value())[0] == "none") {
    00075       return;
    00076     }
    00077
    00078     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00079          m_types.value().end() ) {
    00080       return;
    00081     }
    00082   }
    00083
    00084   chronoSvc( )->chronoStart( caller + ":" + evt ) ;
    00085
    00086 }
    00087
    00088 void
    00089 ChronoAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
    00090
    00091   if (m_types.value().size() != 0) {
    00092     if ( (m_types.value())[0] == "none") {
    00093       return;
    00094     }
    00095
    00096     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00097          m_types.value().end() ) {
    00098       return;
    00099     }
    00100   }
    00101
    00102   chronoSvc( )->chronoStop( caller + ":" + evt ) ;
    00103
    00104 }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines