| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

AlgErrorAuditor Class Reference

Monitors the cpu time usage of each algorithm. More...

#include <AlgErrorAuditor.h>

Inheritance diagram for AlgErrorAuditor:

[legend]
Collaboration diagram for AlgErrorAuditor:
[legend]
List of all members.

Public Types

typedef std::string CustomEventType
typedef const CustomEventTypeCustomEventTypeRef
 Initialize
 ReInitialize
 Execute
 BeginRun
 EndRun
 Finalize
 Start
 Stop
 ReStart
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  StandardEventType
enum  Status

Public Member Functions

 AlgErrorAuditor (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~AlgErrorAuditor ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual void beforeExecute (INamedInterface *alg)
virtual void afterExecute (INamedInterface *alg, const StatusCode &)
StatusCode sysInitialize ()
StatusCode sysFinalize ()
virtual void before (StandardEventType, INamedInterface *)
virtual void before (StandardEventType, const std::string &)
virtual void before (CustomEventTypeRef, INamedInterface *)
virtual void before (CustomEventTypeRef, const std::string &)
virtual void before (StandardEventType, INamedInterface *)=0
virtual void before (StandardEventType, const std::string &)=0
virtual void before (CustomEventTypeRef, INamedInterface *)=0
virtual void before (CustomEventTypeRef, const std::string &)=0
virtual void before (StandardEventType, INamedInterface *)=0
virtual void before (StandardEventType, const std::string &)=0
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
virtual void after (StandardEventType, const std::string &, const StatusCode &)
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
virtual void after (StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (StandardEventType, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void after (StandardEventType, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
virtual void beforeInitialize (INamedInterface *)
virtual void afterInitialize (INamedInterface *)
virtual void beforeReinitialize (INamedInterface *)
virtual void afterReinitialize (INamedInterface *)
virtual void beforeFinalize (INamedInterface *)
virtual void afterFinalize (INamedInterface *)
virtual void beforeBeginRun (INamedInterface *)
virtual void afterBeginRun (INamedInterface *)
virtual void beforeEndRun (INamedInterface *)
virtual void afterEndRun (INamedInterface *)
virtual const std::string & name () const
virtual bool isEnabled () const
IMessageSvcmsgSvc () const
int outputLevel () const
void setOutputLevel (int level)
ISvcLocatorserviceLocator () const
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
const std::vector< Property * > & getProperties () const
StatusCode setProperties ()
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
unsigned long addRef ()
unsigned long release ()
StatusCode queryInterface (const InterfaceID &riid, void **)

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 Initialize
 ReInitialize
 Execute
 BeginRun
 EndRun
 Finalize
 Start
 Stop
 ReStart
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Private Member Functions

void incrMap (const std::string &algName, int level)

Private Attributes

BooleanProperty m_abort
BooleanProperty m_throw
int m_error
int m_fatal
std::map< std::string, int > m_algMap [2]

Detailed Description

Monitors the cpu time usage of each algorithm.

Author:
David Quarrie

Definition at line 16 of file AlgErrorAuditor.h.


Constructor & Destructor Documentation

AlgErrorAuditor::AlgErrorAuditor ( const std::string &  name,
ISvcLocator pSvcLocator 
)

Definition at line 14 of file AlgErrorAuditor.cpp.

00015   : Auditor(name, pSvcLocator), m_error(0), m_fatal(0) {
00016 
00017   declareProperty( "Abort", m_abort = false, 
00018                    "Abort job upon illegal Algorithm return code");
00019   declareProperty( "Throw", m_throw = false, 
00020                    "Throw GaudiException upon illegal Algorithm return code");
00021 }

AlgErrorAuditor::~AlgErrorAuditor (  )  [virtual]

Definition at line 23 of file AlgErrorAuditor.cpp.

00023                                  {
00024 }


Member Function Documentation

StatusCode AlgErrorAuditor::initialize (  )  [virtual]

Reimplemented from Auditor.

Definition at line 34 of file AlgErrorAuditor.cpp.

00034                              {
00035 
00036   if (m_abort && m_throw) {
00037     MsgStream log(msgSvc(), name());
00038     log << MSG::INFO << "Both \"Throw\" and \"Abort\" options have been set."
00039         << " Abort takes precedence." << endreq;
00040   }
00041 
00042   return StatusCode::SUCCESS;
00043 }

StatusCode AlgErrorAuditor::finalize (  )  [virtual]

Reimplemented from Auditor.

Definition at line 93 of file AlgErrorAuditor.cpp.

00093                           {
00094 
00095 
00096   std::map<std::string,int>::const_iterator itr;
00097   if (m_algMap[0].size() != 0) {
00098     MsgStream log(msgSvc(), name()); 
00099     log << MSG::INFO << "Found " << m_algMap[0].size()
00100         << " instances where an Algorithm::execute() produced an ERROR "
00101         << "but returned a SUCCESS:" << std::endl;
00102 
00103     for (itr = m_algMap[0].begin(); itr != m_algMap[0].end(); ++itr) {
00104       log << itr->first << ": " << itr->second << std::endl;
00105     }
00106     
00107     log << endreq;
00108   }
00109 
00110   if (m_algMap[1].size() != 0) {
00111     MsgStream log(msgSvc(), name()); 
00112     log << MSG::INFO << "Found " << m_algMap[1].size()
00113         << " instances where an Algorithm::execute() produced a FATAL "
00114         << "but returned a SUCCESS:" << std::endl;
00115 
00116     for (itr = m_algMap[1].begin(); itr != m_algMap[1].end(); ++itr) {
00117       log << itr->first << ": " << itr->second << std::endl;
00118     }
00119     
00120     log << endreq;
00121   }
00122 
00123 
00124   return StatusCode::SUCCESS;
00125 
00126 }

void AlgErrorAuditor::beforeExecute ( INamedInterface alg  )  [virtual]

Reimplemented from Auditor.

Definition at line 28 of file AlgErrorAuditor.cpp.

00028                                                 {
00029   m_error = msgSvc()->messageCount(MSG::ERROR);
00030   m_fatal = msgSvc()->messageCount(MSG::FATAL);
00031 }

void AlgErrorAuditor::afterExecute ( INamedInterface alg,
const StatusCode  
) [virtual]

Reimplemented from Auditor.

Definition at line 47 of file AlgErrorAuditor.cpp.

00047                                                                          {
00048 
00049   bool fail(false);
00050   if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) {
00051     std::ostringstream os;
00052     os << "Illegal Return Code: Algorithm " << alg->name()
00053        << " reported an ERROR, but returned a StatusCode \"" << sc << "\"";
00054     os << std::endl << "Error policy described in "
00055          << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
00056 
00057     MsgStream log(msgSvc(), name()); 
00058     log << MSG::ERROR << os.str() << endreq;
00059     incrMap(alg->name(), 0);
00060     fail = true;
00061 
00062     if (m_throw && ! m_abort) {
00063       throw GaudiException(os.str(),"AlgErrorAuditor",0);
00064     }
00065   }
00066 
00067   if (msgSvc()->messageCount(MSG::FATAL) != m_fatal && 
00068       sc != StatusCode::FAILURE ) {
00069     std::ostringstream os;
00070     os << "Illegal Return Code: Algorithm " << alg->name()
00071        << " reported a FATAL, but returned a StatusCode \"" << sc << "\"";
00072     os << std::endl << "Error policy described in "
00073          << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
00074 
00075     MsgStream log(msgSvc(), name()); 
00076     log << MSG::ERROR << os.str() << endreq;
00077     incrMap(alg->name(), 1);
00078     fail = true;
00079 
00080     if (m_throw && ! m_abort) {
00081       throw GaudiException(os.str(),"AlgErrorAuditor",0);
00082     }
00083 
00084   }
00085 
00086   if (fail && m_abort) {
00087     abort();
00088   }
00089 
00090 }

void AlgErrorAuditor::incrMap ( const std::string &  algName,
int  level 
) [private]

Definition at line 129 of file AlgErrorAuditor.cpp.

00129                                                         {
00130   std::map<std::string, int>::iterator itr;
00131   if ( (itr=m_algMap[level].find(alg)) != m_algMap[level].end()) {
00132     itr->second++;
00133   } else {
00134     m_algMap[level].insert( std::pair<std::string,int>(alg,1) );
00135   }
00136 }


Member Data Documentation

BooleanProperty AlgErrorAuditor::m_abort [private]

Definition at line 28 of file AlgErrorAuditor.h.

BooleanProperty AlgErrorAuditor::m_throw [private]

Definition at line 28 of file AlgErrorAuditor.h.

int AlgErrorAuditor::m_error [private]

Definition at line 32 of file AlgErrorAuditor.h.

int AlgErrorAuditor::m_fatal [private]

Definition at line 33 of file AlgErrorAuditor.h.

std::map<std::string, int> AlgErrorAuditor::m_algMap[2] [private]

Definition at line 35 of file AlgErrorAuditor.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:59:13 2011 for GaudiAud by doxygen 1.4.7