| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# ChronoAuditor.cpp

Go to the documentation of this file.

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