|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
Small algorithm, which traverses the data store and prints a summary of the leafs accessed during the run. More...


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 |
Small algorithm, which traverses the data store and prints a summary of the leafs accessed during the run.
Definition at line 30 of file StoreSnifferAlg.cpp.
| 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.
| StoreSnifferAlg::StoreSnifferAlg | ( | const string & | name, |
| ISvcLocator * | pSvc | ||
| ) | [inline] |
Standard algorithm constructor.
Definition at line 47 of file StoreSnifferAlg.cpp.
| virtual StoreSnifferAlg::~StoreSnifferAlg | ( | ) | [inline, virtual] |
| 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;
}
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;
}
Definition at line 44 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 33 of file StoreSnifferAlg.cpp.