ATLAS Offline Software
UnitTestAlg3.cxx
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 //
4 
5 // Local include(s).
7 
8 namespace EL {
9 
10  UnitTestAlg3::UnitTestAlg3( const std::string& name, ISvcLocator* svcLoc )
11  : AnaAlgorithm( name, svcLoc ) {
12 
13  // Declare the algorithm's properties.
14  declareProperty( "LeakBytes", m_leakBytes = 0,
15  "Number of bytes to leak per event" );
16  }
17 
19 
20  // Allocate the requested amount of memory.
21  if( m_leakBytes > 0 ) {
22  // This needs to be `volatile` and zeroed out to ensure the memory
23  // really gets allocated by the operating system. Without `volatile`
24  // the compiler is essentially allowed to optimize away the write,
25  // and the operating system isn't required to allocate it if it isn't
26  // written to.
27  volatile char* lostPointer = new volatile char[ m_leakBytes ];
28  for( int i = 0; i < m_leakBytes; ++i ) {
29  *lostPointer = 0;
30  ++lostPointer;
31  }
32  }
33 
34  // Return gracefully.
35  return ::StatusCode::SUCCESS;
36  }
37 
38 } // namespace EL
EL::UnitTestAlg3::UnitTestAlg3
UnitTestAlg3(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
Definition: UnitTestAlg3.cxx:10
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
EL::UnitTestAlg3::m_leakBytes
int m_leakBytes
The number of bytes to leak per event.
Definition: UnitTestAlg3.h:39
EL::AnaAlgorithm
the (new) base class for EventLoop algorithms
Definition: AnaAlgorithm.h:73
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::UnitTestAlg3::execute
virtual ::StatusCode execute() override
Function executing the algorithm.
Definition: UnitTestAlg3.cxx:18
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
UnitTestAlg3.h