The Gaudi Framework  master (37c0b60a)
JemallocProfileSvc.h
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 #ifndef JEMALLOC_JEMALLOCPROFILESVC_H
12 #define JEMALLOC_JEMALLOCPROFILESVC_H 1
13 
14 // Include files
16 #include <GaudiKernel/Service.h>
17 
28 class JemallocProfileSvc : public extends<Service, IIncidentListener> {
29 
30 public:
32  using extends::extends;
33 
35  StatusCode initialize() override;
36 
38  StatusCode finalize() override;
39 
40  // Handler for incident
41  void handle( const Incident& incident ) override;
42 
43 protected:
44  void handleBegin();
45  void handleEnd();
46  void startProfiling();
47  void stopProfiling();
48  void dumpProfile();
49 
50 private:
51  Gaudi::Property<int> m_nStartFromEvent{ this, "StartFromEventN", 0, "After what event we start profiling." };
53  this, "StartFromIncidents", {}, "Incidents that trigger profiling start" };
55  this, "StopAtEventN", 0,
56  "After what event we stop profiling. If 0 than we also profile finalization stage. Default = 0." };
58  this, "StopAtIncidents", {}, "Incidents that trigger profiling start" };
59  Gaudi::Property<int> m_dumpPeriod{ this, "DumpPeriod", 100, "Period for dumping head to a file. Default=100" };
60 
62  int m_eventNumber = 0;
63 
64  bool m_hasStartIncident = false;
65  bool m_hasStopIncident = false;
66 
68  bool m_profiling = false;
69 
72 };
73 #endif // JEMALLOC_JEMALLOCPROFILESVC_H
JemallocProfileSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Definition: JemallocProfileSvc.h:71
JemallocProfileSvc::m_hasStopIncident
bool m_hasStopIncident
Definition: JemallocProfileSvc.h:65
JemallocProfileSvc::m_nStartFromEvent
Gaudi::Property< int > m_nStartFromEvent
Definition: JemallocProfileSvc.h:51
JemallocProfileSvc
Definition: JemallocProfileSvc.h:28
JemallocProfileSvc::m_nStopAtEvent
Gaudi::Property< int > m_nStopAtEvent
Definition: JemallocProfileSvc.h:54
JemallocProfileSvc::handle
void handle(const Incident &incident) override
Definition: JemallocProfileSvc.cpp:88
JemallocProfileSvc::m_stopAtIncidents
Gaudi::Property< std::vector< std::string > > m_stopAtIncidents
Definition: JemallocProfileSvc.h:57
StatusCode
Definition: StatusCode.h:65
SmartIF< IIncidentSvc >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
JemallocProfileSvc::startProfiling
void startProfiling()
Utility method to start profiling with jemalloc.
Definition: JemallocProfileSvc.cpp:145
JemallocProfileSvc::handleBegin
void handleBegin()
Definition: JemallocProfileSvc.cpp:120
Service.h
JemallocProfileSvc::dumpProfile
void dumpProfile()
Utility method to dump profile with jemalloc.
Definition: JemallocProfileSvc.cpp:162
JemallocProfileSvc::handleEnd
void handleEnd()
Definition: JemallocProfileSvc.cpp:128
JemallocProfileSvc::m_profiling
bool m_profiling
Status of the profiling.
Definition: JemallocProfileSvc.h:68
JemallocProfileSvc::stopProfiling
void stopProfiling()
Utility method to stop profiling with jemalloc.
Definition: JemallocProfileSvc.cpp:154
JemallocProfileSvc::m_dumpPeriod
Gaudi::Property< int > m_dumpPeriod
Definition: JemallocProfileSvc.h:59
IIncidentListener.h
JemallocProfileSvc::m_hasStartIncident
bool m_hasStartIncident
Definition: JemallocProfileSvc.h:64
JemallocProfileSvc::finalize
StatusCode finalize() override
Finalizer.
Definition: JemallocProfileSvc.cpp:73
JemallocProfileSvc::m_eventNumber
int m_eventNumber
Current event number.
Definition: JemallocProfileSvc.h:62
Incident
Definition: Incident.h:27
JemallocProfileSvc::initialize
StatusCode initialize() override
Initializer.
Definition: JemallocProfileSvc.cpp:37
Gaudi::Property< int >
JemallocProfileSvc::m_startFromIncidents
Gaudi::Property< std::vector< std::string > > m_startFromIncidents
Definition: JemallocProfileSvc.h:52