15 int mallctl(
const char*
name,
void* oldp,
size_t* oldlenp,
void* newp,
size_t newlen );
33 static const std::string serviceName =
"IncidentSvc";
36 error() <<
"Cannot retrieve " << serviceName <<
endmsg;
60 info() <<
"Stop profiling trigger was specified but no start. Defaulting to first events" <<
endmsg;
75 return base_class::finalize();
86 if ( IncidentType::BeginEvent == incident.
type() ) {
88 }
else if ( IncidentType::EndEvent == incident.
type() ) {
95 if ( startincident == incident.
type() ) {
96 info() <<
"Starting Jemalloc profile at incident " << incident.
type() <<
endmsg;
106 if ( stopincident == incident.
type() ) {
107 info() <<
"Stopping Jemalloc profile at incident " << incident.
type() <<
endmsg;
152 mallctl(
"prof.dump", NULL, NULL, NULL, 0 );
170 mallctl(
"prof.dump", NULL, NULL, NULL, 0 );
constexpr static const auto FAILURE
const std::string & type() const
Access to the incident type.
void startProfiling()
Utility method to start profiling with jemalloc.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode finalize() override
Finalizer.
Gaudi::Property< int > m_dumpPeriod
Service that enables the Jemalloc profiler on demand.
void handle(const Incident &incident) override
int mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
#define DECLARE_COMPONENT(type)
int m_eventNumber
Current event number.
StatusCode initialize() override
Initializer.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Gaudi::Property< int > m_nStopAtEvent
void stopProfiling()
Utility method to stop profiling with jemalloc.
constexpr static const auto SUCCESS
Gaudi::Property< int > m_nStartFromEvent
Gaudi::Property< std::vector< std::string > > m_stopAtIncidents
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Base class for all Incidents (computing events).
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
void dumpProfile()
Utility method to dump profile with jemalloc.
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to the incident service.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Gaudi::Property< std::vector< std::string > > m_startFromIncidents
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
bool m_profiling
Status of the profiling.