All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::RootPerfMonSvc Class Reference

Description: More...

#include <src/RootPerfMonSvc.h>

Inheritance diagram for Gaudi::RootPerfMonSvc:
Collaboration diagram for Gaudi::RootPerfMonSvc:

Public Member Functions

 RootPerfMonSvc (const std::string &name, ISvcLocator *svc)
 Standard constructor. More...
 
virtual ~RootPerfMonSvc ()
 Standard destructor. More...
 
StatusCode error (const std::string &msg)
 Standard way to print errors. More...
 
virtual StatusCode initialize ()
 Service overload: initialize the service. More...
 
virtual StatusCode finalize ()
 Service overload: Finalize the service. More...
 
virtual void handle (const Incident &incident)
 IIncidentListener override: Inform that a new incident has occurred. More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
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. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from IIncidentListener
 DeclareInterfaceID (IIncidentListener, 2, 0)
 InterfaceID. More...
 

Protected Types

enum  EventType { EVENT = 1, FSR = 2 }
 

Protected Member Functions

virtual void record (EventType eventType)
 
MsgStreamlog () const
 Helper: Use message streamer. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

IIncidentSvcm_incidentSvc
 Reference to incident service. More...
 
std::string m_ioPerfStats
 Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name. More...
 
MsgStreamm_log
 Message streamer. More...
 
std::string m_setStreams
 
std::string m_basketSize
 
std::string m_bufferSize
 
std::string m_splitLevel
 
TTree * m_perfTree
 
TFile * m_perfFile
 
std::set< std::string > m_outputs
 
Int_t m_eventType
 
ULong_t m_utime
 
ULong_t m_stime
 
ULong_t m_vsize
 
Long_t m_eventNumber
 
Long_t m_rss
 
Long_t m_time
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Additional Inherited Members

- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Description:

RootPerfMonSvc class implementation definition.

Author
Markus Frank, Ivan Valencik
Version
1.0
Date
20/12/2009

Definition at line 42 of file RootPerfMonSvc.h.

Member Enumeration Documentation

enum Gaudi::RootPerfMonSvc::EventType
protected
Enumerator
EVENT 
FSR 

Definition at line 68 of file RootPerfMonSvc.h.

Constructor & Destructor Documentation

RootPerfMonSvc::RootPerfMonSvc ( const std::string &  name,
ISvcLocator svc 
)

Standard constructor.

Definition at line 34 of file RootPerfMonSvc.cpp.

35  : Service( nam, svc), m_incidentSvc(0)
36 {
37  declareProperty("IOPerfStats", m_ioPerfStats);
38  declareProperty("Streams", m_setStreams);
39  declareProperty("BasketSize", m_basketSize);
40  declareProperty("BufferSize", m_bufferSize);
41  declareProperty("SplitLevel", m_splitLevel);
42 }
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
std::string m_splitLevel
IIncidentSvc * m_incidentSvc
Reference to incident service.
std::string m_setStreams
std::string m_bufferSize
std::string m_basketSize
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
Service(const std::string &name, ISvcLocator *svcloc)
Standard Constructor.
Definition: Service.cpp:393
RootPerfMonSvc::~RootPerfMonSvc ( )
virtual

Standard destructor.

Definition at line 45 of file RootPerfMonSvc.cpp.

45  {
46 }

Member Function Documentation

StatusCode RootPerfMonSvc::error ( const std::string &  msg)

Standard way to print errors.

after the printout an exception is thrown.

Parameters
msg[IN] Message string to be printed.
Returns
Status code returning failure.

Definition at line 49 of file RootPerfMonSvc.cpp.

