Gaudi Framework, version v21r9

Home   Generated: 3 May 2010

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]

List of all members.

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 Attributes

SmartIF< IDataManagerSvcm_mgr
SniffInfo m_info
SniffInfo m_curr
Correlations m_corr
Correlations m_links

Classes

struct  LeafInfo


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

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

Definition at line 41 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.

00047                                                          : Algorithm(name, pSvc)  {
00048   }

virtual StoreSnifferAlg::~StoreSnifferAlg (  )  [inline, virtual]

Standard Destructor.

Definition at line 50 of file StoreSnifferAlg.cpp.

00050                                  {
00051   }


Member Function Documentation

size_t StoreSnifferAlg::explore ( IRegistry pObj  )  [inline]

We are only interested in leaves with an object

Definition at line 53 of file StoreSnifferAlg.cpp.

00053                                      {
00054     if ( 0 != pObj )    {
00055       SmartIF<IDataManagerSvc> mgr(eventSvc());
00056       if ( mgr )    {
00057         typedef vector<IRegistry*> Leaves;
00058         Leaves leaves;
00059         StatusCode sc = m_mgr->objectLeaves(pObj, leaves);
00060         if ( sc.isSuccess() )  {
00061           for (Leaves::const_iterator i=leaves.begin(); i != leaves.end(); i++ )   {
00062             IRegistry* pReg = *i;
00063             const string& id = pReg->identifier();
00065             if ( pReg->address() && pReg->object() )  {
00066               SniffInfo::iterator j=m_info.find(id);
00067               if ( j == m_info.end() )   {
00068                 m_info[id] = LeafInfo();
00069                 j = m_info.find(id);
00070                 (*j).second.count = 0;
00071                 (*j).second.id    = m_info.size();
00072                 (*j).second.clid  = pReg->object()->clID();
00073               }
00074               m_curr[id].id    = m_info[id].id;
00075               m_curr[id].count = explore(pReg);
00076             }
00077           }
00078           return leaves.size();
00079         }
00080       }
00081     }
00082     return 0;
00083   }

virtual StatusCode StoreSnifferAlg::initialize (  )  [inline, virtual]

Initialize.

Reimplemented from Algorithm.

Definition at line 86 of file StoreSnifferAlg.cpp.

00086                                     {
00087     m_info.clear();
00088     m_mgr = eventSvc();
00089     return StatusCode::SUCCESS;
00090   }

virtual StatusCode StoreSnifferAlg::finalize ( void   )  [inline, virtual]

Finalize.

Reimplemented from Algorithm.

Definition at line 93 of file StoreSnifferAlg.cpp.

00093                                 {
00094     MsgStream log(msgSvc(), name());
00095     log << MSG::ALWAYS << "== BEGIN ============= Access list content:" << m_info.size() << endmsg;
00096     for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
00097       const LeafInfo& info = (*i).second;
00098       log << "== ITEM == " << right << setw(4) << dec << info.id << " clid:"
00099           << right << setw(8) << hex << info.clid << " Count:"
00100           << right << setw(6) << dec << info.count << " "
00101           << (*i).first+":"
00102           << endmsg;
00103       Correlations::const_iterator c=m_corr.find((*i).first);
00104       if ( c != m_corr.end() ) {
00105         int cnt = 0;
00106         log << "== CORRELATIONS:" << (*c).second.size() << endmsg;
00107         for(map<int,int>::const_iterator k=(*c).second.begin(); k!=(*c).second.end();++k) {
00108           if ( (*k).second > 0 ) {
00109             log << dec << (*k).first << ":" << (*k).second << "  ";
00110             if ( ++cnt == 10 ) {
00111               cnt = 0;
00112               log << endmsg;
00113             }
00114           }
00115         }
00116         if ( cnt > 0 ) log << endmsg;
00117       }
00118       Correlations::const_iterator l=m_links.find((*i).first);
00119       if ( l != m_links.end() ) {
00120         int cnt = 0;
00121         log << "== LINKS:" << (*l).second.size() << endmsg;
00122         for(map<int,int>::const_iterator k=(*l).second.begin(); k!=(*l).second.end();++k) {
00123           if ( (*k).second > 0 ) {
00124             log << dec << (*k).first << ":" << (*k).second << "  ";
00125             if ( ++cnt == 10 ) {
00126               cnt = 0;
00127               log << endmsg;
00128             }
00129           }
00130         }
00131         if ( cnt > 0 ) log << endmsg;
00132       }
00133     }
00134     log << MSG::ALWAYS << "== END =============== Access list content:" << m_info.size() << endmsg;
00135     m_info.clear();
00136     m_mgr = 0;
00137     return StatusCode::SUCCESS;
00138   }

