ATLAS Offline Software
AlgorithmMemoryWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef EVENT_LOOP__ALGORITHM_MEMORY_WRAPPER_H
10 #define EVENT_LOOP__ALGORITHM_MEMORY_WRAPPER_H
11 
12 #include <EventLoop/Global.h>
13 
15 #include <Rtypes.h>
16 #include <chrono>
17 
18 namespace EL
19 {
42 
44  {
47 
48  public:
49 
51  using clock_type = std::chrono::high_resolution_clock;
52 
54  void testInvariant () const;
55 
58 
60  AlgorithmMemoryWrapper (std::unique_ptr<IAlgorithmWrapper>&& val_algorithm);
61 
62 
63 
66 
67  public:
68 
69  virtual std::string_view getName () const override;
70 
71  virtual bool hasName (const std::string& name) const override;
72 
73  virtual std::unique_ptr<IAlgorithmWrapper> makeClone() const override;
74 
75  virtual Algorithm *getLegacyAlg () override;
76 
77  virtual StatusCode initialize (const AlgorithmWorkerData& workerData) override;
78 
79  virtual StatusCode execute () override;
80 
81  virtual StatusCode postExecute () override;
82 
83  virtual StatusCode finalize () override;
84 
85  virtual StatusCode fileExecute () override;
86 
87  virtual StatusCode beginInputFile () override;
88 
89  virtual StatusCode endInputFile () override;
90 
91 
92 
95 
96  private:
97 
99  std::unique_ptr<IAlgorithmWrapper> m_algorithm;
100 
102  std::vector<Long_t> m_mem_resident;
103  std::vector<Long_t> m_mem_virtual;
104 
105  Long_t m_preMem_resident = 0;
106  Long_t m_preMem_virtual = 0;
107 
110  };
111 }
112 
113 #endif
EL::AlgorithmMemoryWrapper::execute
virtual StatusCode execute() override
call execute on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:97
EL::AlgorithmMemoryWrapper::m_preMem_resident
Long_t m_preMem_resident
Definition: AlgorithmMemoryWrapper.h:105
EL::AlgorithmMemoryWrapper::getLegacyAlg
virtual Algorithm * getLegacyAlg() override
get the legacy algorithm, if we wrap one
Definition: AlgorithmMemoryWrapper.cxx:74
EL::AlgorithmMemoryWrapper::m_mem_resident
std::vector< Long_t > m_mem_resident
the Memory Consumption for different calls
Definition: AlgorithmMemoryWrapper.h:102
EL::AlgorithmMemoryWrapper::hasName
virtual bool hasName(const std::string &name) const override
whether this algorithm has the given name
Definition: AlgorithmMemoryWrapper.cxx:54
EL::AlgorithmMemoryWrapper::recordPreMemory
StatusCode recordPreMemory()
Definition: AlgorithmMemoryWrapper.cxx:189
EL::AlgorithmMemoryWrapper::postExecute
virtual StatusCode postExecute() override
call postExecute on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:111
EL::AlgorithmMemoryWrapper::m_mem_virtual
std::vector< Long_t > m_mem_virtual
Definition: AlgorithmMemoryWrapper.h:103
EL::AlgorithmMemoryWrapper::m_preMem_virtual
Long_t m_preMem_virtual
Definition: AlgorithmMemoryWrapper.h:106
EL::Algorithm
Definition: Algorithm.h:22
EL::AlgorithmMemoryWrapper::getName
virtual std::string_view getName() const override
Definition: AlgorithmMemoryWrapper.cxx:45
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::AlgorithmMemoryWrapper::beginInputFile
virtual StatusCode beginInputFile() override
call beginInputFile on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:161
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::AlgorithmMemoryWrapper::fileExecute
virtual StatusCode fileExecute() override
call fileExecute on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:147
EL::AlgorithmMemoryWrapper::makeClone
virtual std::unique_ptr< IAlgorithmWrapper > makeClone() const override
make a clone of this algorithm
Definition: AlgorithmMemoryWrapper.cxx:63
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
EL::AlgorithmMemoryWrapper::recordPostMemory
StatusCode recordPostMemory()
Definition: AlgorithmMemoryWrapper.cxx:206
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition: AlgorithmWorkerData.h:34
EL::AlgorithmMemoryWrapper::AlgorithmMemoryWrapper
AlgorithmMemoryWrapper()
standard default constructor for serialization
Definition: AlgorithmMemoryWrapper.h:57
EL::AlgorithmMemoryWrapper::clock_type
std::chrono::high_resolution_clock clock_type
the clock we use for our Memory
Definition: AlgorithmMemoryWrapper.h:51
EL::IAlgorithmWrapper
a wrapper around a generic algorithm for use within EventLoop
Definition: IAlgorithmWrapper.h:48
EL::AlgorithmMemoryWrapper::initialize
virtual StatusCode initialize(const AlgorithmWorkerData &workerData) override
call initialize on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:83
EL::AlgorithmMemoryWrapper::m_algorithm
std::unique_ptr< IAlgorithmWrapper > m_algorithm
the actual algorithm
Definition: AlgorithmMemoryWrapper.h:99
EL::AlgorithmMemoryWrapper::testInvariant
void testInvariant() const
test the invariant of this object
Definition: AlgorithmMemoryWrapper.cxx:29
EL::AlgorithmMemoryWrapper::endInputFile
virtual StatusCode endInputFile() override
call endInputFile on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:175
EL::AlgorithmMemoryWrapper::finalize
virtual StatusCode finalize() override
call finalize on the algorithm
Definition: AlgorithmMemoryWrapper.cxx:125
EL::AlgorithmMemoryWrapper
an IAlgorithmWrapper that adds a memory monitor to an algorithm
Definition: AlgorithmMemoryWrapper.h:44
Global.h
IAlgorithmWrapper.h