49  {
50  if ( m_log ) {
51  log() << MSG::ERROR << "Error: " << msg << endmsg;
52  return S_FAIL;
53  }
54  MsgStream m(msgSvc(),name());
55  m << MSG::ERROR << "Error: " << msg << endmsg;
56  return S_FAIL;
57 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream * m_log
Message streamer.
#define S_FAIL
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MsgStream & log() const
Helper: Use message streamer.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootPerfMonSvc::finalize ( )
virtual

Service overload: Finalize the service.

Reimplemented from Service.

Definition at line 152 of file RootPerfMonSvc.cpp.

152  {
153  record(FSR);
154  log() << MSG::INFO;
155  deletePtr(m_log);
156  releasePtr(m_incidentSvc);
157 
158  m_perfFile->Write();
159  m_perfFile->Close();
160  deletePtr(m_perfFile);
161 
162  return Service::finalize();
163 }
virtual void record(EventType eventType)
MsgStream * m_log
Message streamer.
IIncidentSvc * m_incidentSvc
Reference to incident service.
MsgStream & log() const
Helper: Use message streamer.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
void RootPerfMonSvc::handle ( const Incident incident)
virtual

IIncidentListener override: Inform that a new incident has occurred.

Implements IIncidentListener.

Definition at line 121 of file RootPerfMonSvc.cpp.

121  {
122  std::string t = incident.type();
123  if ( !t.compare(IncidentType::BeginEvent) ) {
124  m_eventNumber++;
125  record(EVENT);
126  return;
127  }
128  if ( !t.compare("CONNECTED_OUTPUT") ) {
129  m_outputs.insert(incident.source());
130  }
131 }
const std::string BeginEvent
Processing of a new event has started.
Definition: Incident.h:60
const std::string & type() const
Access to the incident type.
Definition: Incident.h:34
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:40
virtual void record(EventType eventType)
std::set< std::string > m_outputs
StatusCode RootPerfMonSvc::initialize ( )
virtual

Service overload: initialize the service.

Reimplemented from Service.

Definition at line 60 of file RootPerfMonSvc.cpp.

60  {
61  string cname;
63  if ( !status.isSuccess() )
64  return error("Failed to initialize Service base class.");
65  m_log = new MsgStream(msgSvc(),name());
66  if( !(status=service("IncidentSvc", m_incidentSvc)).isSuccess() )
67  return error("Unable to localize interface from service:IncidentSvc");
68 
69  m_incidentSvc->addListener(this, IncidentType::BeginEvent, 1, false, false);
70  m_incidentSvc->addListener(this, "NEW_STREAM", 1, false, false);
71  m_incidentSvc->addListener(this, "CONNECTED_OUTPUT", 1, false, false);
72 
73  if (m_ioPerfStats.empty())
74  return error("Performance monitoring file IOPerfStats was not defined.");
75 
76  TDirectory::TContext ctxt(0);
77  if (!(m_perfFile = new TFile(m_ioPerfStats.c_str(),"RECREATE")))
78  return error("Could not create ROOT file.");
79 
80  if (!(m_perfTree = new TTree("T", "performance measurement")))
81  return error("Could not create tree.");
82 
83  m_perfTree->Branch("utime", &m_utime, "utime/l");
84  m_perfTree->Branch("stime", &m_stime, "stime/l");
85  m_perfTree->Branch("vsize", &m_vsize, "vsize/l");
86  m_perfTree->Branch("rss", &m_rss, "rss/L");
87  m_perfTree->Branch("time", &m_time, "time/L");
88  m_eventNumber = 0;
89  m_perfTree->Branch("event_number", &m_eventNumber, "event_number/L");
90  m_perfTree->Branch("event_type", &m_eventType, "event_type/I");
91 
92  if (m_setStreams.empty())
93  m_setStreams = "undefined";
94  if (m_basketSize.empty())
95  m_basketSize = "undefined";
96  if (m_bufferSize.empty())
97  m_bufferSize = "undefined";
98  if (m_splitLevel.empty())
99  m_splitLevel = "undefined";
100 
101  TMap *map = new TMap();
102  map->Add(new TObjString("streams"), new TObjString(m_setStreams.c_str()));
103  map->Add(new TObjString("basket_size"), new TObjString(m_basketSize.c_str()));
104  map->Add(new TObjString("buffer_size"), new TObjString(m_bufferSize.c_str()));
105  map->Add(new TObjString("split_level"), new TObjString(m_splitLevel.c_str()));
106  map->Write("params", TObject::kSingleKey);
107  return S_OK;
108 }
const std::string BeginEvent
Processing of a new event has started.
Definition: Incident.h:60
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
#define S_OK
MsgStream * m_log
Message streamer.
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
struct GAUDI_API map
Parametrisation class for map-like implementation.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_splitLevel
IIncidentSvc * m_incidentSvc
Reference to incident service.
std::string m_setStreams
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
std::string m_bufferSize
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
std::string m_basketSize
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.
Definition: Service.h:142
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream& Gaudi::RootPerfMonSvc::log ( ) const
inlineprotected

Helper: Use message streamer.

Definition at line 74 of file RootPerfMonSvc.h.

74 { return *m_log; }
MsgStream * m_log
Message streamer.
void RootPerfMonSvc::record ( EventType  eventType)
protectedvirtual

Definition at line 110 of file RootPerfMonSvc.cpp.

110  {
111  SysProcStat data;
112  m_eventType = eventType;
113  m_utime = (ULong_t)data.utime;
114  m_stime = (ULong_t)data.stime;
115  m_vsize = (ULong_t)data.vsize;
116  m_rss = (Long_t)data.rss;
117  m_time = (Long_t)data.time;
118  m_perfTree->Fill();
119 }
long unsigned stime
Definition: SysProcStat.h:17
long unsigned vsize
Definition: SysProcStat.h:17
long unsigned utime
Definition: SysProcStat.h:17
StatusCode RootPerfMonSvc::stop ( )
virtual

Stop (from RUNNING to INITIALIZED).

Reimplemented from Service.

Definition at line 134 of file RootPerfMonSvc.cpp.

134  {
135  char text[64];
136  record(FSR);
137  TMap *map = new TMap();
138  for(set<string>::const_iterator i=m_outputs.begin(); i!=m_outputs.end();++i) {
139  const char* fn = (*i).c_str();
140  Long_t id, siz, flags, tim;
141  if ( 0 == gSystem->GetPathInfo(fn,&id,&siz,&flags,&tim) ) {
142  ::sprintf(text,"%ld",siz);
143  map->Add(new TObjString(fn), new TObjString(text));
144  }
145  }
146  TDirectory::TContext ctxt(m_perfFile);
147  map->Write("Outputs", TObject::kSingleKey);
148  return S_OK;
149 }
virtual void record(EventType eventType)
#define S_OK
struct GAUDI_API map
Parametrisation class for map-like implementation.
std::set< std::string > m_outputs
list i
Definition: ana.py:128

Member Data Documentation

std::string Gaudi::RootPerfMonSvc::m_basketSize
protected

Definition at line 53 of file RootPerfMonSvc.h.

std::string Gaudi::RootPerfMonSvc::m_bufferSize
protected

Definition at line 54 of file RootPerfMonSvc.h.

Long_t Gaudi::RootPerfMonSvc::m_eventNumber
protected

Definition at line 65 of file RootPerfMonSvc.h.

Int_t Gaudi::RootPerfMonSvc::m_eventType
protected

Definition at line 63 of file RootPerfMonSvc.h.

IIncidentSvc* Gaudi::RootPerfMonSvc::m_incidentSvc
protected

Reference to incident service.

Definition at line 46 of file RootPerfMonSvc.h.

std::string Gaudi::RootPerfMonSvc::m_ioPerfStats
protected

Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.

Definition at line 48 of file RootPerfMonSvc.h.

MsgStream* Gaudi::RootPerfMonSvc::m_log
protected

Message streamer.

Definition at line 50 of file RootPerfMonSvc.h.

std::set<std::string> Gaudi::RootPerfMonSvc::m_outputs
protected

Definition at line 61 of file RootPerfMonSvc.h.

TFile* Gaudi::RootPerfMonSvc::m_perfFile
protected

Definition at line 59 of file RootPerfMonSvc.h.

TTree* Gaudi::RootPerfMonSvc::m_perfTree
protected

Definition at line 57 of file RootPerfMonSvc.h.

Long_t Gaudi::RootPerfMonSvc::m_rss
protected

Definition at line 65 of file RootPerfMonSvc.h.

std::string Gaudi::RootPerfMonSvc::m_setStreams
protected

Definition at line 52 of file RootPerfMonSvc.h.

std::string Gaudi::RootPerfMonSvc::m_splitLevel
protected

Definition at line 55 of file RootPerfMonSvc.h.

ULong_t Gaudi::RootPerfMonSvc::m_stime
protected

Definition at line 64 of file RootPerfMonSvc.h.

Long_t Gaudi::RootPerfMonSvc::m_time
protected

Definition at line 65 of file RootPerfMonSvc.h.

ULong_t Gaudi::RootPerfMonSvc::m_utime
protected

Definition at line 64 of file RootPerfMonSvc.h.

ULong_t Gaudi::RootPerfMonSvc::m_vsize
protected

Definition at line 64 of file RootPerfMonSvc.h.


The documentation for this class was generated from the following files: