ATLAS Offline Software
PerfMonTestLeakyAlg.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // PerfMonTestLeakyAlg.cxx
8 // Implementation file for class PerfMonTest::LeakyAlg
9 // Author: S.Binet<binet@cern.ch>
11 
12 
13 // STL includes
14 
15 // FrameWork includes
16 #include "Gaudi/Property.h"
17 
18 // PerfMonTests includes
19 #include "PerfMonTestLeakyAlg.h"
20 
21 using namespace PerfMonTest;
22 
24 // Public methods:
26 
27 // Constructors
29 LeakyAlg::LeakyAlg( const std::string& name,
30  ISvcLocator* pSvcLocator ) :
31  AthAlgorithm ( name, pSvcLocator )
32 {
33  //
34  // Property declaration
35  //
36  //declareProperty( "Property", m_nProperty );
37 
38  declareProperty( "LeakSize",
39  m_leakSize = 10,
40  "Size of 'Leak' objects to be leaked each event" );
41 
42  declareProperty( "NbrLeaks",
43  m_nbrLeaks = 1,
44  "Number of 'Leak' objects to be leaked each event" );
45 }
46 
47 // Destructor
50 {
51  ATH_MSG_DEBUG ( "Calling destructor" ) ;
52  // finally deleting our leaked objects...
53  for ( std::list<Leak*>::iterator i = m_leaks.begin(), iEnd = m_leaks.end();
54  i != iEnd;
55  ++i ) {
56  delete *i; *i = 0;
57  }
58 }
59 
60 // Athena Algorithm's Hooks
63 {
64  ATH_MSG_INFO ( "Initializing " << name() << "..." ) ;
65 
66  // Get pointer to StoreGateSvc and cache it :
68 
69  return StatusCode::SUCCESS;
70 }
71 
73 {
74  ATH_MSG_INFO ( "Finalizing " << name() << "..." ) ;
75  return StatusCode::SUCCESS;
76 }
77 
79 {
80  ATH_MSG_DEBUG ( "Executing " << name() << "..." ) ;
81 
82  if ( 0 == m_leakSize ) {
83  return StatusCode::SUCCESS;
84  }
85 
86  for ( int ileak = 0; ileak < m_nbrLeaks; ++ileak) {
87  Leak * leak = new Leak;
88  leak->m_data.reserve( m_leakSize );
89  for ( std::size_t i = 0; i != static_cast<std::size_t>(m_leakSize); ++i ) {
90  leak->m_data.push_back( i );
91  }
92 
93  m_leaks.push_back( leak );
94  }
95 
96  return StatusCode::SUCCESS;
97 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PerfMonTest::LeakyAlg::m_leaks
std::list< Leak * > m_leaks
container to hold the leaked objects
Definition: PerfMonTestLeakyAlg.h:70
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PerfMonTest::LeakyAlg::m_nbrLeaks
int m_nbrLeaks
nbr of Leak objects
Definition: PerfMonTestLeakyAlg.h:67
PerfMonTestLeakyAlg.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
PerfMonTest::LeakyAlg::finalize
virtual StatusCode finalize()
Definition: PerfMonTestLeakyAlg.cxx:72
lumiFormat.i
int i
Definition: lumiFormat.py:92
PerfMonTest::LeakyAlg::m_leakSize
int m_leakSize
Property to setup the size of the leak.
Definition: PerfMonTestLeakyAlg.h:60
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition: Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
PerfMonTest::LeakyAlg::Leak::m_data
std::vector< int > m_data
Definition: PerfMonTestLeakyAlg.h:63
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
PerfMonTest::LeakyAlg::initialize
virtual StatusCode initialize()
Definition: PerfMonTestLeakyAlg.cxx:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PerfMonTest::LeakyAlg::Leak
Definition: PerfMonTestLeakyAlg.h:62
PerfMonTest::LeakyAlg::LeakyAlg
LeakyAlg()
Default constructor:
PerfMonTest::LeakyAlg::execute
virtual StatusCode execute()
Definition: PerfMonTestLeakyAlg.cxx:78
PerfMonTest::LeakyAlg::~LeakyAlg
virtual ~LeakyAlg()
Destructor:
Definition: PerfMonTestLeakyAlg.cxx:49