ATLAS Offline Software
AlgorithmTimerWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef EVENT_LOOP__ALGORITHM_TIMER_WRAPPER_H
10 #define EVENT_LOOP__ALGORITHM_TIMER_WRAPPER_H
11 
12 #include <EventLoop/Global.h>
13 
15 #include <chrono>
16 
17 namespace EL
18 {
25 
27  {
30 
31  public:
32 
34  using clock_type = std::chrono::high_resolution_clock;
35 
37  void testInvariant () const;
38 
41 
43  AlgorithmTimerWrapper (std::unique_ptr<IAlgorithmWrapper>&& val_algorithm);
44 
45 
46 
49 
50  public:
51 
52  virtual std::string_view getName () const override;
53 
54  virtual bool hasName (const std::string& name) const override;
55 
56  virtual std::unique_ptr<IAlgorithmWrapper> makeClone() const override;
57 
58  virtual Algorithm *getLegacyAlg () override;
59 
60  virtual StatusCode initialize (const AlgorithmWorkerData& workerData) override;
61 
62  virtual StatusCode execute () override;
63 
64  virtual StatusCode postExecute () override;
65 
66  virtual StatusCode finalize () override;
67 
69 
71 
73 
74 
75 
78 
79  private:
80 
82  std::unique_ptr<IAlgorithmWrapper> m_algorithm;
83 
88  };
89 }
90 
91 #endif
EL::AlgorithmTimerWrapper::hasName
virtual bool hasName(const std::string &name) const override
whether this algorithm has the given name
Definition: AlgorithmTimerWrapper.cxx:52
EL::AlgorithmTimerWrapper::testInvariant
void testInvariant() const
test the invariant of this object
Definition: AlgorithmTimerWrapper.cxx:27
EL::AlgorithmTimerWrapper::getLegacyAlg
virtual Algorithm * getLegacyAlg() override
get the legacy algorithm, if we wrap one
Definition: AlgorithmTimerWrapper.cxx:72
EL::AlgorithmTimerWrapper::finalize
virtual StatusCode finalize() override
call finalize on the algorithm
Definition: AlgorithmTimerWrapper.cxx:126
EL::AlgorithmTimerWrapper::initialize
virtual StatusCode initialize(const AlgorithmWorkerData &workerData) override
call initialize on the algorithm
Definition: AlgorithmTimerWrapper.cxx:81
EL::AlgorithmTimerWrapper::m_algorithm
std::unique_ptr< IAlgorithmWrapper > m_algorithm
the actual algorithm
Definition: AlgorithmTimerWrapper.h:82
EL::AlgorithmTimerWrapper::endInputFile
virtual ::StatusCode endInputFile() override
call endInputFile on the algorithm
Definition: AlgorithmTimerWrapper.cxx:175
EL::AlgorithmTimerWrapper::getName
virtual std::string_view getName() const override
Definition: AlgorithmTimerWrapper.cxx:43
EL::AlgorithmTimerWrapper
an IAlgorithmWrapper that adds a timer to an algorithm
Definition: AlgorithmTimerWrapper.h:27
EL::Algorithm
Definition: Algorithm.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::AlgorithmTimerWrapper::execute
virtual StatusCode execute() override
call execute on the algorithm
Definition: AlgorithmTimerWrapper.cxx:96
EL::AlgorithmTimerWrapper::beginInputFile
virtual ::StatusCode beginInputFile() override
call beginInputFile on the algorithm
Definition: AlgorithmTimerWrapper.cxx:160
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::AlgorithmTimerWrapper::fileExecute
virtual ::StatusCode fileExecute() override
call fileExecute on the algorithm
Definition: AlgorithmTimerWrapper.cxx:145
EL::AlgorithmTimerWrapper::m_time_file
clock_type::duration m_time_file
Definition: AlgorithmTimerWrapper.h:86
EL::AlgorithmTimerWrapper::m_time_global
clock_type::duration m_time_global
the timers for different calls
Definition: AlgorithmTimerWrapper.h:85
PixelAthHitMonAlgCfg.duration
duration
Definition: PixelAthHitMonAlgCfg.py:152
EL::AlgorithmTimerWrapper::AlgorithmTimerWrapper
AlgorithmTimerWrapper()
standard default constructor for serialization
Definition: AlgorithmTimerWrapper.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition: AlgorithmWorkerData.h:34
EL::AlgorithmTimerWrapper::postExecute
virtual StatusCode postExecute() override
call postExecute on the algorithm
Definition: AlgorithmTimerWrapper.cxx:111
EL::IAlgorithmWrapper
a wrapper around a generic algorithm for use within EventLoop
Definition: IAlgorithmWrapper.h:48
EL::AlgorithmTimerWrapper::m_time_event
clock_type::duration m_time_event
Definition: AlgorithmTimerWrapper.h:87
Global.h
EL::AlgorithmTimerWrapper::makeClone
virtual std::unique_ptr< IAlgorithmWrapper > makeClone() const override
make a clone of this algorithm
Definition: AlgorithmTimerWrapper.cxx:61
IAlgorithmWrapper.h
EL::AlgorithmTimerWrapper::clock_type
std::chrono::high_resolution_clock clock_type
the clock we use for our timer
Definition: AlgorithmTimerWrapper.h:34