ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonTests
src
PerfMonTestPolyVectorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <map>
6
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
7
#include "
AthContainers/DataVector.h
"
8
9
#include "
Hit.h
"
10
#include "
PerfMonTestPolyVectorAlg.h
"
11
12
/* #define DEBUG_ME 1 */
13
14
using namespace
PerfMonTest
;
15
16
typedef
DataVector<IHit>
HitPtrContainer
;
17
18
19
StatusCode
PolyVectorAlg::execute
(
const
EventContext&
/*ctx*/
)
20
{
21
ATH_MSG_DEBUG
(
"Executing "
);
22
HitPtrContainer
vptr;
23
vptr.
reserve
(
m_2bReserved
.value());
24
int
vcap(vptr.
capacity
());
25
int
vold;
26
#ifdef DEBUG_ME
27
IHit
* p1(0);
28
IHit
* p2(0);
29
#endif
30
IHit
* p3(0);
31
std::cout <<
"initial capacity "
<< vcap << std::endl;
32
int
size
(
m_vectorSize
.value());
33
for
(
int
i(0); i<
size
; ++i) {
34
vold=vcap;
35
#ifdef DEBUG_ME
36
p1=p2;
37
p2=p3;
38
#endif
39
p3=(i %
m_mixture
.value()) ?
40
(
IHit
*)
new
FHit
(i, i, i):
41
(
IHit
*)
new
DHit
(i, i, i);
42
vptr.
push_back
(p3);
43
vcap=vptr.
capacity
();
44
if
(
m_mapIt
.value())
m_mixMap
[i]=p3;
45
if
(vold != vcap) std::cout <<
"iteration "
<< i <<
" new capacity "
<< vcap <<std::endl;
46
#ifdef DEBUG_ME
47
if
(((
int
)p3-(
int
)p2) != ((
int
)p2-(
int
)p1)) cout <<
"iteration "
<< i <<
" new chunk @"
<< hex << p3 <<
" previous was @"
<< p2 << dec << endl;
48
#ifdef REALLY_DEBUG_ME
49
std::cout <<
"iteration "
<< i <<
" P3 @"
<< hex << p3 <<
" p2 @"
<< p2 <<
" p1 @"
<< p1 << dec <<
' '
<< (int)p3-(
int
)p2 <<
' '
<<(int)p2-(
int
)p1 <<std::endl;
50
#endif
51
#endif
52
}
53
54
return
StatusCode::SUCCESS;
55
}
AthMsgStreamMacros.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Hit.h
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
HitPtrContainer
DataVector< IHit > HitPtrContainer
Definition
PerfMonTestPolyVectorAlg.cxx:16
PerfMonTestPolyVectorAlg.h
size
size_t size() const
Number of registered mappings.
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::capacity
size_type capacity() const noexcept
Returns the total number of elements that the collection can hold before needing to allocate more mem...
PerfMonTest::DHit
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:15
PerfMonTest::FHit
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:30
PerfMonTest::IHit
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:8
PerfMonTest::PolyVectorAlg::m_mixMap
std::map< int, IHit * > m_mixMap
Definition
PerfMonTestPolyVectorAlg.h:34
PerfMonTest::PolyVectorAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
PerfMonTestPolyVectorAlg.cxx:19
PerfMonTest::PolyVectorAlg::m_vectorSize
Gaudi::Property< int > m_vectorSize
Property to setup the size of the Hit container.
Definition
PerfMonTestPolyVectorAlg.h:27
PerfMonTest::PolyVectorAlg::m_mapIt
Gaudi::Property< bool > m_mapIt
Property to introduce some fragmentation.
Definition
PerfMonTestPolyVectorAlg.h:33
PerfMonTest::PolyVectorAlg::m_2bReserved
Gaudi::Property< int > m_2bReserved
Property to setup the amount of elements to reserve.
Definition
PerfMonTestPolyVectorAlg.h:29
PerfMonTest::PolyVectorAlg::m_mixture
Gaudi::Property< int > m_mixture
Property to set DHIT/FHIT ratio.
Definition
PerfMonTestPolyVectorAlg.h:31
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