| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Classes | Public Types | Public Member Functions | Public Attributes

# 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:
[legend]
Collaboration diagram for StoreSnifferAlg:
[legend]

List of all members.

## Classes
struct | LeafInfo
## Public Types
typedef map< string, LeafInfo > | SniffInfo
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< IDataManagerSvc > | m_mgr
SniffInfo | m_info
SniffInfo | m_curr
Correlations | m_corr
Correlations | m_links

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

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

Definition at line 41 of file StoreSnifferAlg.cpp.

typedef map<string, LeafInfo> StoreSnifferAlg::SniffInfo

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 | ( | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 50 of file StoreSnifferAlg.cpp.

                                     {
      }

## Member Function Documentation

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

Execute procedure.

Definition at line 141 of file StoreSnifferAlg.cpp.

                                      {
        SmartDataPtr<DataObject> root(eventSvc(),"/Event");
        if ( root )    {
          m_curr.clear();
          m_curr["/Event"].count = explore(root->registry());
          m_curr["/Event"].clid  = root->clID();
          m_curr["/Event"].id    = m_curr.size();
          for(SniffInfo::const_iterator i=m_curr.begin(); i!=m_curr.end();++i) {
            LeafInfo& li = m_info[(*i).first];
            li.count++;
          }
          for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
            const string& nam = (*i).first;
            // const LeafInfo& leaf = (*i).second;
            Correlations::iterator c=m_corr.find(nam);
            if ( c == m_corr.end() )  {
              m_corr[nam] = map<int,int>();
              c = m_corr.find(nam);
            }
            for(SniffInfo::const_iterator l=m_curr.begin(); l!=m_curr.end();++l) {
              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() )  {
              m_links[nam] = map<int,int>();
              c = m_links.find(nam);
            }
            if ( m_curr.find(nam) != m_curr.end() ) {
              SmartDataPtr<DataObject> obj(eventSvc(),nam);
              if ( obj ) {
                LinkManager* m = obj->linkMgr();
                for(long l=0; l<m->size(); ++l) {
                  LinkManager::Link* lnk=m->link(l);
                  SniffInfo::const_iterator il=m_curr.find(lnk->path());
                  // 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]);
                    }
                  }
                }
              }
            }
          }
          return StatusCode::SUCCESS;
        }
        return StatusCode::SUCCESS;
      }

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 )    {
          SmartIF<IDataManagerSvc> mgr(eventSvc());
          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() )  {
                  SniffInfo::iterator j=m_info.find(id);
                  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 | ( | void | ) | `[inline, virtual]`

Finalize.

Reimplemented from Algorithm.

Definition at line 93 of file StoreSnifferAlg.cpp.

                                    {
        MsgStream log(msgSvc(), name());
        log << MSG::ALWAYS << "== BEGIN ============= Access list content:" << m_info.size() << endmsg;
        for(SniffInfo::const_iterator i=m_info.begin(); i!=m_info.end();++i) {
          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;
          Correlations::const_iterator c=m_corr.find((*i).first);
          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;
          }
          Correlations::const_iterator l=m_links.find((*i).first);
          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_info.clear();
        m_mgr = 0;
        return StatusCode::SUCCESS;
      }

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

Initialize.

Reimplemented from Algorithm.

Definition at line 86 of file StoreSnifferAlg.cpp.

                                        {
        m_info.clear();
        m_mgr = eventSvc();
        return StatusCode::SUCCESS;
      }

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

- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/DataSvc/StoreSnifferAlg.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines