The Gaudi Framework  v30r3 (a5ef0a68)
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 
34 protected:
35  void handleBegin();
36  void handleEnd();
37  void startProfiling();
38  void stopProfiling();
39  void dumpProfile();
40 
41 private:
42  Gaudi::Property<int> m_nStartFromEvent{this, "StartFromEventN", 0, "After what event we start profiling."};
44  this, "StartFromIncidents", {}, "Incidents that trigger profiling start"};
46  this, "StopAtEventN", 0,
47  "After what event we stop profiling. If 0 than we also profile finalization stage. Default = 0."};
49  this, "StopAtIncidents", {}, "Incidents that trigger profiling start"};
50  Gaudi::Property<int> m_dumpPeriod{this, "DumpPeriod", 100, "Period for dumping head to a file. Default=100"};
51 
53  int m_eventNumber = 0;
54 
55  bool m_hasStartIncident = false;
56  bool m_hasStopIncident = false;
57 
59  bool m_profiling = false;
60 
63 };
64 #endif // JEMALLOC_JEMALLOCPROFILESVC_H
void startProfiling()
Utility method to start profiling with jemalloc.
Implementation of property with value of concrete type.
Definition: Property.h:381
StatusCode finalize() override
Finalizer.
Gaudi::Property< int > m_dumpPeriod
Service that enables the Jemalloc profiler on demand.
void handle(const Incident &incident) override
int m_eventNumber
Current event number.
StatusCode initialize() override
Initializer.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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.