virtual StatusCode StoreSnifferAlg::execute (  )  [inline, virtual]

Execute procedure.

Definition at line 141 of file StoreSnifferAlg.cpp.

00141                                   {
00142     SmartDataPtr<DataObject> root(eventSvc(),"/Event");
00143     if ( root )    {
00144       m_curr.clear();
00145       m_curr["/Event"].count = explore(root->registry());
00146       m_curr["/Event"].clid  = root->clID();
00147       m_curr["/Event"].id    = m_curr.size();
00148       for(SniffInfo::const_iterator i=m_curr.begin(); i!=m_curr.end();++i) {
00149         LeafInfo& li = m_info[(*i).first];
00150         li.count++;
00151       }
00152       for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
00153         const string& nam = (*i).first;
00154         // const LeafInfo& leaf = (*i).second;
00155         Correlations::iterator c=m_corr.find(nam);
00156         if ( c == m_corr.end() )  {
00157           m_corr[nam] = map<int,int>();
00158           c = m_corr.find(nam);
00159         }
00160         for(SniffInfo::const_iterator l=m_curr.begin(); l!=m_curr.end();++l) {
00161           const LeafInfo& li = (*l).second;
00162           map<int,int>::iterator k = (*c).second.find(li.id);
00163           if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
00164           ++((*c).second[li.id]);
00165         }
00166 
00167         c=m_links.find(nam);
00168         if ( c == m_links.end() )  {
00169           m_links[nam] = map<int,int>();
00170           c = m_links.find(nam);
00171         }
00172         if ( m_curr.find(nam) != m_curr.end() ) {
00173           SmartDataPtr<DataObject> obj(eventSvc(),nam);
00174           if ( obj ) {
00175             LinkManager* m = obj->linkMgr();
00176             for(long l=0; l<m->size(); ++l) {
00177               LinkManager::Link* lnk=m->link(l);
00178               SniffInfo::const_iterator il=m_curr.find(lnk->path());
00179               // cout << "Link:" << lnk->path() << " " << (char*)(il != m_curr.end() ? "Found" : "Not there") << endl;
00180               if ( il != m_curr.end() ) {
00181                 if ( lnk->object() ) {
00182                   const LeafInfo& li = (*il).second;
00183                   map<int,int>::iterator k = (*c).second.find(li.id);
00184                   if ( k==(*c).second.end() ) (*c).second[li.id] = 0;
00185                   ++((*c).second[li.id]);
00186                 }
00187               }
00188             }
00189           }
00190         }
00191       }
00192       return StatusCode::SUCCESS;
00193     }
00194     return StatusCode::SUCCESS;
00195   }


Member Data Documentation

Definition at line 33 of file StoreSnifferAlg.cpp.

Definition at line 43 of file StoreSnifferAlg.cpp.

Definition at line 43 of file StoreSnifferAlg.cpp.

Definition at line 44 of file StoreSnifferAlg.cpp.

Definition at line 44 of file StoreSnifferAlg.cpp.


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

Generated at Mon May 3 12:26:33 2010 for Gaudi Framework, version v21r9 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004