Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
StoreSnifferAlg Class Reference

Small algorithm, which traverses the data store and prints a summary of the leafs accessed during the run. More...

Inheritance diagram for StoreSnifferAlg:
Inheritance graph
[legend]
Collaboration diagram for StoreSnifferAlg:
Collaboration graph
[legend]

Classes

struct  LeafInfo
 

Public Types

typedef map< string, LeafInfoSniffInfo
 
typedef map< string, map< int,
int > > 
Correlations
 

Public Member Functions

 StoreSnifferAlg (const string &name, ISvcLocator *pSvc)
 Standard algorithm constructor.
 
virtual ~StoreSnifferAlg ()
 Standard Destructor.
 
size_t explore (IRegistry *pObj)
 
virtual StatusCode initialize ()
 Initialize.
 
virtual StatusCode finalize ()
 Finalize.
 
virtual StatusCode execute ()
 Execute procedure.
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor.
 
virtual ~Algorithm ()
 Destructor.
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework.
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework.
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event.
 
virtual StatusCode sysStop ()
 System stop.
 
virtual StatusCode sysFinalize ()
 System finalization.
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework.
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework.
 
virtual const std::stringname () const
 The identifying name of the algorithm object.
 
virtual const std::stringversion () const
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method.
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method.
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset?
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state.
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event.
 
virtual StatusCode beginRun ()
 Algorithm begin run.
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop.
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled?
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event?
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state.
 
template<class T >
StatusCode service (const std::string &name, 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 &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name")
 
void setOutputLevel (int level)
 Set the output level for current algorithm.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present.
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service.
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service.
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service.
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service.
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service.
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
SmartIF< IMessageSvc > & messageService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service.
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present.
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service.
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator.
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator
 
bool registerContext () const
 register for Algorithm Context Service?
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm.
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty.
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty.
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
 
virtual const std::vector
< Property * > & 
getProperties () const
 Implementation of IProperty::getProperties.
 
StatusCode setProperties ()
 Set the algorithm's properties.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service.
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information.
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case)
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 

Public Attributes

SmartIF< IDataManagerSvcm_mgr
 
SniffInfo m_info
 
SniffInfo m_curr
 
Correlations m_corr
 
Correlations m_links
 

Additional Inherited Members

- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized?
 
bool isFinalized () const
 Has the Algorithm already been finalized?
 
int outputLevel () const
 retrieve the Algorithm output level
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property.
 
void initOutputLevel (Property &prop)
 callback for output level property
 

Detailed Description

Small algorithm, which traverses the data store and prints a summary of the leafs accessed during the run.

Author
: M.Frank
Version
: 1.0

Definition at line 30 of file StoreSnifferAlg.cpp.

Member Typedef Documentation

Definition at line 41 of file StoreSnifferAlg.cpp.

Definition at line 40 of file StoreSnifferAlg.cpp.

Constructor & Destructor Documentation

StoreSnifferAlg::StoreSnifferAlg ( const string name,
ISvcLocator pSvc 
)
inline

Standard algorithm constructor.

Definition at line 47 of file StoreSnifferAlg.cpp.

: Algorithm(name, pSvc) {
}
virtual StoreSnifferAlg::~StoreSnifferAlg ( )
inlinevirtual

Standard Destructor.

Definition at line 50 of file StoreSnifferAlg.cpp.

{
}

Member Function Documentation

virtual StatusCode StoreSnifferAlg::execute ( )
inlinevirtual

Execute procedure.

Definition at line 141 of file StoreSnifferAlg.cpp.

