ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonTests
src
PerfMonTestMallocAlg.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
// PerfMonTestMallocAlg.cxx
6
// Implementation file for class PerfMonTest::MallocAlg
7
// Author: S.Binet<binet@cern.ch>
9
10
11
// STL includes
12
#include <vector>
13
14
// FrameWork includes
15
#include "Gaudi/Property.h"
16
17
// CLHEP includes
18
#include "CLHEP/Units/SystemOfUnits.h"
19
#include "CLHEP/Random/RandGauss.h"
20
21
// PerfMonTests includes
22
#include "
PerfMonTestMallocAlg.h
"
23
24
using namespace
PerfMonTest
;
25
26
27
StatusCode
MallocAlg::execute
(
const
EventContext&
/*ctx*/
)
28
{
29
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
) ;
30
31
m_currentEvtNbr
++;
32
33
//typedef int ElemType;
34
typedef
float
ElemType;
35
36
if
(
m_currentEvtNbr
>=
m_evtNbr
) {
37
const
std::size_t
nmax
= 1024*1024;
38
39
if
(
m_useStdVector
) {
40
std::vector<ElemType> c1_array(
nmax
);
41
for
( std::size_t i = 0; i!=
nmax
; ++i ) {
42
c1_array[i] = i;
43
}
44
45
if
(
m_currentEvtNbr
>= 2*
m_evtNbr
) {
46
std::vector<ElemType> c2_array(
nmax
);
47
for
( std::size_t i = 0; i!=
nmax
; ++i ) {
48
c2_array[i] = -1*
static_cast<
int
>
(i);
49
}
50
}
51
52
}
else
{
53
ElemType c1_array[
nmax
];
54
for
( std::size_t i = 0; i!=
nmax
; ++i ) {
55
c1_array[i] = i;
56
}
57
isUsed
(&c1_array);
58
59
if
(
m_currentEvtNbr
>= 2*
m_evtNbr
) {
60
ElemType c2_array[
nmax
];
61
for
( std::size_t i = 0; i!=
nmax
; ++i ) {
62
c2_array[i] = -1*
static_cast<
int
>
(i);
63
}
64
// dummy stuff to silence gcc-warning.
65
if
(c2_array[0] > c1_array[0]) {
66
c2_array[0] = c1_array[0];
67
}
68
}
69
}
70
}
71
72
return
StatusCode::SUCCESS;
73
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PerfMonTestMallocAlg.h
nmax
const int nmax(200)
PerfMonTest::MallocAlg::isUsed
virtual void isUsed(const void *)
Definition
PerfMonTestMallocAlg.h:36
PerfMonTest::MallocAlg::m_currentEvtNbr
unsigned int m_currentEvtNbr
current event number
Definition
PerfMonTestMallocAlg.h:42
PerfMonTest::MallocAlg::m_useStdVector
Gaudi::Property< bool > m_useStdVector
switch between using a C-array and a std::vector
Definition
PerfMonTestMallocAlg.h:45
PerfMonTest::MallocAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
PerfMonTestMallocAlg.cxx:27
PerfMonTest::MallocAlg::m_evtNbr
Gaudi::Property< unsigned int > m_evtNbr
event number at which to actually do stuff
Definition
PerfMonTestMallocAlg.h:39
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