Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AuditorTestAlg.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 // Include files
12 // from Gaudi
14 
22 public:
24  AuditorTestAlg( const std::string& name, ISvcLocator* pSvcLocator );
25 
26  ~AuditorTestAlg() override;
27 
28  StatusCode initialize() override;
29  StatusCode execute() override;
30  StatusCode finalize() override;
31 
32 protected:
33 private:
34 };
35 
36 //-----------------------------------------------------------------------------
37 // Implementation for class : AuditorTestAlg
38 //
39 // Apr 2, 2008 : Marco Clemencic
40 //-----------------------------------------------------------------------------
41 
42 // Declaration of the Algorithm Factory
44 
45 //=============================================================================
46 // Standard constructor, initializes variables
47 //=============================================================================
48 AuditorTestAlg::AuditorTestAlg( const std::string& name, ISvcLocator* pSvcLocator )
49  : GaudiAlgorithm( name, pSvcLocator ) {}
50 //=============================================================================
51 // Destructor
52 //=============================================================================
54 
55 //=============================================================================
56 // Initialization
57 //=============================================================================
59  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
60  if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
61 
62  debug() << "==> Initialize" << endmsg;
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 //=============================================================================
68 // Main execution
69 //=============================================================================
71 
72  debug() << "==> Execute" << endmsg;
73 
74  const IAuditor::CustomEventType evt( "loop" );
75  auditorSvc()->before( evt, name() );
76  for ( long i = 0; i < 1000000; ++i ) {}
77  auditorSvc()->after( evt, name() );
78 
79  return StatusCode::SUCCESS;
80 }
81 
82 //=============================================================================
83 // Finalize
84 //=============================================================================
86 
87  debug() << "==> Finalize" << endmsg;
88 
89  return GaudiAlgorithm::finalize(); // must be called after all other actions
90 }
91 
92 //=============================================================================
IOTest.evt
evt
Definition: IOTest.py:105
std::string
STL class.
GaudiAlgorithm::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiAlgorithm.cpp:65
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:528
AuditorTestAlg::AuditorTestAlg
AuditorTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition: AuditorTestAlg.cpp:48
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::Algorithm::auditorSvc
SmartIF< IAuditorSvc > & auditorSvc() const
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Definition: Algorithm.cpp:557
AuditorTestAlg
Definition: AuditorTestAlg.cpp:21
TimingHistograms.name
name
Definition: TimingHistograms.py:25
StatusCode
Definition: StatusCode.h:65
GaudiAlgorithm
Definition: GaudiAlgorithm.h:104
GaudiAlgorithm::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiAlgorithm.cpp:52
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
AuditorTestAlg::~AuditorTestAlg
~AuditorTestAlg() override
Destructor.
Definition: AuditorTestAlg.cpp:53
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
GaudiAlgorithm.h
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
AuditorTestAlg::finalize
StatusCode finalize() override
Algorithm finalization.
Definition: AuditorTestAlg.cpp:85
AuditorTestAlg::execute
StatusCode execute() override
Algorithm execution.
Definition: AuditorTestAlg.cpp:70
AuditorTestAlg::initialize
StatusCode initialize() override
Algorithm initialization.
Definition: AuditorTestAlg.cpp:58