All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
Collaboration diagram for StoreSnifferAlg:

Classes

struct  LeafInfo
 

Public Types

typedef map< string, LeafInfoSniffInfo
 
typedef map< string, map< int,
int > > 
Correlations
 
- Public Types inherited from Algorithm
typedef
Gaudi::PluginService::Factory
< IAlgorithm *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from implements3< IAlgorithm, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IAlgorithm, 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< IAlgorithm, IProperty, IStateful >
typedef mpl::fold< typename
IAlgorithm::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...
 

Public Member Functions

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

SmartIF< IDataManagerSvcm_mgr
 
SniffInfo m_info
 
SniffInfo m_curr
 
Correlations m_corr
 
Correlations m_links
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized? More...
 
bool isFinalized () const
 Has the Algorithm already been finalized? More...
 
int outputLevel () const
 retrieve the Algorithm output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 

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 28 of file StoreSnifferAlg.cpp.

Member Typedef Documentation

typedef map<string,map<int,int> > StoreSnifferAlg::Correlations

Definition at line 39 of file StoreSnifferAlg.cpp.

typedef map<string, LeafInfo> StoreSnifferAlg::SniffInfo

Definition at line 38 of file StoreSnifferAlg.cpp.

Constructor & Destructor Documentation

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

Standard algorithm constructor.

Definition at line 45 of file StoreSnifferAlg.cpp.

45  : Algorithm(name, pSvc) {
46  }
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:28
virtual StoreSnifferAlg::~StoreSnifferAlg ( )
inlinevirtual

Standard Destructor.

Definition at line 48 of file StoreSnifferAlg.cpp.

48  {
49  }

Member Function Documentation

virtual StatusCode StoreSnifferAlg::execute ( )
inlinevirtual

Execute procedure.

Implements IAlgorithm.

Definition at line 139 of file StoreSnifferAlg.cpp.

139  {
141  if ( root ) {
142  m_curr.clear();
143  m_curr["/Event"].count = explore(root->registry());
144  m_curr["/Event"].clid = root->clID();
145  m_curr["/Event"].id = m_curr.size();
146  for(SniffInfo::const_iterator i=m_curr.begin(); i!=m_curr.end();++i) {
147  LeafInfo& li = m_info[(*i).first];
148  li.count++;
149  }
150  for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
151  const string& nam = (*i).first;
152  // const LeafInfo& leaf = (*i).second;
153  Correlations::iterator c=m_corr.find(nam);
154  if ( c == m_corr.end() ) {
155  m_corr[nam] = map<int,int>();
156  c = m_corr.find(nam);
157  }
158  for(SniffInfo::const_iterator l=m_curr.begin(); l!=m_curr.end();++l) {
159  const LeafInfo& li = (*l).second;
160  map<int,int>::iterator k = (*c).second.find(li.id);
161  if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
162  ++((*c).second[li.id]);
163  }
164 
165  c=m_links.find(nam);
166  if ( c == m_links.end() ) {
167  m_links[nam] = map<int,int>();
168  c = m_links.find(nam);
169  }
170  if ( m_curr.find(nam) != m_curr.end() ) {
172  if ( obj ) {
173  LinkManager* m = obj->linkMgr();
174  for(long l=0; l<m->size(); ++l) {
175  LinkManager::Link* lnk=m->link(l);
176  SniffInfo::const_iterator il=m_curr.find(lnk->path());
177  // cout << "Link:" << lnk->path() << " " << (char*)(il != m_curr.end() ? "Found" : "Not there") << endl;
178  if ( il != m_curr.end() ) {
179  if ( lnk->object() ) {
180  const LeafInfo& li = (*il).second;
181  map<int,int>::iterator k = (*c).second.find(li.id);
182  if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
183  ++((*c).second[li.id]);
184  }
185  }
186  }
187  }
188  }
189  }
190  return StatusCode::SUCCESS;
191  }
192  return StatusCode::SUCCESS;
193  }
tuple c
Definition: gaudirun.py:341
Correlations m_corr
Correlations m_links
dictionary l
Definition: gaudirun.py:365
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:46
tuple root
Definition: IOTest.py:42
size_t explore(IRegistry *pObj)
list i
Definition: ana.py:128
size_t StoreSnifferAlg::explore ( IRegistry pObj)
inline

We are only interested in leaves with an object

Definition at line 51 of file StoreSnifferAlg.cpp.

