The Gaudi Framework  v29r0 (ff2e7097)
JemallocProfileSvc.h
Go to the documentation of this file.
1 #ifndef JEMALLOC_JEMALLOCPROFILESVC_H
2 #define JEMALLOC_JEMALLOCPROFILESVC_H 1
3 
4 // Include files
6 #include "GaudiKernel/Service.h"
7 
18 class JemallocProfileSvc : public extends<Service, IIncidentListener>
19 {
20 
21 public:
23  using extends::extends;
24 
26  StatusCode initialize() override;
27 
29  StatusCode finalize() override;
30 
31  // Handler for incident
32  void handle( const Incident& incident ) override;
33 
35  ~JemallocProfileSvc() override = default;
36 
37 protected:
38  void handleBegin();
39  void handleEnd();
40  void startProfiling();
41  void stopProfiling();
42  void dumpProfile();
43 
44 private:
45  Gaudi::Property<int> m_nStartFromEvent{this, "StartFromEventN", 0, "After what event we start profiling."};
47  this, "StartFromIncidents", {}, "Incidents that trigger profiling start"};
49  this, "StopAtEventN", 0,
50  "After what event we stop profiling. If 0 than we also profile finalization stage. Default = 0."};
52  this, "StopAtIncidents", {}, "Incidents that trigger profiling start"};
53  Gaudi::Property<int> m_dumpPeriod{this, "DumpPeriod", 100, "Period for dumping head to a file. Default=100"};
54 
56  int m_eventNumber = 0;
57 
58  bool m_hasStartIncident = false;
59  bool m_hasStopIncident = false;
60 
62  bool m_profiling = false;
63 
66 };
67 #endif // JEMALLOC_JEMALLOCPROFILESVC_H
void startProfiling()
Utility method to start profiling with jemalloc.
Implementation of property with value of concrete type.
Definition: Property.h:319
StatusCode finalize() override
Finalizer.
Gaudi::Property< int > m_dumpPeriod
Service that enables the Jemalloc profiler on demand.
void handle(const Incident &incident) override
Destructor.
~JemallocProfileSvc() override=default
int m_eventNumber
Current event number.
StatusCode initialize() override
Initializer.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Gaudi::Property< int > m_nStopAtEvent
void stopProfiling()
Utility method to stop profiling with jemalloc.
Gaudi::Property< int > m_nStartFromEvent
Gaudi::Property< std::vector< std::string > > m_stopAtIncidents
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Base class for all Incidents (computing events).
Definition: Incident.h:17
void dumpProfile()
Utility method to dump profile with jemalloc.
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
Gaudi::Property< std::vector< std::string > > m_startFromIncidents
bool m_profiling
Status of the profiling.