ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonTests
src
PerfMonTestVectorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
7
8
#include "
Hit.h
"
9
#include "
PerfMonTestVectorAlg.h
"
10
#include <map>
11
#include <vector>
12
13
/* #define DEBUG_ME 1 */
14
15
using namespace
PerfMonTest
;
16
using
namespace::std;
17
18
typedef
vector<DHit>
HitContainer
;
19
20
21
StatusCode
VectorAlg::execute
(
const
EventContext&
/*ctx*/
)
22
{
23
ATH_MSG_DEBUG
(
"Executing "
);
24
HitContainer
vhit;
25
vhit.reserve(
m_2bReserved
.value());
26
int
vcap(vhit.capacity());
27
int
vold;
28
#ifdef DEBUG_ME
29
IHit
* p1(0);
30
IHit
* p2(0);
31
#endif
32
IHit
* p3(0);
33
cout <<
"initial capacity "
<< vcap << endl;
34
int
size
(
m_vectorSize
.value());
35
for
(
int
i(0); i<
size
; ++i) {
36
vold=vcap;
37
#ifdef DEBUG_ME
38
p1=p2;
39
p2=p3;
40
#endif
41
vhit.push_back(
DHit
(i,i,i));
42
vcap=vhit.capacity();
43
//I'm going to assume this is deliberate, as it is for a tutorial
44
//coverity[WRAPPER_ESCAPE]
45
p3=&vhit[i];
46
if
(
m_mapIt
.value())
m_mixMap
[i]=p3;
47
if
(vold != vcap) cout <<
"iteration "
<< i <<
" new capacity "
<< vcap <<endl;
48
#ifdef DEBUG_ME
49
if
(((
int
)p3-(
int
)p2) != ((
int
)p2-(
int
)p1)) cout <<
"iteration "
<< i <<
" new chunk @"
<< hex << p3 <<
" previous was @"
<< p2 << dec << endl;
50
#ifdef REALLY_DEBUG_ME
51
cout <<
"iteration "
<< i <<
" P3 @"
<< hex << p3 <<
" p2 @"
<< p2 <<
" p1 @"
<< p1 << dec <<
' '
<< (int)p3-(
int
)p2 <<
' '
<<(int)p2-(
int
)p1 <<endl;
52
#endif
53
#endif
54
}
55
56
return
StatusCode::SUCCESS;
57
}
AthMsgStreamMacros.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Hit.h
HitContainer
vector< DHit > HitContainer
Definition
PerfMonTestVectorAlg.cxx:18
PerfMonTestVectorAlg.h
size
size_t size() const
Number of registered mappings.
PerfMonTest::DHit
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:15
PerfMonTest::IHit
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:8
PerfMonTest::VectorAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
PerfMonTestVectorAlg.cxx:21
PerfMonTest::VectorAlg::m_vectorSize
Gaudi::Property< int > m_vectorSize
Property to setup the size of the Hit container.
Definition
PerfMonTestVectorAlg.h:27
PerfMonTest::VectorAlg::m_mixMap
std::map< int, IHit * > m_mixMap
Definition
PerfMonTestVectorAlg.h:32
PerfMonTest::VectorAlg::m_mapIt
Gaudi::Property< bool > m_mapIt
Property to introduce some fragmentation.
Definition
PerfMonTestVectorAlg.h:31
PerfMonTest::VectorAlg::m_2bReserved
Gaudi::Property< int > m_2bReserved
Property to setup the amount of elements to reserve.
Definition
PerfMonTestVectorAlg.h:29
vector
Definition
MultiHisto.h:13
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
Generated on
for ATLAS Offline Software by
1.17.0