51  {
52  if ( 0 != pObj ) {
54  if ( mgr ) {
55  typedef vector<IRegistry*> Leaves;
56  Leaves leaves;
57  StatusCode sc = m_mgr->objectLeaves(pObj, leaves);
58  if ( sc.isSuccess() ) {
59  for (Leaves::const_iterator i=leaves.begin(); i != leaves.end(); i++ ) {
60  IRegistry* pReg = *i;
61  const string& id = pReg->identifier();
63  if ( pReg->address() && pReg->object() ) {
64  SniffInfo::iterator j=m_info.find(id);
65  if ( j == m_info.end() ) {
66  m_info[id] = LeafInfo();
67  j = m_info.find(id);
68  (*j).second.count = 0;
69  (*j).second.id = m_info.size();
70  (*j).second.clid = pReg->object()->clID();
71  }
72  m_curr[id].id = m_info[id].id;
73  m_curr[id].count = explore(pReg);
74  }
75  }
76  return leaves.size();
77  }
78  }
79  }
80  return 0;
81  }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
SmartIF< IDataManagerSvc > m_mgr
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual DataObject * object() const =0
Retrieve object behind the link.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
size_t explore(IRegistry *pObj)
virtual const id_type & identifier() const =0
Full identifier (or key)
list i
Definition: ana.py:128
virtual StatusCode StoreSnifferAlg::finalize ( )
inlinevirtual

Finalize.

Reimplemented from Algorithm.

Definition at line 91 of file StoreSnifferAlg.cpp.

91  {
92  MsgStream log(msgSvc(), name());
93  log << MSG::ALWAYS << "== BEGIN ============= Access list content:" << m_info.size() << endmsg;
94  for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
95  const LeafInfo& info = (*i).second;
96  log << "== ITEM == " << right << setw(4) << dec << info.id << " clid:"
97  << right << setw(8) << hex << info.clid << " Count:"
98  << right << setw(6) << dec << info.count << " "
99  << (*i).first+":"
100  << endmsg;
101  Correlations::const_iterator c=m_corr.find((*i).first);
102  if ( c != m_corr.end() ) {
103  int cnt = 0;
104  log << "== CORRELATIONS:" << (*c).second.size() << endmsg;
105  for(map<int,int>::const_iterator k=(*c).second.begin(); k!=(*c).second.end();++k) {
106  if ( (*k).second > 0 ) {
107  log << dec << (*k).first << ":" << (*k).second << " ";
108  if ( ++cnt == 10 ) {
109  cnt = 0;
110  log << endmsg;
111  }
112  }
113  }
114  if ( cnt > 0 ) log << endmsg;
115  }
116  Correlations::const_iterator l=m_links.find((*i).first);
117  if ( l != m_links.end() ) {
118  int cnt = 0;
119  log << "== LINKS:" << (*l).second.size() << endmsg;
120  for(map<int,int>::const_iterator k=(*l).second.begin(); k!=(*l).second.end();++k) {
121  if ( (*k).second > 0 ) {
122  log << dec << (*k).first << ":" << (*k).second << " ";
123  if ( ++cnt == 10 ) {
124  cnt = 0;
125  log << endmsg;
126  }
127  }
128  }
129  if ( cnt > 0 ) log << endmsg;
130  }
131  }
132  log << MSG::ALWAYS << "== END =============== Access list content:" << m_info.size() << endmsg;
133  m_info.clear();
134  m_mgr = 0;
135  return StatusCode::SUCCESS;
136  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
tuple c
Definition: gaudirun.py:341
Correlations m_corr
SmartIF< IDataManagerSvc > m_mgr
Correlations m_links
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
dictionary l
Definition: gaudirun.py:365
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode StoreSnifferAlg::initialize ( )
inlinevirtual

Initialize.

Reimplemented from Algorithm.

Definition at line 84 of file StoreSnifferAlg.cpp.

84  {
85  m_info.clear();
86  m_mgr = eventSvc();
87  return StatusCode::SUCCESS;
88  }
SmartIF< IDataManagerSvc > m_mgr
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.

Member Data Documentation

Correlations StoreSnifferAlg::m_corr

Definition at line 42 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_curr

Definition at line 41 of file StoreSnifferAlg.cpp.

SniffInfo StoreSnifferAlg::m_info

Definition at line 41 of file StoreSnifferAlg.cpp.

Correlations StoreSnifferAlg::m_links

Definition at line 42 of file StoreSnifferAlg.cpp.

SmartIF<IDataManagerSvc> StoreSnifferAlg::m_mgr

Definition at line 31 of file StoreSnifferAlg.cpp.


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