ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoopTest
Root
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).
6
#include "
EventLoopTest/UnitTestAlg3.h
"
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
18
::StatusCode
UnitTestAlg3::execute
() {
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
UnitTestAlg3.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::UnitTestAlg3::execute
virtual::StatusCode execute() override
Function executing the algorithm.
Definition
UnitTestAlg3.cxx:18
EL::UnitTestAlg3::m_leakBytes
int m_leakBytes
The number of bytes to leak per event.
Definition
UnitTestAlg3.h:39
EL::UnitTestAlg3::UnitTestAlg3
UnitTestAlg3(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
Definition
UnitTestAlg3.cxx:10
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Generated on
for ATLAS Offline Software by
1.17.0