ATLAS Offline Software
Loading...
Searching...
No Matches
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"
11
12/* #define DEBUG_ME 1 */
13
14using namespace PerfMonTest;
15using namespace::std;
16
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}
#define ATH_MSG_DEBUG(x)
vector< DHit > HitContainer
Gaudi::Property< int > m_vectorSize
Property to setup the size of the Hit container.
virtual StatusCode execute() override
std::map< int, IHit * > m_mixMap
Gaudi::Property< bool > m_mapIt
Property to introduce some fragmentation.
Gaudi::Property< int > m_2bReserved
Property to setup the amount of elements to reserve.
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.