ATLAS Offline Software
|
an IAlgorithmWrapper that adds a memory monitor to an algorithm More...
#include <AlgorithmMemoryWrapper.h>
Public Types | |
using | clock_type = std::chrono::high_resolution_clock |
the clock we use for our Memory More... | |
Public Member Functions | |
void | testInvariant () const |
test the invariant of this object More... | |
AlgorithmMemoryWrapper () | |
standard default constructor for serialization More... | |
AlgorithmMemoryWrapper (std::unique_ptr< IAlgorithmWrapper > &&val_algorithm) | |
standard constructor More... | |
virtual std::string_view | getName () const override |
virtual bool | hasName (const std::string &name) const override |
whether this algorithm has the given name More... | |
virtual std::unique_ptr< IAlgorithmWrapper > | makeClone () const override |
make a clone of this algorithm More... | |
virtual Algorithm * | getLegacyAlg () override |
get the legacy algorithm, if we wrap one More... | |
virtual StatusCode | initialize (const AlgorithmWorkerData &workerData) override |
call initialize on the algorithm More... | |
virtual StatusCode | execute () override |
call execute on the algorithm More... | |
virtual StatusCode | postExecute () override |
call postExecute on the algorithm More... | |
virtual StatusCode | finalize () override |
call finalize on the algorithm More... | |
virtual StatusCode | fileExecute () override |
call fileExecute on the algorithm More... | |
virtual StatusCode | beginInputFile () override |
call beginInputFile on the algorithm More... | |
virtual StatusCode | endInputFile () override |
call endInputFile on the algorithm More... | |
Private Member Functions | |
StatusCode | recordPreMemory () |
StatusCode | recordPostMemory () |
Private Attributes | |
std::unique_ptr< IAlgorithmWrapper > | m_algorithm |
the actual algorithm More... | |
std::vector< Long_t > | m_mem_resident |
the Memory Consumption for different calls More... | |
std::vector< Long_t > | m_mem_virtual |
Long_t | m_preMem_resident = 0 |
Long_t | m_preMem_virtual = 0 |
an IAlgorithmWrapper that adds a memory monitor to an algorithm
This is a little weird in how its done: We can't just count the total memory allocated as all algorithms allocate memory which gets released at the end of the event. We also can't just count what gets allocated in initialize (which would seem natural), as some tools and algorithms do not allocate all their memory until we hit execute. And it may not even be the first execute either, it depends on what's in the event. So I'm summing up the memory increase from the top ten calls to functions on the algorithm. This is a bit of a hack, but the whole mechanism is meant to be quick and dirty. If you want a proper estimate, you should use valgrind.
Definition at line 43 of file AlgorithmMemoryWrapper.h.
using EL::AlgorithmMemoryWrapper::clock_type = std::chrono::high_resolution_clock |
the clock we use for our Memory
Definition at line 51 of file AlgorithmMemoryWrapper.h.
|
inline |
standard default constructor for serialization
Definition at line 57 of file AlgorithmMemoryWrapper.h.
EL::AlgorithmMemoryWrapper::AlgorithmMemoryWrapper | ( | std::unique_ptr< IAlgorithmWrapper > && | val_algorithm | ) |
standard constructor
Definition at line 35 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call beginInputFile on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 160 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call endInputFile on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 174 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call execute on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 96 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call fileExecute on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 146 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call finalize on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 124 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
get the legacy algorithm, if we wrap one
Reimplemented from EL::IAlgorithmWrapper.
Definition at line 73 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
Implements EL::IAlgorithmWrapper.
Definition at line 44 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
whether this algorithm has the given name
Implements EL::IAlgorithmWrapper.
Definition at line 53 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call initialize on the algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 82 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
make a clone of this algorithm
Implements EL::IAlgorithmWrapper.
Definition at line 62 of file AlgorithmMemoryWrapper.cxx.
|
overridevirtual |
call postExecute on the algorithm
Reimplemented from EL::IAlgorithmWrapper.
Definition at line 110 of file AlgorithmMemoryWrapper.cxx.
|
private |
Definition at line 205 of file AlgorithmMemoryWrapper.cxx.
|
private |
Definition at line 188 of file AlgorithmMemoryWrapper.cxx.
void EL::AlgorithmMemoryWrapper::testInvariant | ( | ) | const |
test the invariant of this object
Definition at line 28 of file AlgorithmMemoryWrapper.cxx.
|
private |
|
private |
the Memory Consumption for different calls
Definition at line 102 of file AlgorithmMemoryWrapper.h.
|
private |
Definition at line 103 of file AlgorithmMemoryWrapper.h.
|
private |
Definition at line 105 of file AlgorithmMemoryWrapper.h.
|
private |
Definition at line 106 of file AlgorithmMemoryWrapper.h.