ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonTests
src
PerfMonTestPolyVectorAlgWithArenas.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 "
AthenaBaseComps/AthMsgStreamMacros.h
"
6
#include "
AthContainers/DataVector.h
"
7
#include "
AthAllocators/DataPool.h
"
/* NEW */
8
9
#include "
Hit.h
"
10
#include "
PerfMonTestPolyVectorAlgWithArenas.h
"
11
/* #define DEBUG_ME 1 */
12
13
using namespace
PerfMonTest
;
14
15
typedef
DataVector<IHit>
HitPtrContainer
;
16
17
18
StatusCode
PolyVectorAlgWithArenas::execute
(
const
EventContext&
/*ctx*/
)
19
{
20
DataPool<DHit>
dhitPool;
21
DataPool<FHit>
fhitPool;
22
ATH_MSG_DEBUG
(
"Executing "
);
23
HitPtrContainer
vptr(
SG::VIEW_ELEMENTS
);
//<<< NEW
24
vptr.
reserve
(
m_2bReserved
.value());
25
int
vcap(vptr.
capacity
());
26
int
vold;
27
#ifdef DEBUG_ME
28
IHit
* p1(0);
29
IHit
* p2(0);
30
#endif
31
IHit
* p3(0);
32
std::cout <<
"initial capacity "
<< vcap << std::endl;
33
int
size
(
m_vectorSize
.value());
34
for
(
int
i(0); i<
size
; ++i) {
35
vold=vcap;
36
#ifdef DEBUG_ME
37
p1=p2;
38
p2=p3;
39
#endif
40
p3=(i %
m_mixture
.value()) ?
41
(
IHit
*)
new
(fhitPool.
nextElementPtr
())
FHit
(i, i, i):
42
(
IHit
*)
new
(dhitPool.
nextElementPtr
())
DHit
(i, i, i);
//<<< NEW
43
vptr.
push_back
(p3);
44
vcap=vptr.
capacity
();
45
if
(
m_mapIt
.value())
m_mixMap
[i]=p3;
46
if
(vold != vcap) std::cout <<
"iteration "
<< i <<
" new capacity "
<< vcap <<std::endl;
47
#ifdef DEBUG_ME
48
if
(((
int
)p3-(
int
)p2) != ((
int
)p2-(
int
)p1)) std::cout <<
"iteration "
<< i <<
" new chunk @"
<< hex << p3 <<
" previous was @"
<< p2 << dec << std::endl;
49
#ifdef REALLY_DEBUG_ME
50
std::cout <<
"iteration "
<< i <<
" P3 @"
<< hex << p3 <<
" p2 @"
<< p2 <<
" p1 @"
<< p1 << dec <<
' '
<< (int)p3-(
int
)p2 <<
' '
<<(int)p2-(
int
)p1 <<std::endl;
51
#endif
52
#endif
53
}
54
55
return
StatusCode::SUCCESS;
56
}
AthMsgStreamMacros.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Hit.h
DataPool.h
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
PerfMonTestPolyVectorAlgWithArenas.h
HitPtrContainer
DataVector< IHit > HitPtrContainer
Definition
PerfMonTestPolyVectorAlg.cxx:16
size
size_t size() const
Number of registered mappings.
DataPool
a typed memory pool that saves time spent allocation small object.
Definition
DataPool.h:63
DataPool::nextElementPtr
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
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::PolyVectorAlgWithArenas::m_mixMap
std::map< int, IHit * > m_mixMap
Definition
PerfMonTestPolyVectorAlgWithArenas.h:37
PerfMonTest::PolyVectorAlgWithArenas::m_2bReserved
Gaudi::Property< int > m_2bReserved
Property to setup the amount of elements to reserve.
Definition
PerfMonTestPolyVectorAlgWithArenas.h:32
PerfMonTest::PolyVectorAlgWithArenas::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
PerfMonTestPolyVectorAlgWithArenas.cxx:18
PerfMonTest::PolyVectorAlgWithArenas::m_mixture
Gaudi::Property< int > m_mixture
Property to set DHIT/FHIT ratio.
Definition
PerfMonTestPolyVectorAlgWithArenas.h:34
PerfMonTest::PolyVectorAlgWithArenas::m_mapIt
Gaudi::Property< bool > m_mapIt
Property to introduce some fragmentation.
Definition
PerfMonTestPolyVectorAlgWithArenas.h:36
PerfMonTest::PolyVectorAlgWithArenas::m_vectorSize
Gaudi::Property< int > m_vectorSize
Property to setup the size of the Hit container.
Definition
PerfMonTestPolyVectorAlgWithArenas.h:30
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition
Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
Generated on
for ATLAS Offline Software by
1.17.0