| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Gaudi::RootPerfMonSvc Class Reference

Description: More...

`#include <src/RootPerfMonSvc.h>`

Inheritance diagram for Gaudi::RootPerfMonSvc:
[legend]
Collaboration diagram for Gaudi::RootPerfMonSvc:
[legend]

## Public Member Functions
| RootPerfMonSvc (const std::string &name, ISvcLocator *svc)
| Standard constructor.
virtual | ~RootPerfMonSvc ()
| Standard destructor.
StatusCode | error (const std::string &msg)
| Standard way to print errors.
virtual StatusCode | initialize ()
| Service overload: initialize the service.
virtual StatusCode | finalize ()
| Service overload: Finalize the service.
virtual void | handle (const Incident &incident)
| IIncidentListener override: Inform that a new incident has occurred.
virtual StatusCode | stop ()
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
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.
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.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
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.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from IIncidentListener
| DeclareInterfaceID (IIncidentListener, 2, 0)
| InterfaceID.
Public Member Functions inherited from IInterface
virtual void * | i_cast (const InterfaceID &) const =0
| main cast function
virtual std::vector< std::string > | getInterfaceNames () const =0
| Returns a vector of strings containing the names of all the implemented interfaces.
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)=0
| Set the void** to the pointer to the requested interface of the instance.
virtual | ~IInterface ()
| Virtual destructor.

## Protected Types
enum | EventType { EVENT = 1, FSR = 2 }

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

## Protected Attributes
IIncidentSvc * | m_incidentSvc
| Reference to incident service.
std::string | m_ioPerfStats
| Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
MsgStream * | m_log
| Message streamer.
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.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.
Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvc > | m_msgsvc
| Pointer to the message service;.
std::auto_ptr< MsgStream > | m_msgStream
| The predefined message stream.
bool | m_streamWithService
| Flag to create a new MsgStream if it was created without the message service.

## Additional Inherited Members
Public Types inherited from Service
typedef Gaudi::PluginService::Factory2 < IService *, const std::string &, ISvcLocator * > | Factory
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.
typedef mpl::set1< iid > | ext_iids
| Extra interfaces.
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.

## 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.

{ EVENT = 1, FSR = 2 };

## Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 34 of file RootPerfMonSvc.cpp.

: Service( nam, svc), m_incidentSvc(0)
{
declareProperty("IOPerfStats", m_ioPerfStats);
declareProperty("Streams", m_setStreams);
declareProperty("BasketSize", m_basketSize);
declareProperty("BufferSize", m_bufferSize);
declareProperty("SplitLevel", m_splitLevel);
}

RootPerfMonSvc::~RootPerfMonSvc | ( |  | ) |
| virtual

Standard destructor.

Definition at line 45 of file RootPerfMonSvc.cpp.

{
}

## 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.

{
if ( m_log ) {
log() << MSG::ERROR << "Error: " << msg << endmsg;
return S_FAIL;
}
MsgStream m(msgSvc(),name());
m << MSG::ERROR << "Error: " << msg << endmsg;
return S_FAIL;
}

StatusCode RootPerfMonSvc::finalize | ( |  | ) |
| virtual

Service overload: Finalize the service.

Reimplemented from Service.

Definition at line 152 of file RootPerfMonSvc.cpp.

{
record(FSR);
log() << MSG::INFO;
deletePtr(m_log);
releasePtr(m_incidentSvc);
m_perfFile->Write();
m_perfFile->Close();
deletePtr(m_perfFile);
return Service::finalize();
}

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.

{
std::string t = incident.type();
if ( !t.compare(IncidentType::BeginEvent) ) {
m_eventNumber++;
record(EVENT);
return;
}
if ( !t.compare("CONNECTED_OUTPUT") ) {
m_outputs.insert(incident.source());
}
}

StatusCode RootPerfMonSvc::initialize | ( |  | ) |
| virtual

