Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
master (f31105fd)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
q
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
JemallocProfile.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include "
JemallocProfile.h
"
12
13
// including jemmalloc.h is difficult as the malloc signature is not exactly identical
14
// to the system one (issue with throw).
15
// We therefore declare mallctl here.
16
17
extern
"C"
{
18
int
mallctl
(
const
char
*
name
,
void
* oldp,
size_t
* oldlenp,
void
* newp,
size_t
newlen );
19
}
20
21
//-----------------------------------------------------------------------------
22
// Implementation file for class : JemallocProfile
23
//
24
// 2015-06-09 : Ben Couturier
25
//-----------------------------------------------------------------------------
26
27
// Declaration of the Algorithm Factory
28
DECLARE_COMPONENT
(
JemallocProfile
)
29
30
//=============================================================================
31
// Initialization
32
//=============================================================================
33
StatusCode
JemallocProfile
::initialize() {
34
StatusCode
sc =
Algorithm::initialize
();
// must be executed first
35
if
( sc.
isFailure
() )
return
sc;
// error printed already by Algorithm
36
37
if
( msgLevel(
MSG::DEBUG
) ) debug() <<
"==> Initialize"
<<
endmsg
;
38
bool
active =
true
;
39
int
res =
mallctl
(
"prof.active"
, NULL, NULL, &active,
sizeof
( active ) );
40
if
( res != 0 ) {
return
StatusCode::FAILURE
; }
41
return
StatusCode::SUCCESS
;
42
}
43
44
//=============================================================================
45
// Main execution
46
//=============================================================================
47
StatusCode
JemallocProfile::execute
() {
48
49
if
(
msgLevel
(
MSG::DEBUG
) ) debug() <<
"==> Execute"
<<
endmsg
;
50
51
// Increase event number
52
m_eventNumber
+= 1;
53
54
if
(
m_eventNumber
==
m_nStartFromEvent
) {
55
m_profiling
=
true
;
56
info() <<
"Starting Jemalloc profile at event "
<<
m_eventNumber
<<
endmsg
;
57
}
58
59
if
(
m_profiling
&& ( (
m_eventNumber
-
m_nStartFromEvent
) %
m_dumpPeriod
== 0 ) ) {
60
info() <<
"Jemalloc Dumping heap at event "
<<
m_eventNumber
<<
endmsg
;
61
mallctl
(
"prof.dump"
, NULL, NULL, NULL, 0 );
62
}
63
64
if
(
m_eventNumber
==
m_nStopAtEvent
) {
65
m_profiling
=
false
;
66
info() <<
"Stopping Jemalloc profile at event "
<<
m_eventNumber
<<
endmsg
;
67
mallctl
(
"prof.dump"
, NULL, NULL, NULL, 0 );
68
}
69
return
StatusCode::SUCCESS
;
70
}
MSG::DEBUG
@ DEBUG
Definition:
IMessageSvc.h:25
JemallocProfile
Definition:
JemallocProfile.h:26
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition:
Algorithm.h:178
JemallocProfile::m_eventNumber
int m_eventNumber
Definition:
JemallocProfile.h:42
JemallocProfile::m_nStopAtEvent
Gaudi::Property< int > m_nStopAtEvent
Definition:
JemallocProfile.h:36
CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition:
CommonMessaging.h:148
JemallocProfile::m_dumpPeriod
Gaudi::Property< int > m_dumpPeriod
Definition:
JemallocProfile.h:39
StatusCode
Definition:
StatusCode.h:65
JemallocProfile.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition:
MsgStream.h:202
StatusCode::isFailure
bool isFailure() const
Definition:
StatusCode.h:130
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
ConditionsStallTest.name
name
Definition:
ConditionsStallTest.py:77
JemallocProfile::m_profiling
bool m_profiling
Definition:
JemallocProfile.h:41
JemallocProfile::m_nStartFromEvent
Gaudi::Property< int > m_nStartFromEvent
Definition:
JemallocProfile.h:35
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
mallctl
int mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
JemallocProfile::execute
StatusCode execute() override
Algorithm execution.
Definition:
JemallocProfile.cpp:47
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:101
GaudiProfiling
src
component
jemalloc
JemallocProfile.cpp
Generated on Mon Apr 7 2025 16:26:25 for The Gaudi Framework by
1.8.18