ATLAS Offline Software
PerfMonTestVectorAlg.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 <vector>
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 
19 
21 {
22  ATH_MSG_DEBUG("Executing ");
23  HitContainer vhit;
24  vhit.reserve(m_2bReserved.value());
25  int vcap(vhit.capacity());
26  int vold;
27 #ifdef DEBUG_ME
28  IHit* p1(0);
29  IHit* p2(0);
30 #endif
31  IHit* p3(0);
32  cout << "initial capacity " << vcap << 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  vhit.push_back(DHit(i,i,i));
41  vcap=vhit.capacity();
42  p3=&vhit[i];
43  if (m_mapIt.value()) m_mixMap[i]=p3;
44  if (vold != vcap) cout << "iteration " << i << " new capacity " << vcap <<endl;
45 #ifdef DEBUG_ME
46  if (((int)p3-(int)p2) != ((int)p2-(int)p1)) cout << "iteration " << i << " new chunk @" << hex << p3 << " previous was @" << p2 << dec << endl;
47 #ifdef REALLY_DEBUG_ME
48  cout << "iteration " << i << " P3 @" << hex << p3 << " p2 @" << p2 << " p1 @" << p1 << dec << ' ' << (int)p3-(int)p2 << ' ' <<(int)p2-(int)p1 <<endl;
49 #endif
50 #endif
51  }
52 
53  return StatusCode::SUCCESS;
54 }
PerfMonTest::VectorAlg::execute
virtual StatusCode execute() override
Definition: PerfMonTestVectorAlg.cxx:20
AthMsgStreamMacros.h
PerfMonTest::DHit
Definition: Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:15
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
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
lumiFormat.i
int i
Definition: lumiFormat.py:85
PerfMonTest::VectorAlg::m_2bReserved
Gaudi::Property< int > m_2bReserved
Property to setup the amount of elements to reserve.
Definition: PerfMonTestVectorAlg.h:29
PerfMonTest::VectorAlg::m_vectorSize
Gaudi::Property< int > m_vectorSize
Property to setup the size of the Hit container.
Definition: PerfMonTestVectorAlg.h:27
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
PerfMonTestVectorAlg.h
Hit.h
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition: Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
PerfMonTest::VectorAlg::m_mixMap
std::map< int, IHit * > m_mixMap
Definition: PerfMonTestVectorAlg.h:32
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
TRTCalib_cfilter.p3
p3
Definition: TRTCalib_cfilter.py:132
PerfMonTest::VectorAlg::m_mapIt
Gaudi::Property< bool > m_mapIt
Property to introduce some fragmentation.
Definition: PerfMonTestVectorAlg.h:31