Service overload: initialize the service.

Reimplemented from Service.

Definition at line 60 of file RootPerfMonSvc.cpp.

{
string cname;
StatusCode status = Service::initialize();
if ( !status.isSuccess() )
return error("Failed to initialize Service base class.");
m_log = new MsgStream(msgSvc(),name());
if( !(status=service("IncidentSvc", m_incidentSvc)).isSuccess() )
return error("Unable to localize interface from service:IncidentSvc");
m_incidentSvc->addListener(this, IncidentType::BeginEvent, 1, false, false);
m_incidentSvc->addListener(this, "NEW_STREAM", 1, false, false);
m_incidentSvc->addListener(this, "CONNECTED_OUTPUT", 1, false, false);
if (m_ioPerfStats.empty())
return error("Performance monitoring file IOPerfStats was not defined.");
TDirectory::TContext ctxt(0);
if (!(m_perfFile = new TFile(m_ioPerfStats.c_str(),"RECREATE")))
return error("Could not create ROOT file.");
if (!(m_perfTree = new TTree("T", "performance measurement")))
return error("Could not create tree.");
m_perfTree->Branch("utime", &m_utime, "utime/l");
m_perfTree->Branch("stime", &m_stime, "stime/l");
m_perfTree->Branch("vsize", &m_vsize, "vsize/l");
m_perfTree->Branch("rss", &m_rss, "rss/L");
m_perfTree->Branch("time", &m_time, "time/L");
m_eventNumber = 0;
m_perfTree->Branch("event_number", &m_eventNumber, "event_number/L");
m_perfTree->Branch("event_type", &m_eventType, "event_type/I");
if (m_setStreams.empty())
m_setStreams = "undefined";
if (m_basketSize.empty())
m_basketSize = "undefined";
if (m_bufferSize.empty())
m_bufferSize = "undefined";
if (m_splitLevel.empty())
m_splitLevel = "undefined";
TMap *map = new TMap();
map->Add(new TObjString("streams"), new TObjString(m_setStreams.c_str()));
map->Add(new TObjString("basket_size"), new TObjString(m_basketSize.c_str()));
map->Add(new TObjString("buffer_size"), new TObjString(m_bufferSize.c_str()));
map->Add(new TObjString("split_level"), new TObjString(m_splitLevel.c_str()));
map->Write("params", TObject::kSingleKey);
return S_OK;
}

MsgStream& Gaudi::RootPerfMonSvc::log | ( |  | ) | const
| inline protected

Helper: Use message streamer.

Definition at line 74 of file RootPerfMonSvc.h.

{ return *m_log; }

void RootPerfMonSvc::record | ( | EventType | eventType | ) |
| protected virtual

Definition at line 110 of file RootPerfMonSvc.cpp.

{
SysProcStat data;
m_eventType = eventType;
m_utime = (ULong_t)data.utime;
m_stime = (ULong_t)data.stime;
m_vsize = (ULong_t)data.vsize;
m_rss = (Long_t)data.rss;
m_time = (Long_t)data.time;
m_perfTree->Fill();
}

StatusCode RootPerfMonSvc::stop | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 134 of file RootPerfMonSvc.cpp.

{
char text[64];
record(FSR);
TMap *map = new TMap();
for(set<string>::const_iterator i=m_outputs.begin(); i!=m_outputs.end();++i) {
const char* fn = (*i).c_str();
Long_t id, siz, flags, tim;
if ( 0 == gSystem->GetPathInfo(fn,&id,&siz,&flags,&tim) ) {
::sprintf(text,"%ld",siz);
map->Add(new TObjString(fn), new TObjString(text));
}
}
TDirectory::TContext ctxt(m_perfFile);
map->Write("Outputs", TObject::kSingleKey);
return S_OK;
}

## 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/RootCnv/RootCnv/RootPerfMonSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/RootCnv/src/RootPerfMonSvc.cpp