12 #include "GaudiKernel/MsgStream.h"
13 #include "GaudiKernel/IIncidentSvc.h"
14 #include "GaudiKernel/DataIncident.h"
15 #include "GaudiKernel/Incident.h"
16 #include "GaudiKernel/System.h"
17 #include "RootCnv/RootPerfMonSvc.h"
20 #include "TDirectory.h"
26 using namespace Gaudi;
27 typedef const string&
CSTR;
29 #define S_OK StatusCode::SUCCESS
30 #define S_FAIL StatusCode::FAILURE
36 declareProperty(
"IOPerfStats", m_ioPerfStats);
37 declareProperty(
"Streams", m_setStreams);
38 declareProperty(
"BasketSize", m_basketSize);
39 declareProperty(
"BufferSize", m_bufferSize);
40 declareProperty(
"SplitLevel", m_splitLevel);
59 return error(
"Failed to initialize Service base class.");
63 return error(
"Unable to localize interface from service:IncidentSvc");
70 return error(
"Performance monitoring file IOPerfStats was not defined.");
72 TDirectory::TContext ctxt(
nullptr);
76 if (!(
m_perfTree =
new TTree(
"T",
"performance measurement")))
77 return error(
"Could not create tree.");
97 auto map =
new TMap();
98 map->Add(
new TObjString(
"streams"),
new TObjString(
m_setStreams.c_str()));
99 map->Add(
new TObjString(
"basket_size"),
new TObjString(
m_basketSize.c_str()));
100 map->Add(
new TObjString(
"buffer_size"),
new TObjString(
m_bufferSize.c_str()));
101 map->Add(
new TObjString(
"split_level"),
new TObjString(
m_splitLevel.c_str()));
102 map->Write(
"params", TObject::kSingleKey);
118 std::string t = incident.
type();
119 if ( !t.compare(IncidentType::BeginEvent) ) {
124 if ( !t.compare(
"CONNECTED_OUTPUT") ) {
133 auto map =
new TMap();
135 const char* fn =
i.c_str();
136 Long_t id, siz, flags, tim;
137 if ( 0 == gSystem->GetPathInfo(fn,&
id,&siz,&flags,&tim) ) {
138 ::sprintf(text,
"%ld",siz);
139 map->Add(
new TObjString(fn),
new TObjString(text));
143 map->Write(
"Outputs", TObject::kSingleKey);
void handle(const Incident &incident) override
IIncidentListener override: Inform that a new incident has occurred.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode stop() override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const std::string & type() const
Access to the incident type.
StatusCode initialize() override
Service overload: initialize the service.
StatusCode finalize() override
const std::string & source() const
Access to the source of the incident.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
virtual void record(EventType eventType)
StatusCode finalize() override
Service overload: Finalize the service.
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
const std::string & name() const override
Retrieve name of the service.
struct GAUDI_API map
Parametrisation class for map-like implementation.
This class is used for returning status codes from appropriate routines.
std::set< std::string > m_outputs
std::unique_ptr< TFile > m_perfFile
MsgStream & log() const
Helper: Use message streamer.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
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.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
std::unique_ptr< MsgStream > m_log
Message streamer.
Base class for all services.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper functions to set/get the application return code.