std::ostream& Mgr::dump(std::ostream& os, const char* pfx) const { os << pfx << "[ metric table:" << std::endl; for (uint i = 0; i < m_metrics.size(); i++) { Metric::ADesc* m = m_metrics[i]; os << pfx << " " << m->id() << ": " << m->toString() << std::endl; } os << pfx << "]" << std::endl; os << pfx << "[ unique-name-to-metric:" << std::endl; for (StringToADescMap::const_iterator it = m_uniqnmToMetricMap.begin(); it != m_uniqnmToMetricMap.end(); ++it) { const string& nm = it->first; Metric::ADesc* m = it->second; os << pfx << " " << nm << " -> " << m->toString() << std::endl; } os << pfx << "]" << std::endl; return os; }
void Mgr::computePartners() { StringToADescMap metricsIncl; StringToADescMap metricsExcl; // ------------------------------------------------------- // populate maps // ------------------------------------------------------- for (uint i = 0; i < m_metrics.size(); ++i) { Metric::ADesc* m = m_metrics[i]; string nm = m->namePfxBaseSfx(); StringToADescMap* metricsMap = NULL; switch (m->type()) { case ADesc::TyIncl: metricsMap = &metricsIncl; break; case ADesc::TyExcl: metricsMap = &metricsExcl; break; default: break; } if (metricsMap) { DIAG_MsgIf(0, "Metric::Mgr::computePartners: insert: " << nm << " [" << m->name() << "]"); std::pair<StringToADescMap::iterator, bool> ret = metricsMap->insert(make_pair(nm, m)); DIAG_Assert(ret.second, "Metric::Mgr::computePartners: Found duplicate entry inserting:\n\t" << m->toString() << "\nOther entry:\n\t" << ret.first->second->toString()); } } // ------------------------------------------------------- // find partners // ------------------------------------------------------- for (uint i = 0; i < m_metrics.size(); ++i) { Metric::ADesc* m = m_metrics[i]; string nm = m->namePfxBaseSfx(); StringToADescMap* metricsMap = NULL; switch (m->type()) { case ADesc::TyIncl: metricsMap = &metricsExcl; break; case ADesc::TyExcl: metricsMap = &metricsIncl; break; default: break; } if (metricsMap) { StringToADescMap::iterator it = metricsMap->find(nm); if (it != metricsMap->end()) { Metric::ADesc* partner = it->second; m->partner(partner); DIAG_MsgIf(0, "Metric::Mgr::computePartners: found: " << m->name() << " -> " << partner->name()); } } } }