ATLAS Offline Software
Control
PerformanceMonitoring
PerfMonTests
src
PerfMonTestVectorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <map>
6
#include <vector>
7
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
8
9
#include "
Hit.h
"
10
#include "
PerfMonTestVectorAlg.h
"
11
12
/* #define DEBUG_ME 1 */
13
14
using namespace
PerfMonTest
;
15
using
namespace::std;
16
17
typedef
vector<DHit>
HitContainer
;
18
20
// Public methods:
22
23
// Constructors
25
VectorAlg::VectorAlg
(
const
std::string&
name
,
26
ISvcLocator* pSvcLocator ) :
27
AthAlgorithm
(
name
, pSvcLocator ),
28
m_vectorSize(1024*1024), m_2bReserved(m_vectorSize), m_mapIt(false)
29
{
30
declareProperty
(
"VectorSize"
,
m_vectorSize
,
"the size of the Hit container"
);
31
declareProperty
(
"ToBeReserved"
,
m_2bReserved
,
"the number of element to be reserved"
);
32
declareProperty
(
"MapIt"
,
m_mapIt
,
"add current hit to a map"
);
33
}
34
35
// Destructor
37
VectorAlg::~VectorAlg
()
38
{
39
ATH_MSG_DEBUG
(
"Calling destructor"
);
40
}
41
42
// Athena Algorithm's Hooks
44
StatusCode
VectorAlg::initialize
()
45
{
46
ATH_MSG_INFO
(
"Initializing "
);
47
return
StatusCode::SUCCESS;
48
}
49
50
StatusCode
VectorAlg::finalize
()
51
{
52
ATH_MSG_INFO
(
"Finalizing "
);
53
return
StatusCode::SUCCESS;
54
}
55
56
StatusCode
VectorAlg::execute
()
57
{
58
ATH_MSG_DEBUG
(
"Executing "
);
59
HitContainer
vhit;
60
vhit.reserve(
m_2bReserved
.value());
61
int
vcap(vhit.capacity());
62
int
vold;
63
#ifdef DEBUG_ME
64
IHit
*
p1
(0);
65
IHit
*
p2
(0);
66
#endif
67
IHit
*
p3
(0);
68
cout <<
"initial capacity "
<< vcap << endl;
69
int
size
(
m_vectorSize
.value());
70
for
(
int
i
(0);
i
<
size
; ++
i
) {
71
vold=vcap;
72
#ifdef DEBUG_ME
73
p1
=
p2
;
74
p2
=
p3
;
75
#endif
76
vhit.push_back(
DHit
(
i
,
i
,
i
));
77
vcap=vhit.capacity();
78
p3
=&vhit[
i
];
79
if
(
m_mapIt
.value())
m_mixMap
[
i
]=
p3
;
80
if
(vold != vcap) cout <<
"iteration "
<<
i
<<
" new capacity "
<< vcap <<endl;
81
#ifdef DEBUG_ME
82
if
(((
int
)
p3
-(
int
)
p2
) != ((
int
)
p2
-(
int
)
p1
)) cout <<
"iteration "
<<
i
<<
" new chunk @"
<< hex <<
p3
<<
" previous was @"
<<
p2
<< dec << endl;
83
#ifdef REALLY_DEBUG_ME
84
cout <<
"iteration "
<<
i
<<
" P3 @"
<< hex <<
p3
<<
" p2 @"
<<
p2
<<
" p1 @"
<<
p1
<< dec <<
' '
<< (
int
)
p3
-(
int
)
p2
<<
' '
<<(
int
)
p2
-(
int
)
p1
<<endl;
85
#endif
86
#endif
87
}
88
89
return
StatusCode::SUCCESS;
90
}
PerfMonTest::VectorAlg::m_mapIt
BooleanProperty m_mapIt
Property to introduce some fragmentation.
Definition:
PerfMonTestVectorAlg.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
AthMsgStreamMacros.h
CaloCellPos2Ntuple.int
int
Definition:
CaloCellPos2Ntuple.py:24
PerfMonTest::VectorAlg::execute
virtual StatusCode execute()
Definition:
PerfMonTestVectorAlg.cxx:56
PerfMonTest::DHit
Definition:
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:15
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
TRTCalib_cfilter.p1
p1
Definition:
TRTCalib_cfilter.py:130
HitContainer
vector< DHit > HitContainer
Definition:
PerfMonTestVectorAlg.cxx:17
PerfMonTest::IHit
Definition:
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:8
python.setupRTTAlg.size
int size
Definition:
setupRTTAlg.py:39
PerfMonTest::VectorAlg::m_vectorSize
IntegerProperty m_vectorSize
Property to setup the size of the Hit container.
Definition:
PerfMonTestVectorAlg.h:40
PerfMonTest::VectorAlg::~VectorAlg
virtual ~VectorAlg()
Destructor:
Definition:
PerfMonTestVectorAlg.cxx:37
TRTCalib_cfilter.p2
p2
Definition:
TRTCalib_cfilter.py:131
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
vector
Definition:
MultiHisto.h:13
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
PerfMonTestVectorAlg.h
PerfMonTest::VectorAlg::finalize
virtual StatusCode finalize()
Definition:
PerfMonTestVectorAlg.cxx:50
Hit.h
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition:
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
PerfMonTest::VectorAlg::VectorAlg
VectorAlg()
no implementation
AthAlgorithm
Definition:
AthAlgorithm.h:47
PerfMonTest::VectorAlg::initialize
virtual StatusCode initialize()
Definition:
PerfMonTestVectorAlg.cxx:44
PerfMonTest::VectorAlg::m_mixMap
std::map< int, IHit * > m_mixMap
Definition:
PerfMonTestVectorAlg.h:45
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
PerfMonTest::VectorAlg::m_2bReserved
IntegerProperty m_2bReserved
Property to setup the amount of elements to reserve.
Definition:
PerfMonTestVectorAlg.h:42
TRTCalib_cfilter.p3
p3
Definition:
TRTCalib_cfilter.py:132
Generated on Sun Dec 22 2024 21:16:06 for ATLAS Offline Software by
1.8.18