{
if ( root ) {
m_curr["/Event"].count = explore(root->registry());
m_curr["/Event"].clid = root->clID();
m_curr["/Event"].id = m_curr.size();
LeafInfo& li = m_info[(*i).first];
li.count++;
}
const string& nam = (*i).first;
// const LeafInfo& leaf = (*i).second;
if ( c == m_corr.end() ) {
m_corr[nam] = map<int,int>();
c = m_corr.find(nam);
}
const LeafInfo& li = (*l).second;
map<int,int>::iterator k = (*c).second.find(li.id);
if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
++((*c).second[li.id]);
}
c=m_links.find(nam);
if ( c == m_links.end() ) {
c = m_links.find(nam);
}
if ( m_curr.find(nam) != m_curr.end() ) {
if ( obj ) {
LinkManager* m = obj->linkMgr();
for(long l=0; l<m->size(); ++l) {
// cout << "Link:" << lnk->path() << " " << (char*)(il != m_curr.end() ? "Found" : "Not there") << endl;
if ( il != m_curr.end() ) {
if ( lnk->object() ) {
const LeafInfo& li = (*il).second;
map<int,int>::iterator k = (*c).second.find(li.id);
if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
++((*c).second[li.id]);
}
}
}
}
}
}
}
}
size_t StoreSnifferAlg::explore ( IRegistry pObj)
inline

We are only interested in leaves with an object

Definition at line 53 of file StoreSnifferAlg.cpp.

{
if ( 0 != pObj ) {
if ( mgr ) {
typedef vector<IRegistry*> Leaves;
Leaves leaves;
StatusCode sc = m_mgr->objectLeaves(pObj, leaves);
if ( sc.isSuccess() ) {
for (Leaves::const_iterator i=leaves.begin(); i != leaves.end(); i++ ) {
IRegistry* pReg = *i;
const string& id = pReg->identifier();
if ( pReg->address() && pReg->object() ) {
if ( j == m_info.end() ) {
m_info[id] = LeafInfo();
j = m_info.find(id);
(*j).second.count = 0;
(*j).second.id = m_info.size();
(*j).second.clid = pReg->object()->clID();
}
m_curr[id].id = m_info[id].id;
m_curr[id].count = explore(pReg);
}
}
return leaves.size();
}
}
}
return 0;
}
virtual StatusCode StoreSnifferAlg::finalize ( )
inlinevirtual

Finalize.

Reimplemented from Algorithm.

Definition at line 93 of file StoreSnifferAlg.cpp.

{
log << MSG::ALWAYS << "== BEGIN ============= Access list content:" << m_info.size() << endmsg;
const LeafInfo& info = (*i).second;
log << "== ITEM == " << right << setw(4) << dec << info.id << " clid:"
<< right << setw(8) << hex << info.clid << " Count:"
<< right << setw(6) << dec << info.count << " "
<< (*i).first+":"
<< endmsg;
if ( c != m_corr.end() ) {
int cnt = 0;
log << "== CORRELATIONS:" << (*c).second.size() << endmsg;
for(map<int,int>::const_iterator k=(*c).second.begin(); k!=(*c).second.end();++k) {
if ( (*k).second > 0 ) {
log << dec << (*k).first << ":" << (*k).second << " ";
if ( ++cnt == 10 ) {
cnt = 0;
log << endmsg;
}
}
}
if ( cnt > 0 ) log << endmsg;
}
if ( l != m_links.end() ) {
int cnt = 0;
log << "== LINKS:" << (*l).second.size() << endmsg;
for(map<int,int>::const_iterator k=(*l).second.begin(); k!=(*l).second.end();++k) {
if ( (*k).second > 0 ) {
log << dec << (*k).first << ":" << (*k).second << " ";
if ( ++cnt == 10 ) {
cnt = 0;
log << endmsg;
}
}
}
if ( cnt > 0 ) log << endmsg;
}
}
log << MSG::ALWAYS << "== END =============== Access list content:" << m_info.size() << endmsg;
m_mgr = 0;
}
virtual StatusCode StoreSnifferAlg::initialize ( )
inlinevirtual

Initialize.

Reimplemented from Algorithm.

Definition at line 86 of file StoreSnifferAlg.cpp.

Member Data Documentation

Correlations StoreSnifferAlg::m_corr

Definition at line 44 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_curr

Definition at line 43 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_info

Definition at line 43 of file StoreSnifferAlg.cpp.

Correlations StoreSnifferAlg::m_links

Definition at line 44 of file StoreSnifferAlg.cpp.

SmartIF<IDataManagerSvc> StoreSnifferAlg::m_mgr

Definition at line 33 of file StoreSnifferAlg.cpp.


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

Generated at Wed Dec 4 2013 14:33:19 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004