99 bool isUnitsEvents,
bool doDispPercent)
104 for (
uint i = 0; i < profileFiles.size(); ++i) {
105 const string& proffnm = profileFiles[i];
109 prof.
open(proffnm.c_str());
112 DIAG_EMsg(
"While reading '" << proffnm <<
"'");
117 for (
uint j = 0; j < mdescs.size(); ++j) {
120 bool isSortKey = (
empty());
140 std::vector<Metric::ADescVec*> metricGroups;
154 for (
uint i = srcBegId; i < srcEndId; ++i) {
158 StringToADescVecMap::iterator it = nmToMetricMap.find(nm);
159 if (it != nmToMetricMap.end()) {
164 std::pair<StringToADescVecMap::iterator, bool> ret =
167 metricGroups.push_back(grp);
176 for (
uint i = 0; i < metricGroups.size(); ++i) {
192 firstId = mNew->
id();
207 for (
uint i=0; i<source->
size(); i++) {
228 float mean = period / num_profiles;
246 for (
uint i = srcBegId; i < srcEndId; ++i) {
261 firstId = mNew->
id();
276 for (
uint i = 0; i < mOpands.size(); ++i) {
285 if (mDrvdTy.find(
"Sum", 0) == 0) {
288 else if (mDrvdTy.find(
"Mean", 0) == 0) {
291 else if (mDrvdTy.find(
"StdDev", 0) == 0) {
294 else if (mDrvdTy.find(
"CfVar", 0) == 0) {
297 else if (mDrvdTy.find(
"%CfVar", 0) == 0) {
300 else if (mDrvdTy.find(
"Min", 0) == 0) {
303 else if (mDrvdTy.find(
"Max", 0) == 0) {
311 string mNmBase = mSrc->
nameBase() +
":" + mDrvdTy;
328 expr->accumId(0, m->
id());
330 for (
uint k = 1; k < expr->numAccum(); ++k) {
341 expr->accumId(k, m2->
id());
344 if (expr->hasNumSrcVar()) {
345 string m3NmBase = mNmBase +
":num-src";
351 m3->nameBase(m3NmBase);
357 expr->numSrcVarId(m3->id());
369 bool isPercent =
false;
375 if (mDrvdTy.find(
"Sum", 0) == 0) {
378 else if (mDrvdTy.find(
"Mean", 0) == 0) {
380 doDispPercent =
false;
382 else if (mDrvdTy.find(
"StdDev", 0) == 0) {
384 doDispPercent =
false;
386 else if (mDrvdTy.find(
"CfVar", 0) == 0) {
388 doDispPercent =
false;
390 else if (mDrvdTy.find(
"%CfVar", 0) == 0) {
394 else if (mDrvdTy.find(
"Min", 0) == 0) {
396 doDispPercent =
false;
398 else if (mDrvdTy.find(
"Max", 0) == 0) {
400 doDispPercent =
false;
407 string mNmBase = mSrc->
nameBase() +
":" + mDrvdTy;
412 true, doDispPercent, isPercent);
439 string m3NmBase = mNmBase +
":num-src";
445 m3->nameBase(m3NmBase);
476 string nm = m->
name();
520 for (
int i =
m_metrics.size() - 1; i >= 0; --i) {
600 for (
uint y_i = 1; y_i < y.
size(); ++y_i) {
602 if (mPfx != y_grp_pfx) {
611 std::vector<uint> metricMap(y_grp_sz);
613 for (
uint y_i = 0; y_i < y_grp_sz; ++y_i) {
615 string mNm = y_m->
name();
618 if (!x_m || (y_i > 0 && x_m->
id() != (metricMap[y_i - 1] + 1))) {
623 metricMap[y_i] = x_m->
id();
626 bool foundGrp = (found && !metricMap.empty());
635 for (
uint x_i = metricMap[y_grp_sz - 1] + 1, y_i = y_grp_sz;
636 x_i < x->
size() && y_i < y.
size(); ++x_i, ++y_i) {
641 return (foundGrp) ? metricMap[0] :
Mgr::npos;
683 DIAG_MsgIf(0,
"Metric::Mgr::computePartners: insert: " << nm
684 <<
" [" << m->
name() <<
"]");
685 std::pair<StringToADescMap::iterator, bool> ret =
686 metricsMap->insert(make_pair(nm, m));
687 DIAG_Assert(ret.second,
"Metric::Mgr::computePartners: Found duplicate entry inserting:\n\t" << m->
toString() <<
"\nOther entry:\n\t" << ret.first->second->toString());
706 StringToADescMap::iterator it = metricsMap->find(nm);
707 if (it != metricsMap->end()) {
710 DIAG_MsgIf(0,
"Metric::Mgr::computePartners: found: " 711 << m->
name() <<
" -> " << partner->
name());
737 std::ostringstream os;
746 os << pfx <<
"[ metric table:" << std::endl;
749 os << pfx <<
" " << m->
id() <<
": " << m->
toString() << std::endl;
751 os << pfx <<
"]" << std::endl;
753 os << pfx <<
"[ unique-name-to-metric:" << std::endl;
756 const string& nm = it->first;
758 os << pfx <<
" " << nm <<
" -> " << m->
toString() << std::endl;
760 os << pfx <<
"]" << std::endl;
781 bool isChanged =
false;
784 string nm = m->
name();
790 int qualifier = mvec.size();
791 const string& nm_sfx = m->
nameSfx();
792 string sfx_new = nm_sfx;
793 if (!sfx_new.empty()) {
809 std::pair<StringToADescMap::iterator, bool> ret =
811 DIAG_Assert(ret.second,
"Metric::Mgr::insertInMapsAndMakeUniqueName: Found duplicate entry inserting:\n\t" << m->
toString() <<
"\nOther entry:\n\t" << ret.first->second->toString());
821 mvec.push_back(mSmpl);
const std::string & profileName() const
void makeRawMetrics(const std::vector< std::string > &profileFiles, bool isUnitsEvents=true, bool doDispPercent=true)
bool insertInMapsAndMakeUniqueName(Metric::ADesc *m)
bool insertIf(Metric::ADesc *m)
bool insert(Metric::ADesc *m)
const std::string & nameSfx() const
std::string namePfxBaseSfx() const
StringToADescVecMap m_nuniqnmToMetricMap
void mergePerfEventStatistics(Mgr *source)
string toStr(const int x, int base)
void isMultiplexed(bool isMultiplexedEvent)
virtual uint accumId(int i) const
virtual std::string toString() const
const Metric::SampledDescVec & mdescs()
std::vector< ADesc * > ADescVec
Metric::ADesc * findSortKey() const
std::ostream & dump(std::ostream &os=std::cerr, const char *pfx="") const
StringToADescVecMap m_fnameToFMetricMap
uint makeSummaryMetricsIncr(bool needAllStats, uint srcBegId=Mgr::npos, uint srcEndId=Mgr::npos)
void mergePerfEventStatistics_finalize(int num_profiles)
bool doDispPercent() const
std::string nameToFmt() const
#define DIAG_MsgIf(ifexpr,...)
void sampling_type(SamplingType_t type)
void num_samples(const uint64_t samples)
uint makeSummaryMetrics(bool needAllStats, bool needMultiOccurance, uint srcBegId=Mgr::npos, uint srcEndId=Mgr::npos)
virtual bool hasNumSrcVar() const
const std::string & nameBase() const
std::string nameGeneric() const
std::string toString(const char *pfx="") const
bool isUnitsEvents() const
Metric::DerivedIncrDesc * makeSummaryMetricIncr(const std::string mDrvdTy, const Metric::ADesc *mSrc)
std::map< std::string, Metric::ADescVec > StringToADescVecMap
Metric::DerivedDesc * makeSummaryMetric(const std::string mDrvdTy, const Metric::ADesc *mSrc, const Metric::ADescVec &mOpands)
virtual uint numSrcVarId() const
Metric::ADesc * findFirstVisible() const
Metric::ADescVec m_metrics
const char * DIAG_UnexpectedInput
virtual uint accumId(int i) const
const std::string & namePfx() const
std::map< std::string, Metric::ADesc * > StringToADescMap
uint findGroup(const Mgr &y_mMgr) const
Metric::ADesc * metric(uint i)
const std::string & description() const
static int const threshold
void open(const char *filename=NULL)
Metric::ADesc * findLastVisible() const
StringToADescMap m_uniqnmToMetricMap
void periodMean(float periodMeanEvent)
virtual uint numAccum() const