Commits

marc...@53ecefc3-a64d-0410-9bdf-b8581fa3287e  committed d81c835

Tagging Gaudi v21r10 (including Atlas tags)

  • Participants

Comments (0)

Files changed (17)

File cmt/requirements

+package GaudiAud
+version v9r3
+
+branches doc src cmt
+
+use GaudiKernel v*
+
+# component library
+library GaudiAud ../src/*.cpp -no_static
+apply_pattern component_library library=GaudiAud
+
+apply_pattern QMTest

File doc/release.notes

+Package: GaudiAud
+Package manager : David Quarrie, Marco Clemencic
+
+=============================== GaudiAud v9r3 ================================
+! 2010-04-20 - Marco Clemencic
+ - Removed ICC warnings and remarks.
+
+=============================== GaudiAud v9r2 ================================
+! 2010-01-28 - Marco Clemencic
+ - Fixed icc remark #424: extra ";" ignored
+
+================ GaudiAud v9r1 ====================================
+! 2009-07-30 - Marco Clemencic
+ - Fixed some doxygen warnings.
+
+! 2009-07-20 - Marco Clemencic
+ - Added '-no_static' to the declaration of the libraries (implemented since CMT
+   v1r20p20081118).
+
+================ GaudiAud v9r0 ====================================
+! 2009-04-07 - Marco Clemencic
+ - Moved back the namespace MSG to the global namespace.
+
+! 2009-04-06 - Marco Clemencic
+ - Renamed back the namespace Msg to MSG and moved it into the namespace Gaudi.
+ - Renamed back INamed to INamedInterface.
+
+! 2009-03-13 - Marco Clemencic
+ - Task #9061: Introduction of component managers
+   - Adapted to use the changes in the ISvcLocator, ISvcManager and IAlgManager
+     interfaces.
+
+! 2009-02-19 - Marco Clemencic
+ - Patch #2790: Rename the namespace MSG to Msg
+
+! 2009-01-30 - Marco Clemencic
+ - Replaced all the occurrences of endreq with endmsg. 
+
+! 2009-01-22 - Marco Clemencic
+ - Adapted to the new IInterface functionalities (see GaudiKernel release.notes)
+ - Renamed INamedInterface to INamed.
+
+================ GaudiAud v8r8 ====================================
+! 2008-12-16 - Frank Winklmeier
+ - Patch #2710: NameAuditor support of new FSM
+   Fully support new FSM to allow auditing of start/stop.
+
+================ GaudiAud v8r7 ====================================
+! 2008-11-10 - Charles Leggett
+ - Patch #2183. Link to Atlas error policy in AlgErrorAuditor
+
+! 2008-10-02 - Charles Leggett
+ - Patch #1939. Allow auditors to catch CustomEventTypes
+
+================ GaudiAud v8r6 ====================================
+! 2008-05-13 - Marco Clemencic
+ - Fixed compilation problem introduced with patch #1756.
+   Explicit include of IChronoStatSvc.h was needed in ChronoAuditor.cpp.
+
+================ GaudiAud v8r5 ====================================
+! 2007-03-11 - Charles Leggett
+ - Patch #1717. Audit memory at initialize time.
+   Uncommented the function to get the memory utilization after initialize (in
+   MemStatAuditor).
+
+================ GaudiAud v8r4 ====================================
+! 2007-11-13 - Charles Leggett
+ - bug #28570.
+   Modified AlgContextAuditor to avoid that it passes a null pointer to
+   AlgContextSvc. It happens if the AuditorSvc is auditing objects that inherit
+   from INamedInterface, but not from IAlgorithm (e.g. services).  
+
+! 2007-11-13 - Marco Clemencic
+ - Added a test to expose bug #28570.
+
+!==============v8r3==========================================================
+! 2007-08-06 - Vanya Belyaev
+ - patch #1231. Added explicit include IChronoStatSvc.h in MemStatAuditor.cpp
+   
+!==============v8r2==========================================================
+! 2007-05-24 - Vanya Belyaev
+ - patch #1171. The enhancement of existing Algorithm Context Service
+   is the primary goal of the proposed patch. The existing
+   AlgContextSvc is not safe with respect to e.g. Data-On-Demand
+   service or to operations with subalgorithms. The patched service
+   essentially implements the queue of executing algorithms, thus the
+   problems are eliminiated. In addition the enriched interface
+   provides the access to the whole queue of executing algorithms.
+
+! 2007-05-11 - Charles Leggett
+ - patch #1150. If the AlgErrAuditor detects that an illegal
+   StatusCode/MessageStream combination has been issued by an
+   Algorithm, an exception or an abort() can be thrown, configured by
+   a jobOpt. Also prints out summaries at the end of the job of
+   illegal combination.
+
+! 2007-04-27 - Sebatien Binet
+ - patch #25889. Fixed uninitialized private members of AlgErrorAuditor.
+
+!==============v8r1==========================================================
+! 2007-01-18 - Charles Leggett
+ patch #972. 
+ - add messageCount to IMessageSvc
+ - extend Auditor::(sys)afterExecute to pass a const StatusCode&,
+   which is the return code of the algorithm
+ - new auditor to monitor algorithms, issue message if algorithm
+   writes out an ERROR or FATAL, but returns SUCCESS
+	
+!==============v8r0==========================================================
+! 2007-01-12 - Hubert Degaudenzi
+ - bug #22799. changed the return value of chronoStart, chronoStop,
+   chronoPrint, stat and statPrint method of the IChronoStatSvc from
+   StatusCode to void.
+
+! 2006-12-13 - Charles Leggett
+ - instrumented auditors for reinitialize, beginRun, endRun
+
+! 2006-11-30 - Pere Mato
+  Adapted package to the new PluginSvc
+  - Removed protected from constructor/destructors and friendship of
+    Factory class
+
+!==============v7r2==========================================================
+! 2006-09-21 Hubert Degaudenzi
+ - use of the DECLARE macros for the auditor factories.
+
+! 2006-09-13 Charles Leggett and Hubert Degaudenzi
+ - added AlgContextAuditor (remove from GaudiSvc)
+
+!==============v7r1==========================================================
+! 2006-04-13 Charles Leggett and Hubert Degaudenzi
+ - inserted ATLAS feature INamedInterface.
+
+!==============v7r0==========================================================
+! 2006-03-15 - Hubert Degaudenzi
+ - replaced the returned StatusCode with void for before*/after*
+   methods of auditors. Interface changed.
+
+!==============v6r6==========================================================
+! 2006-01-27 - Pere Mato
+ - Use the compoment_library pattern
+
+!==============v6r5==========================================================
+! 2004-06-08 - Pere Mato
+- ProcStats.h(.cpp) Fixed [bugs #3667] bytes to Mbytes conversion in ProcStats.cpp
+
+!==============v6r4==========================================================
+! 2004-01-15 - Pere Mato
+- Added changes from ATLAS (Paolo et al.)
+
+
+!==============v6r3==========================================================
+! 2004-01-07 - David Rousseau
+- MemStatAuditor::printinfo: don't return when p->fetch(info) is false
+
+! 2003-11-06 - David Rousseau
+- radically change the philosophy of MemStatAuditor: MemStatAuditor
+    now accumulate the incremental change of memory usage during the job.
+  Only VSize is monitored (RSS is less reproducible).
+  This allows to spot in which algorithm memory leak happen
+
+! 2003-11-26 - Pere Mato
+ - Small changes for Mac OSX (Guy Barrand)
+!==============v6r2==========================================================
+! 2003-01-06 - Sebastien Ponce
+ - better support for gcc 3.2
+
+!==============v6r1==========================================================
+! 2002-09-24 - Pere Mato
+ - Changes to clean the reference counting and memory deallocation
+   detected by the "valgrind" tool. Changed failes: ChronoAuditor.cpp (.h)
+ - requirements: use v* 
+
+!==============v6r0p1=========================================================
+! 2002-09-23 - Flr
+ - requirements - use GaudiKernel v*
+
+!=============================================================================
+!20010508 - Pere Mato
+ - Using GaudiKernel v10
+
+!=============================================================================
+!20010206 - Pere Mato
+- New Auditor MemStatAuditor made by I. Belyaev added to the package
+
+
+!=============================================================================
+!20001025 - GaudiAud v1 -David Quarrie
+- This package contains concrete Auditors. An Auditor monitors some resource
+  on a per-Algorithm basis. It performs this monitoring by calls immediately
+  before and after the appropriate initialize, execute and finalize calls.
+
+  Initial implementations are:
+
+  NameAuditor   This is a diagnostic tool that just displays the name of
+                each Algorithm.
+
+  ChronoAuditor This displays at the end of job the total and per event
+                cpu time taken by each Algorithm.
+
+  MemoryAuditor This warns of possible memory leaks. However, Algorithms
+                that register objects with the transient event store will
+                cause this warning to be triggered. It is designed to
+                warn of memory leaks from Algorithms that retrieve objects
+                from the transient event store.
+
+

File src/AlgContextAuditor.cpp

+// $Id: AlgContextAuditor.cpp,v 1.4 2007/11/13 12:53:54 marcocle Exp $
+// ============================================================================
+// CVS tag $Name:  $, version $Revision: 1.4 $
+// ============================================================================
+// $Log: AlgContextAuditor.cpp,v $
+// Revision 1.4  2007/11/13 12:53:54  marcocle
+// Charles Leggett
+//  - bug #28570.
+//    Modified AlgContextAuditor to avoid that it passes a null pointer to
+//    AlgContextSvc. It happens if the AuditorSvc is auditing objects that inherit
+//    from INamedInterface, but not from IAlgorithm (e.g. services).
+//
+// Revision 1.3  2007/05/24 13:49:20  hmd
+// ( Vanya Belyaev) patch #1171. The enhancement of existing Algorithm Context Service
+//    is the primary goal of the proposed patch. The existing
+//    AlgContextSvc is not safe with respect to e.g. Data-On-Demand
+//    service or to operations with subalgorithms. The patched service
+//    essentially implements the queue of executing algorithms, thus the
+//    problems are eliminiated. In addition the enriched interface
+//    provides the access to the whole queue of executing algorithms.
+//
+// ============================================================================
+// Incldue files
+// ============================================================================
+// STD & STL
+// ============================================================================
+#include <cassert>
+// ============================================================================
+// GaudiKernel
+// ============================================================================
+#include "GaudiKernel/IAlgContextSvc.h"
+#include "GaudiKernel/IAlgorithm.h"
+#include "GaudiKernel/AudFactory.h"
+#include "GaudiKernel/SmartIF.h"
+#include "GaudiKernel/MsgStream.h"
+// ============================================================================
+// local
+// ============================================================================
+#include "AlgContextAuditor.h"
+// ============================================================================
+/** @file
+ *  Implementation file for class AlgContexAuditor
+ *  @author M. Shapiro, LBNL
+ *  @author modified by Vanya BELYAEV ibelyaev@physics.syr.edu
+ */
+// ============================================================================
+namespace
+{
+  /** make a safe cast using "smart interface"
+   *  @see  INamedInterface
+   *  @see  IAlgorithm
+   *  @see   SmartIF
+   *  @see   IInterface::queryInterface
+   *  @param  i pointer to INamedInterface
+   *  @return pointer to IAlgorithm
+   */
+  inline IAlgorithm* toAlg ( IInterface* ni )
+  {
+    if ( 0 == ni ) { return 0 ; }
+    SmartIF<IAlgorithm> alg ( ni ) ;
+    return alg ;
+  }
+}
+// ============================================================================
+// mandatory auditor fatcory, needed for instantiation
+// ============================================================================
+DECLARE_AUDITOR_FACTORY(AlgContextAuditor)
+// ============================================================================
+// standard constructor @see Auditor
+// ============================================================================
+AlgContextAuditor::AlgContextAuditor
+( const std::string& name ,
+  ISvcLocator*       pSvc )
+  : Auditor( name , pSvc )
+  , m_svc   ( 0    )
+{}
+// ============================================================================
+// destructor
+// ============================================================================
+AlgContextAuditor::~AlgContextAuditor() {}
+// ============================================================================
+// standard initialization, see @IAuditor
+// ============================================================================
+StatusCode AlgContextAuditor::initialize()
+{
+  // initialize the base class
+  StatusCode sc = Auditor::initialize() ;
+  if ( sc.isFailure() ) { return sc ; }                           // RETURN
+  if ( 0 != m_svc ) { m_svc -> release() ; m_svc = 0 ; }
+  sc = Auditor::service ( "AlgContextSvc" , m_svc , true ) ;
+  if ( sc.isFailure() )
+  {
+    MsgStream log ( msgSvc() , name() ) ;
+    log << MSG::ERROR << "Unable to locate 'AlgContextSvc'" << sc << endmsg ;
+    m_svc = 0 ;
+    return sc ;  // RETURN
+  }
+  if ( 0 == m_svc     )
+  {
+    MsgStream log ( msgSvc() , name() ) ;
+    log << MSG::ERROR << "Invalid pointer to IAlgContextSvc" << endmsg ;
+    return StatusCode::FAILURE ;           // RETURN
+  }
+  return StatusCode::SUCCESS ;
+}
+// ============================================================================
+// standard finalization, see @IAuditor
+// ============================================================================
+StatusCode AlgContextAuditor::finalize ()
+{
+  if ( 0 != m_svc ) { m_svc-> release() ; m_svc = 0 ; }
+  // finalize the base class
+  return Auditor::finalize () ;
+}
+// ============================================================================
+void AlgContextAuditor::beforeInitialize ( INamedInterface*  a ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+void AlgContextAuditor::afterInitialize  ( INamedInterface*  a ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+void AlgContextAuditor::beforeFinalize   ( INamedInterface*  a ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+void AlgContextAuditor::afterFinalize    ( INamedInterface*  a ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+void AlgContextAuditor::beforeExecute    ( INamedInterface*  a ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+void AlgContextAuditor::afterExecute     ( INamedInterface*  a       ,
+                                           const StatusCode& /* s */ ) {
+  if ( 0 != m_svc ) {
+    IAlgorithm* alg = toAlg(a);
+    if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
+  }
+}
+// ============================================================================
+
+// ============================================================================
+// The END
+// ============================================================================
+

File src/AlgContextAuditor.h

+// $Id: AlgContextAuditor.h,v 1.4 2007/05/24 13:49:20 hmd Exp $
+// ============================================================================
+// CVS tag $Name:  $, version $Revision: 1.4 $
+// ============================================================================
+// $Log: AlgContextAuditor.h,v $
+// Revision 1.4  2007/05/24 13:49:20  hmd
+// ( Vanya Belyaev) patch #1171. The enhancement of existing Algorithm Context Service
+//    is the primary goal of the proposed patch. The existing
+//    AlgContextSvc is not safe with respect to e.g. Data-On-Demand
+//    service or to operations with subalgorithms. The patched service
+//    essentially implements the queue of executing algorithms, thus the
+//    problems are eliminiated. In addition the enriched interface
+//    provides the access to the whole queue of executing algorithms.
+//
+// ============================================================================
+#ifndef GAUDIAUD_ALGCONTEXTAUDITOR_H
+#define GAUDIAUD_ALGCONTEXTAUDITOR_H
+// ============================================================================
+// Include files
+// ============================================================================
+// GaudiKernel
+// ============================================================================
+#include "GaudiKernel/Auditor.h"
+#include "GaudiKernel/IAlgorithm.h"
+#include "GaudiKernel/SmartIF.h"
+// ============================================================================
+// Forward declarations
+// ============================================================================
+class IAlgContextSvc  ;
+// ============================================================================
+/** @class AlgContextAuditor
+ *  Description:  Rergister/Unregister the AlgContext of each
+ *  algorithm before entering the algorithm and after leaving it
+ *  @author M. Shapiro, LBNL
+ *  @author modified by Vanya BELYAEV ibelyaev@physics.syr.edu
+ */
+class AlgContextAuditor
+  : public Auditor
+{
+public:
+  // IAuditor implementation
+  virtual void beforeInitialize ( INamedInterface*  a ) ;
+  virtual void afterInitialize  ( INamedInterface*  a ) ;
+  //
+  virtual void beforeExecute    ( INamedInterface*  a ) ;
+  virtual void afterExecute     ( INamedInterface*  a ,
+                                  const StatusCode& s ) ;
+  //
+  virtual void beforeFinalize   ( INamedInterface*  a ) ;
+  virtual void afterFinalize    ( INamedInterface*  a ) ;
+public:
+  /// standard constructor @see Auditor
+  AlgContextAuditor
+  ( const std::string& name ,
+    ISvcLocator*       pSvc ) ;
+  /// virtual desctrutor
+  virtual ~AlgContextAuditor    () ;
+  /// standard initialization, @see IAuditor
+  virtual StatusCode initialize () ;
+  /// standard finalization, @see IAuditor
+  virtual StatusCode finalize   () ;
+private:
+  // the default constructor is disabled
+  AlgContextAuditor () ; ///< no default constructor
+  // copy constructor is disabled
+  AlgContextAuditor ( const AlgContextAuditor& ) ; ///< no copy constructor
+  // assigenement operator is disabled
+  AlgContextAuditor& operator=( const AlgContextAuditor& ) ; ///< no assignement
+private:
+  // the pointer to Algorithm Context Service
+  IAlgContextSvc* m_svc ; ///< the pointer to Algorithm Context Service
+} ;
+
+// ============================================================================
+// The END
+// ============================================================================
+#endif // GAUDIAUD_ALGCONTEXTAUDITOR_H
+// ============================================================================

File src/AlgErrorAuditor.cpp

+// AlgErrorAuditor:
+//  An auditor that monitors memory usage
+
+#include "AlgErrorAuditor.h"
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/IMessageSvc.h"
+#include "GaudiKernel/AudFactory.h"
+#include "GaudiKernel/GaudiException.h"
+
+DECLARE_AUDITOR_FACTORY(AlgErrorAuditor)
+
+AlgErrorAuditor::AlgErrorAuditor(const std::string& name, ISvcLocator* pSvcLocator)
+  : Auditor(name, pSvcLocator), m_error(0), m_fatal(0) {
+
+  declareProperty( "Abort", m_abort = false,
+		   "Abort job upon illegal Algorithm return code");
+  declareProperty( "Throw", m_throw = false,
+		   "Throw GaudiException upon illegal Algorithm return code");
+}
+
+AlgErrorAuditor::~AlgErrorAuditor(){
+}
+
+
+void
+AlgErrorAuditor:: beforeExecute(INamedInterface* ){
+  m_error = msgSvc()->messageCount(MSG::ERROR);
+  m_fatal = msgSvc()->messageCount(MSG::FATAL);
+}
+
+StatusCode
+AlgErrorAuditor:: initialize() {
+
+  if (m_abort && m_throw) {
+    MsgStream log(msgSvc(), name());
+    log << MSG::INFO << "Both \"Throw\" and \"Abort\" options have been set."
+	<< " Abort takes precedence." << endmsg;
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+
+void
+AlgErrorAuditor:: afterExecute(INamedInterface* alg, const StatusCode& sc) {
+
+  bool fail(false);
+  if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) {
+    std::ostringstream os;
+    os << "Illegal Return Code: Algorithm " << alg->name()
+       << " reported an ERROR, but returned a StatusCode \"" << sc << "\"";
+    os << std::endl << "Error policy described in "
+	 << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
+
+    MsgStream log(msgSvc(), name());
+    log << MSG::ERROR << os.str() << endmsg;
+    incrMap(alg->name(), 0);
+    fail = true;
+
+    if (m_throw && ! m_abort) {
+      throw GaudiException(os.str(),"AlgErrorAuditor",0);
+    }
+  }
+
+  if (msgSvc()->messageCount(MSG::FATAL) != m_fatal &&
+      sc != StatusCode::FAILURE ) {
+    std::ostringstream os;
+    os << "Illegal Return Code: Algorithm " << alg->name()
+       << " reported a FATAL, but returned a StatusCode \"" << sc << "\"";
+    os << std::endl << "Error policy described in "
+	 << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors";
+
+    MsgStream log(msgSvc(), name());
+    log << MSG::ERROR << os.str() << endmsg;
+    incrMap(alg->name(), 1);
+    fail = true;
+
+    if (m_throw && ! m_abort) {
+      throw GaudiException(os.str(),"AlgErrorAuditor",0);
+    }
+
+  }
+
+  if (fail && m_abort) {
+    abort();
+  }
+
+}
+
+StatusCode
+AlgErrorAuditor::finalize() {
+
+
+  std::map<std::string,int>::const_iterator itr;
+  if (m_algMap[0].size() != 0) {
+    MsgStream log(msgSvc(), name());
+    log << MSG::INFO << "Found " << m_algMap[0].size()
+	<< " instances where an Algorithm::execute() produced an ERROR "
+	<< "but returned a SUCCESS:" << std::endl;
+
+    for (itr = m_algMap[0].begin(); itr != m_algMap[0].end(); ++itr) {
+      log << itr->first << ": " << itr->second << std::endl;
+    }
+
+    log << endmsg;
+  }
+
+  if (m_algMap[1].size() != 0) {
+    MsgStream log(msgSvc(), name());
+    log << MSG::INFO << "Found " << m_algMap[1].size()
+	<< " instances where an Algorithm::execute() produced a FATAL "
+	<< "but returned a SUCCESS:" << std::endl;
+
+    for (itr = m_algMap[1].begin(); itr != m_algMap[1].end(); ++itr) {
+      log << itr->first << ": " << itr->second << std::endl;
+    }
+
+    log << endmsg;
+  }
+
+
+  return StatusCode::SUCCESS;
+
+}
+
+void
+AlgErrorAuditor::incrMap(const std::string& alg, int level) {
+  std::map<std::string, int>::iterator itr;
+  if ( (itr=m_algMap[level].find(alg)) != m_algMap[level].end()) {
+    itr->second++;
+  } else {
+    m_algMap[level].insert( std::pair<std::string,int>(alg,1) );
+  }
+}
+

File src/AlgErrorAuditor.h

+#ifndef GAUDIAUD_ALGERRORAUDITOR_H
+#define GAUDIAUD_ALGERRORAUDITOR_H
+
+#include "GaudiKernel/Auditor.h"
+#include <map>
+#include <string>
+
+class IMessageSvc;
+
+/** @class AlgErrorAuditor
+    Monitors the cpu time usage of each algorithm
+
+    @author David Quarrie
+*/
+class AlgErrorAuditor : virtual public Auditor {
+public:
+  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&);
+private:
+
+  BooleanProperty m_abort, m_throw;
+
+  void incrMap(const std::string& algName, int level);
+
+  int m_error;
+  int m_fatal;
+
+  std::map <std::string, int> m_algMap[2];
+
+};
+
+#endif

File src/ChronoAuditor.cpp

+// ChronoAuditor:
+//  An auditor that monitors memory usage
+
+#ifdef __ICC
+// disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
+//   TODO: there is only a partial overload of IAuditor::before and IAuditor::after
+#pragma warning(disable:654)
+#endif
+
+#include "ChronoAuditor.h"
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/AudFactory.h"
+#include "GaudiKernel/IChronoStatSvc.h"
+#include "GaudiKernel/Chrono.h"
+
+DECLARE_AUDITOR_FACTORY(ChronoAuditor)
+
+ChronoAuditor::ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator)
+: Auditor(name, pSvcLocator) {
+  service( "ChronoStatSvc", m_chronoSvc, true).ignore();
+  declareProperty("CustomEventTypes",m_types);
+}
+
+ChronoAuditor::~ChronoAuditor(){
+  m_chronoSvc->release();
+}
+
+void ChronoAuditor::beforeInitialize(INamedInterface* alg) {
+  chronoSvc( )->chronoStart( alg->name() + ":initialize" ) ;
+}
+void ChronoAuditor:: afterInitialize(INamedInterface* alg){
+  chronoSvc( )->chronoStop( alg->name() + ":initialize" ) ;
+}
+
+void ChronoAuditor::beforeReinitialize(INamedInterface* alg) {
+  chronoSvc( )->chronoStart( alg->name() + ":reinitialize" ) ;
+}
+void ChronoAuditor:: afterReinitialize(INamedInterface* alg){
+  chronoSvc( )->chronoStop( alg->name() + ":reinitialize" ) ;
+}
+
+void ChronoAuditor:: beforeExecute(INamedInterface* alg){
+  chronoSvc( )->chronoStart( alg->name() + ":execute" ) ;
+}
+void ChronoAuditor:: afterExecute(INamedInterface* alg, const StatusCode& ) {
+  chronoSvc( )->chronoStop( alg->name() + ":execute" ) ;
+}
+
+void ChronoAuditor::beforeBeginRun(INamedInterface* alg) {
+  chronoSvc( )->chronoStart( alg->name() + ":beginRun" ) ;
+}
+void ChronoAuditor:: afterBeginRun(INamedInterface* alg){
+  chronoSvc( )->chronoStop( alg->name() + ":beginRun" ) ;
+}
+void ChronoAuditor::beforeEndRun(INamedInterface* alg) {
+  chronoSvc( )->chronoStart( alg->name() + ":endRun" ) ;
+}
+void ChronoAuditor:: afterEndRun(INamedInterface* alg){
+  chronoSvc( )->chronoStop( alg->name() + ":endRun" ) ;
+}
+
+
+void ChronoAuditor:: beforeFinalize(INamedInterface* alg) {
+  chronoSvc( )->chronoStart( alg->name() + ":finalize" ) ;
+}
+void ChronoAuditor:: afterFinalize(INamedInterface* alg){
+  chronoSvc( )->chronoStop( alg->name() + ":finalize" ) ;
+}
+
+void
+ChronoAuditor::before(CustomEventTypeRef evt, const std::string& caller) {
+
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  chronoSvc( )->chronoStart( caller + ":" + evt ) ;
+
+}
+
+void
+ChronoAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
+
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  chronoSvc( )->chronoStop( caller + ":" + evt ) ;
+
+}

File src/ChronoAuditor.h

+#ifndef GAUDIAUD_CHRONOAUDITOR_H
+#define GAUDIAUD_CHRONOAUDITOR_H
+
+#include "GaudiKernel/Auditor.h"
+
+class IChronoStatSvc;
+
+/** @class ChronoAuditor
+    Monitors the cpu time usage of each algorithm
+
+    @author David Quarrie
+*/
+class ChronoAuditor : virtual public Auditor {
+public:
+  ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~ChronoAuditor();
+  virtual void beforeInitialize(INamedInterface* alg);
+  virtual void afterInitialize(INamedInterface* alg);
+  virtual void beforeReinitialize(INamedInterface* alg);
+  virtual void afterReinitialize(INamedInterface* alg);
+  virtual void beforeExecute(INamedInterface* alg);
+  virtual void afterExecute(INamedInterface* alg, const StatusCode&);
+  virtual void beforeBeginRun(INamedInterface* alg);
+  virtual void afterBeginRun(INamedInterface *alg);
+  virtual void beforeEndRun(INamedInterface* alg);
+  virtual void afterEndRun(INamedInterface *alg);
+  virtual void beforeFinalize(INamedInterface* alg);
+  virtual void afterFinalize(INamedInterface* alg);
+
+  virtual void before(CustomEventTypeRef evt, const std::string& caller);
+  virtual void after(CustomEventTypeRef evt, const std::string& caller, const StatusCode& );
+
+  IChronoStatSvc* chronoSvc( ) { return m_chronoSvc; }
+private:
+  IChronoStatSvc* m_chronoSvc;
+  StringArrayProperty m_types;
+
+};
+
+#endif

File src/MemStatAuditor.cpp

+#ifdef __ICC
+// disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
+//   TODO: there is only a partial overload of IAuditor::before and IAuditor::after
+#pragma warning(disable:654)
+#endif
+
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/AudFactory.h"
+#include "GaudiKernel/IChronoStatSvc.h"
+
+#include "GaudiKernel/Stat.h"
+
+/// local
+#include "ProcStats.h"
+#include "MemStatAuditor.h"
+
+DECLARE_AUDITOR_FACTORY(MemStatAuditor)
+
+MemStatAuditor::MemStatAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
+  Auditor(name, pSvcLocator), m_vSize(-1.)
+{
+  declareProperty("CustomEventTypes",m_types);
+
+  m_stat = serviceLocator()->service("ChronoStatSvc");
+}
+
+MemStatAuditor::~MemStatAuditor(){
+}
+
+void MemStatAuditor::beforeInitialize(INamedInterface*) {
+  //DR not useful
+  //   std::string theString = "Memory usage before ";
+  //   theString += alg->name() ;
+  //   theString += " \tInitialization Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterInitialize(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after  ";
+  theString += ini->name() ;
+  theString += " \tInitialization Method";
+  printinfo(theString, ini->name() );
+}
+void MemStatAuditor::beforeReinitialize(INamedInterface*) {
+  //DR not useful
+  //   std::string theString = "Memory usage before ";
+  //   theString += alg->name() ;
+  //   theString += " \tReinitialization Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterReinitialize(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after  ";
+  theString += ini->name() ;
+  theString += " \tReinitialization Method";
+  printinfo(theString, ini->name() );
+}
+void MemStatAuditor:: beforeExecute(INamedInterface*){
+  //DR not useful
+  //   std::string theString = "Memory usage has changed before ";
+  //   theString += alg->name() ;
+  //   theString += " \tBefExecute Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterExecute(INamedInterface* alg, const StatusCode& ) {
+  std::string theString = "Memory usage has changed after  ";
+  theString += alg->name() ;
+  theString += " \tExecute Method";
+  printinfo(theString, alg->name() );
+
+}
+void MemStatAuditor::beforeBeginRun(INamedInterface*) {
+  //DR not useful
+  //   std::string theString = "Memory usage before ";
+  //   theString += alg->name() ;
+  //   theString += " \tBeginRun Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterBeginRun(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after  ";
+  theString += ini->name() ;
+  theString += " \tBeginRun Method";
+  printinfo(theString, ini->name() );
+}
+void MemStatAuditor::beforeEndRun(INamedInterface*) {
+  //DR not useful
+  //   std::string theString = "Memory usage before ";
+  //   theString += alg->name() ;
+  //   theString += " \tEndRun Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterEndRun(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after  ";
+  theString += ini->name() ;
+  theString += " \tEndRun Method";
+  printinfo(theString, ini->name() );
+}
+void MemStatAuditor:: beforeFinalize(INamedInterface*) {
+  //DR not useful
+  //   std::string theString = "Memory usage has changed before ";
+  //   theString += alg->name() ;
+  //   theString += " \tFinalize Method";
+  //   printinfo(theString, alg->name() );
+}
+void MemStatAuditor:: afterFinalize(INamedInterface*){
+  //DR not useful
+  //   std::string theString = "Memory usage has changed after  ";
+  //   theString += alg->name() ;
+  //   theString += " \tFinalize Method";
+  //   printinfo(theString, alg->name() );
+
+}
+
+void
+MemStatAuditor::before(CustomEventTypeRef evt, const std::string& caller) {
+
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  std::string theString = "Memory usage before ";
+  theString += caller + " with auditor trigger " + evt;
+  printinfo(theString, caller);
+
+}
+
+void
+MemStatAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
+
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  std::string theString = "Memory usage has changed after ";
+  theString += caller + " with auditor trigger " + evt;
+  printinfo(theString, caller);
+
+}
+
+StatusCode MemStatAuditor::sysFinalize( )
+{
+  return StatusCode::SUCCESS;
+}
+
+bool MemStatAuditor::printinfo(const std::string& theString, const std::string& tag )
+{
+  bool status(false);
+  ProcStats* p = ProcStats::instance();
+  procInfo info;
+  ///cannot be eaxactly 0
+  double deltaVSize =0.00001;
+
+
+  if( p->fetch(info) == true)
+    {
+      MsgStream log(msgSvc(), name());
+
+      if (m_vSize>0 && info.vsize >0 ){
+	 deltaVSize=info.vsize-m_vSize;
+      }
+
+      // store the current VSize to be able to monitor the increment
+      if (info.vsize>0) {
+	 m_vSize=info.vsize;
+      }
+
+      log << MSG::INFO << theString <<
+	" \tvirtual size = " << info.vsize << " MB"  <<
+	" \tresident set size = " << info.rss << " MB" <<
+	" deltaVsize = " << deltaVSize << "  MB " << endmsg;
+      ///
+
+      //      Stat stv( statSvc() , tag+":VMemUsage" , info.vsize );
+      //   Stat str( statSvc() , tag+":RMemUsage" , info.rss   );
+      ///
+      status=true;
+    }
+  // fill the stat for every call, not just when there is a change
+  // only monitor the increment in VSize
+  Stat sts( statSvc() , tag+":VMem" , deltaVSize );
+
+
+  ///
+  return status; //FIXME
+}
+
+
+
+
+
+
+
+

File src/MemStatAuditor.h

+#ifndef     GAUDIAUDITOR_MemStatAuditor_H
+#define     GAUDIAUDITOR_MemStatAuditor_H 1
+
+/** @class MemStatAuditor MemStatAuditor.h GaudiAud/MemStatAudit.h
+
+    Just a minor modification of MemoryAuditor to allow
+    the ouput memory statistics table to be printed
+
+    @author  Vanya Belyaev
+    @date    04/02/2001
+*/
+
+#include "GaudiKernel/Auditor.h"
+
+class IChronoStatSvc;
+
+class MemStatAuditor:public  Auditor {
+
+public:
+  MemStatAuditor(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~MemStatAuditor();
+  virtual void beforeInitialize(INamedInterface* alg);
+  virtual void afterInitialize(INamedInterface* alg);
+  virtual void beforeReinitialize(INamedInterface* alg);
+  virtual void afterReinitialize(INamedInterface* alg);
+  virtual void beforeExecute(INamedInterface* alg);
+  virtual void afterExecute(INamedInterface* alg, const StatusCode &);
+  virtual void beforeBeginRun(INamedInterface* alg);
+  virtual void afterBeginRun(INamedInterface *alg);
+  virtual void beforeEndRun(INamedInterface* alg);
+  virtual void afterEndRun(INamedInterface *alg);
+  virtual void beforeFinalize(INamedInterface* alg);
+  virtual void afterFinalize(INamedInterface* alg);
+
+  virtual void before(CustomEventTypeRef evt, const std::string& caller);
+  virtual void after(CustomEventTypeRef evt, const std::string& caller, const StatusCode& );
+
+  virtual StatusCode sysFinalize( );
+
+private:
+
+  StringArrayProperty m_types;
+  bool printinfo(const std::string& theString, const std::string& Tag );
+  SmartIF<IChronoStatSvc>&  statSvc() const { return m_stat; }
+  mutable SmartIF<IChronoStatSvc>  m_stat;
+  double m_vSize ; // vsize of the previous call to printinfo
+};
+
+#endif  //  GAUDIAUDITOR_MemStatAuditor_H
+

File src/MemoryAuditor.cpp

+// MemoryAuditor:
+//  An auditor that monitors memory usage
+
+#ifdef __ICC
+// disable icc warning #654: overloaded virtual function "B::Y" is only partially overridden in class "C"
+//   TODO: there is only a partial overload of IAuditor::before and IAuditor::after
+#pragma warning(disable:654)
+#endif
+
+#include "MemoryAuditor.h"
+#include "ProcStats.h"
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/AudFactory.h"
+
+DECLARE_AUDITOR_FACTORY(MemoryAuditor)
+
+MemoryAuditor::MemoryAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
+  Auditor(name, pSvcLocator)
+{
+  declareProperty("CustomEventTypes",m_types);
+
+}
+
+MemoryAuditor::~MemoryAuditor(){
+}
+
+void MemoryAuditor::beforeInitialize(INamedInterface* alg) {
+  std::string theString = "Memory usage before ";
+  theString += alg->name() ;
+  theString += " Initialization Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterInitialize(INamedInterface* alg){
+  std::string theString = "Memory usage has changed after ";
+  theString += alg->name() ;
+  theString += " Initialization Method";
+  printinfo(theString);
+}
+void MemoryAuditor::beforeReinitialize(INamedInterface* alg) {
+  std::string theString = "Memory usage before ";
+  theString += alg->name() ;
+  theString += " Reinitialization Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterReinitialize(INamedInterface* alg){
+  std::string theString = "Memory usage has changed after ";
+  theString += alg->name() ;
+  theString += " Reinitialization Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: beforeExecute(INamedInterface* alg){
+  std::string theString = "Memory usage has changed before ";
+  theString += alg->name() ;
+  theString += " Execute Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterExecute(INamedInterface* alg, const StatusCode& ) {
+  std::string theString = "Memory usage has changed after ";
+  theString += alg->name() ;
+  theString += " Execute Method";
+  printinfo(theString);
+}
+void MemoryAuditor::beforeBeginRun(INamedInterface* ini) {
+  std::string theString = "Memory usage before ";
+  theString += ini->name() ;
+  theString += " BeginRun Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterBeginRun(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after ";
+  theString += ini->name() ;
+  theString += " BeginRun Method";
+  printinfo(theString);
+}
+void MemoryAuditor::beforeEndRun(INamedInterface* ini) {
+  std::string theString = "Memory usage before ";
+  theString += ini->name() ;
+  theString += " EndRun Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterEndRun(INamedInterface* ini){
+  std::string theString = "Memory usage has changed after ";
+  theString += ini->name() ;
+  theString += " EndRun Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: beforeFinalize(INamedInterface* alg) {
+  std::string theString = "Memory usage has changed before ";
+  theString += alg->name() ;
+  theString += " Finalize Method";
+  printinfo(theString);
+}
+void MemoryAuditor:: afterFinalize(INamedInterface* alg){
+  std::string theString = "Memory usage has changed after ";
+  theString += alg->name() ;
+  theString += " Finalize Method";
+  printinfo(theString);
+}
+
+void
+MemoryAuditor::before(CustomEventTypeRef evt, const std::string& caller) {
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  std::string theString = "Memory usage before ";
+  theString += caller + " with auditor trigger " + evt;
+  printinfo(theString);
+
+}
+
+void
+MemoryAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
+
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  std::string theString = "Memory usage has changed after ";
+  theString += caller + " with auditor trigger " + evt;
+  printinfo(theString);
+
+}
+
+
+StatusCode MemoryAuditor::sysFinalize( )
+{
+  return StatusCode::SUCCESS;
+}
+
+bool MemoryAuditor::printinfo(std::string theString)
+{
+   ProcStats* p = ProcStats::instance();
+   procInfo info;
+
+   // The fetch method returns true if memory usage has changed...
+   if( p->fetch(info) == true) {
+     MsgStream log(msgSvc(), name());
+     log << MSG::INFO << theString <<
+       " virtual size = " << info.vsize << " MB"  <<
+       " resident set size = " << info.rss << " MB" << endmsg;
+     return true;
+    }
+   else {
+      return false;
+   }
+}

File src/MemoryAuditor.h

+#ifndef ATLASAUDITOR_MEMORYAUDITOR_H
+#define ATLASAUDITOR_MEMORYAUDITOR_H
+
+// ClassName: MemoryAuditor
+//
+// Description:  Monitors the memory use of each algorithm
+//
+// Author: M. Shapiro, LBNL
+//
+#include "GaudiKernel/Auditor.h"
+
+class MemoryAuditor:public  Auditor {
+
+public:
+  MemoryAuditor(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~MemoryAuditor();
+  virtual void beforeInitialize(INamedInterface* alg);
+  virtual void afterInitialize(INamedInterface* alg);
+  virtual void beforeReinitialize(INamedInterface* alg);
+  virtual void afterReinitialize(INamedInterface* alg);
+  virtual void beforeExecute(INamedInterface* alg);
+  virtual void afterExecute(INamedInterface* alg, const StatusCode& );
+  virtual void beforeBeginRun(INamedInterface* alg);
+  virtual void afterBeginRun(INamedInterface *alg);
+  virtual void beforeEndRun(INamedInterface* alg);
+  virtual void afterEndRun(INamedInterface *alg);
+  virtual void beforeFinalize(INamedInterface* alg);
+  virtual void afterFinalize(INamedInterface* alg);
+
+  virtual void before(CustomEventTypeRef evt, const std::string& caller);
+  virtual void after(CustomEventTypeRef evt, const std::string& caller, const StatusCode& );
+
+
+  virtual StatusCode sysFinalize( );
+
+private:
+  StringArrayProperty m_types;
+  bool printinfo(std::string theString);
+};
+
+#endif

File src/NameAuditor.cpp

+// NameAuditor:
+//  An auditor that prints the name of each algorithm method before
+// and after it is called///
+
+#include "NameAuditor.h"
+
+#include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/AudFactory.h"
+
+#include <sstream>
+
+DECLARE_AUDITOR_FACTORY(NameAuditor)
+
+NameAuditor::NameAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
+  Auditor(name, pSvcLocator)
+{
+
+  declareProperty("CustomEventTypes", m_types,
+                  "List of custom event types to audit ([]=all, ['none']=none");
+
+}
+
+NameAuditor::~NameAuditor(){
+}
+
+
+void NameAuditor::before(StandardEventType evt, const std::string& caller)
+{
+  std::ostringstream oss;
+  oss << evt;
+  before(oss.str(), caller);
+}
+
+
+void NameAuditor::after(StandardEventType evt, const std::string& caller, const StatusCode& sc)
+{
+  std::ostringstream oss;
+  oss << evt;
+  after(oss.str(), caller, sc);
+}
+
+void
+NameAuditor::i_doAudit(const std::string& evt, const std::string& caller, Action action)
+{
+  if (m_types.value().size() != 0) {
+    if ( (m_types.value())[0] == "none") {
+      return;
+    }
+
+    if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
+	 m_types.value().end() ) {
+      return;
+    }
+  }
+
+  MsgStream log( msgSvc(), name() );
+  if ( action==BEFORE ) {
+    log << MSG::INFO << "About to Enter " << caller << " with auditor trigger "
+        << evt << endmsg;
+  }
+  else {
+    log << MSG::INFO << "Just Exited " << caller << " with auditor trigger "
+        << evt << endmsg;
+  }
+}

File src/NameAuditor.h

+#ifndef ATLASAUDITOR_NAMEAUDITOR_H
+#define ATLASAUDITOR_NAMEAUDITOR_H
+
+#include "GaudiKernel/Auditor.h"
+#include "GaudiKernel/Property.h"
+
+/**
+ * @brief Prints the name of each algorithm before entering the algorithm and after leaving it
+ * @author M. Shapiro, LBNL
+ *
+ */
+class NameAuditor:public  Auditor {
+private:
+  enum Action { BEFORE, AFTER };
+
+public:
+  NameAuditor(const std::string& name, ISvcLocator* pSvcLocator);
+  virtual ~NameAuditor();
+
+  /// \name "before" Auditor hooks
+  //@{
+  virtual void before(StandardEventType evt, const std::string& caller);
+
+  virtual void before(StandardEventType evt, INamedInterface* caller) {
+    if (caller) before(evt, caller->name());
+  }
+  virtual void before(CustomEventTypeRef evt, const std::string& caller) {
+    i_doAudit(evt, caller, BEFORE);
+  }
+  virtual void before(CustomEventTypeRef evt, INamedInterface* caller) {
+    if (caller) before(evt, caller->name());
+  }
+  //@}
+
+  /// \name "after" Auditor hooks
+  //@{
+  virtual void after(StandardEventType evt, const std::string& caller, const StatusCode& sc);
+
+  virtual void after(StandardEventType evt, INamedInterface* caller, const StatusCode& sc) {
+    if (caller) after(evt, caller->name(), sc);
+  }
+  virtual void after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
+    i_doAudit(evt, caller, AFTER);
+  }
+  virtual void after(CustomEventTypeRef evt, INamedInterface* caller, const StatusCode& sc) {
+    if (caller) after(evt, caller->name(), sc);
+  }
+  //@}
+
+private:
+  /// Implementation of the auditor
+  void i_doAudit(const std::string& evt, const std::string& caller, Action action);
+
+private:
+  StringArrayProperty m_types;   ///< Filter for custom event types
+
+};
+
+#endif

File src/ProcStats.cpp

+// $Id: ProcStats.cpp,v 1.4 2006/09/13 14:31:12 hmd Exp $
+// Class: ProcStats
+// Purpose:  To keep statistics on memory use
+// Warning:  Only Linux implementation at the present time...
+#ifdef __ICC
+// disable icc remark #2259: non-pointer conversion from "X" to "Y" may lose significant bits
+//   meant
+#pragma warning(disable:2259)
+#endif
+
+#include "ProcStats.h"
+
+#ifdef __linux
+#include <unistd.h>
+#include <iostream>
+#include <sstream>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/syscall.h>
+#include <sys/procfs.h>
+#include <cstdio>
+
+using std::cerr;
+using std::cout;
+using std::endl;
+
+struct linux_proc {
+  int pid; // %d
+  char comm[400]; // %s
+  char state; // %c
+  int ppid; // %d
+  int pgrp; // %d
+  int session; // %d
+  int tty; // %d
+  int tpgid; // %d
+  unsigned int flags; // %u
+  unsigned int minflt; // %u
+  unsigned int cminflt; // %u
+  unsigned int majflt; // %u
+  unsigned int cmajflt; // %u
+  int utime; // %d
+  int stime; // %d
+  int cutime; // %d
+  int cstime; // %d
+  int counter; // %d
+  int priority; // %d
+  unsigned int timeout; // %u
+  unsigned int itrealvalue; // %u
+  int starttime; // %d
+  unsigned int vsize; // %u
+  unsigned int rss; // %u
+  unsigned int rlim; // %u
+  unsigned int startcode; // %u
+  unsigned int endcode; // %u
+  unsigned int startstack; // %u
+  unsigned int kstkesp; // %u
+  unsigned int kstkeip; // %u
+  int signal; // %d
+  int blocked; // %d
+  int sigignore; // %d
+  int sigcatch; // %d
+  unsigned int wchan; // %u
+};
+#endif // __linux
+
+ProcStats::cleanup::~cleanup() {
+  if(ProcStats::inst!=0)  {
+    delete ProcStats::inst;
+    ProcStats::inst=0;
+  }
+}
+
+ProcStats* ProcStats::instance() {
+  static cleanup c;
+  if(inst==0)
+    inst = new ProcStats;
+  return inst;
+}
+
+ProcStats* ProcStats::inst = 0;
+
+ProcStats::ProcStats():valid(false)
+{
+#ifdef __linux
+  pg_size = sysconf(_SC_PAGESIZE); // getpagesize();
+  std::ostringstream ost; 
+
+  ost << "/proc/" << getpid() << "/stat";
+  fname = ost.str();
+  if((fd=open(fname.c_str(),O_RDONLY))<0)
+  {
+    cerr << "Failed to open " << ost.str() << endl;
+    return;
+  }
+#endif
+  valid=true;
+}
+
+ProcStats::~ProcStats()
+{
+#ifdef __linux
+  close(fd);
+#endif
+}
+
+bool ProcStats::fetch(procInfo& f)
+{
+  if( valid == false ) return false;
+
+#ifdef __linux
+  double pr_size, pr_rssize;
+  linux_proc pinfo;
+  int cnt;
+
+  lseek(fd,0,SEEK_SET);
+
+  if((cnt=read(fd,buf,sizeof(buf)))<0)
+  {
+    cout << "LINUX Read of Proc file failed:" << endl;
+    return false;
+  }
+
+  if(cnt>0)
+  {
+    buf[cnt]='\0';
+
+    sscanf(buf,
+      "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u",
+      &pinfo.pid, // %d
+      pinfo.comm, // %s
+      &pinfo.state, // %c
+      &pinfo.ppid, // %d
+      &pinfo.pgrp, // %d
+      &pinfo.session, // %d
+      &pinfo.tty, // %d
+      &pinfo.tpgid, // %d
+      &pinfo.flags, // %u
+      &pinfo.minflt, // %u
+      &pinfo.cminflt, // %u
+      &pinfo.majflt, // %u
+      &pinfo.cmajflt, // %u
+      &pinfo.utime, // %d
+      &pinfo.stime, // %d
+      &pinfo.cutime, // %d
+      &pinfo.cstime, // %d
+      &pinfo.counter, // %d
+      &pinfo.priority, // %d
+      &pinfo.timeout, // %u
+      &pinfo.itrealvalue, // %u
+      &pinfo.starttime, // %d
+      &pinfo.vsize, // %u
+      &pinfo.rss, // %u
+      &pinfo.rlim, // %u
+      &pinfo.startcode, // %u
+      &pinfo.endcode, // %u
+      &pinfo.startstack, // %u
+      &pinfo.kstkesp, // %u
+      &pinfo.kstkeip, // %u
+      &pinfo.signal, // %d
+      &pinfo.blocked, // %d
+      &pinfo.sigignore, // %d
+      &pinfo.sigcatch, // %d
+      &pinfo.wchan // %u
+      );
+
+      // resident set size in pages
+    pr_size = (double)pinfo.vsize;
+    pr_rssize = (double)pinfo.rss;
+
+    f.vsize = pr_size   / (1024*1024);
+    f.rss   = pr_rssize * pg_size / (1024*1024);
+  }
+
+#else
+  f.vsize = 0;
+  f.rss   = 0;
+#endif
+
+  bool rc = (curr==f)?false:true;
+
+  curr.rss=f.rss;
+  curr.vsize=f.vsize;
+
+  return rc;
+}
+

File src/ProcStats.h

+// $Id: ProcStats.h,v 1.2 2004/06/08 13:40:07 mato Exp $
+#ifndef GAUDIAUD_PROCSTATS_H
+#define GAUDIAUD_PROCSTATS_H
+
+// Class: ProcStats
+// Description:  Keeps statistics on memory usage
+// Author: Jim Kowalkowski (FNAL), modified by M. Shapiro (LBNL)
+
+#include <string>
+#include <vector>
+
+struct procInfo
+{
+  procInfo() : vsize(0), rss(0) {}
+  procInfo(double sz, double rss_sz): vsize(sz),rss(rss_sz) {}
+
+  bool operator==(const procInfo& p) const {
+#ifdef __ICC
+// disable icc remark #1572: floating-point equality and inequality comparisons are unreliable
+#pragma warning(push)
+#pragma warning(disable:1572)
+#endif
+
+    return vsize==p.vsize && rss==p.rss;
+
+#ifdef __ICC
+// re-enable icc remark #1572
+#pragma warning(pop)
+#endif
+  }
+  
+  // see proc(4) man pages for units and a description
+  double vsize;  // in MB (used to be in pages?)
+  double rss;    // in MB (used to be in pages?)
+};
+
+class ProcStats
+{
+public:
+  static ProcStats* instance();
+
+  bool fetch(procInfo& fill_me);
+  double pageSize() const { return pg_size; }
+
+private:
+  ProcStats();
+  ~ProcStats();
+
+  struct cleanup
+  {
+    cleanup() { }
+    ~cleanup();
+  };
+
+  friend struct cleanup;
+
+  int fd;
+  double pg_size;
+  procInfo curr;
+  std::string fname;
+  char buf[500];
+  bool valid;
+
+  static ProcStats* inst;
+};
+
+#endif
+

File tests/qmtest/gaudiaud.qms/bug_28570_algcontextsvc_warning.qmt

+<?xml version="1.0" ?><!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
+<extension class="GaudiTest.GaudiExeTest" kind="test">
+<argument name="options"><text>
+AuditorSvc.Auditors += { 'AlgContextAuditor' } ;
+ApplicationMgr.ExtSvc += { 'AuditorSvc','AlgContextSvc' } ;
+ApplicationMgr.AuditServices = true ;
+      
+ApplicationMgr.EvtMax    = 1;   // events to be processed (default is 10)
+ApplicationMgr.EvtSel   = 'NONE'; // do not use any event input
+</text></argument>
+<argument name="validator"><text>
+import re
+if re.search(r'AlgContextSvc.*WARNING.*NULL',stdout):
+    causes.append("warning in AlgContextSvc for NULL pointer")
+</text></argument>
+</extension>