| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

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