62 #define __STDC_LIMIT_MACROS 85 #define __STDC_FORMAT_MACROS 89 #include <linux/limits.h> 138 #define MAX_PREFIX_CHARS 64 164 Profile::Profile(
const std::string name)
169 m_measurementGranularity = 0;
171 m_traceMinTime = UINT64_MAX;
175 m_isMetricMgrVirtual =
false;
201 DIAG_Assert(!y.
m_structure,
"Profile::merge: source profile should not have structure yet!");
230 "CallPath::Profile::merge(): ignoring incompatible versions: " 233 "CallPath::Profile::merge(): ignoring incompatible flags: " 250 uint x_newMetricBegIdx = 0;
251 uint firstMergedMetric = mergeMetrics(y, mergeTy, x_newMetricBegIdx);
258 std::vector<LoadMap::MergeEffect>* mrgEffects1 =
272 x.
cct()->
merge(y.
cct(), x_newMetricBegIdx, mrgFlag);
276 "CallPath::Profile::merge: there should only be CCT::MergeEffects when MrgFlg_NormalizeTraceFileY is passed");
281 return firstMergedMetric;
286 Profile::mergeMetrics(
Profile& y,
int mergeTy,
uint& x_newMetricBegIdx)
291 "CallPath::Profile::merge(): incompatible metrics");
297 uint yBeg_mapsTo_xIdx = 0;
299 x_newMetricBegIdx = 0;
304 if (mergeTy == Merge_MergeMetricByName) {
306 mergeTy = (mapsTo == Metric::Mgr::npos) ? Merge_CreateMetric : (
int)mapsTo;
313 uint y_newMetricIdx = Metric::Mgr::npos;
315 if (mergeTy == Merge_CreateMetric) {
320 else if (mergeTy >= Merge_MergeMetricById) {
321 yBeg_mapsTo_xIdx = (
uint)mergeTy;
326 y_newMetricIdx = overlapSz;
338 if (!isMetricMgrVirtual()) {
339 x_newMetricBegIdx = yBeg_mapsTo_xIdx;
342 DIAG_MsgIf(0,
"Profile::mergeMetrics: fini:\n" << m_mMgr->toString(
" "));
344 return yBeg_mapsTo_xIdx;
349 Profile::merge_fixCCT(
const std::vector<LoadMap::MergeEffect>* mrgEffects)
352 if (!mrgEffects || mrgEffects->empty()) {
369 for (
uint i = 0; i < mrgEffects->size(); ++i) {
371 if (chg.
old_id == lmId1) {
373 if (lmId2 == LoadMap::LMId_NULL) {
377 if (chg.
old_id == lmId2) {
389 typedef std::map<uint, uint> UIntToUIntMap;
392 if (m_traceFileName.empty()) {
395 else if (!mrgEffects || mrgEffects->empty()) {
403 UIntToUIntMap cpIdMap;
404 for (CCT::MergeEffectList::const_iterator it = mrgEffects->begin();
405 it != mrgEffects->end(); ++it) {
415 DIAG_MsgIf(0,
"Profile::merge_fixTrace: " << m_traceFileName);
422 const string& inFnm = m_traceFileName;
425 std::string errorString;
427 DIAG_EMsg(
"failed to open trace file " << errorString <<
"; skip this one.");
432 DIAG_AssertWarn(ret == 0, inFnm <<
": Profile::merge_fixTrace: setvbuf!");
437 std::string errorString;
439 DIAG_EMsg(
"failed reading header from trace measurement file " << errorString <<
"; skip this one.");
444 const string& outFnm = traceFileNameTmp;
447 if (errno == EDQUOT) {
448 DIAG_EMsg(
"disk quota exceeded; unable to open trace result file " <<
449 outFnm <<
"; aborting.");
453 std::string errorString;
455 DIAG_EMsg(
"failed opening trace result file " << errorString <<
456 "when processing trace measurement file " << inFnm <<
"; skip this one.");
463 DIAG_AssertWarn(ret == 0, outFnm <<
": Profile::merge_fixTrace: setvbuf!");
468 while ( !feof(infs) ) {
475 DIAG_EMsg(
"failed reading a record from trace measurement file " << inFnm <<
"; skip this one.");
478 unlink(outFnm.c_str());
485 UIntToUIntMap::iterator it = cpIdMap.find(cctId_old);
486 if (it != cpIdMap.end()) {
487 cctId_new = it->second;
488 DIAG_MsgIf(0,
" " << cctId_old <<
" -> " << cctId_new);
490 datum.
cpId = cctId_new;
506 std::string errorString;
508 DIAG_EMsg(
"failed writing trace result file " << errorString <<
"; aborting.");
511 unlink(outFnm.c_str());
523 bool operator()(
const std::string n1,
const std::string n2)
const {
524 return n1.compare(n2)<0;
533 static std::map<std::string, uint, StringCompare>
m_mapFiles;
534 static std::map<std::string, uint, StringCompare>
m_mapProcs;
546 const char *nm =
NULL;
549 const std::type_info &
tid =
typeid(*strct);
554 nm =
static_cast<Struct::Loop*
>(strct)->fileName().c_str();
560 nm = file->
name().c_str();
571 int type,
bool remove_redundancy)
582 const char* nm =
NULL;
584 int fake_procedure = 0;
591 m_pairFakeLoadModule.insert(std::make_pair(
id, sf->
id()));
596 else if (type == 2) {
609 std::string key = lm_name +
":" + nm;
611 if (m_mapFiles.find(key) == m_mapFiles.end()) {
613 m_mapFiles[key] = id;
621 uint id_orig = m_mapFiles[key];
628 else if (type == 3) {
629 const char *proc_name = strct->
name().c_str();
632 if (remove_redundancy &&
640 std::string completProcName;
643 uint file_id = (file !=
NULL ? file->
id() : 0);
662 completProcName.append(buffer);
668 completProcName.append(buffer);
687 lnm = strct->
name().c_str();
689 completProcName.append(lnm);
690 if (m_mapProcs.find(completProcName) == m_mapProcs.end())
693 m_mapProcs[completProcName] = id;
698 uint id_orig = m_mapProcs[completProcName];
712 if (fake_procedure > 0) {
737 Profile::writeXML_hdr(std::ostream& os,
uint metricBeg,
uint metricEnd,
740 typedef std::map<uint, string> UIntToStringMap;
741 UIntToStringMap metricIdToFormula;
746 os <<
" <MetricTable>\n";
747 for (
uint i = metricBeg; i < metricEnd; i++) {
772 os <<
" show=\"" << ((m->
isVisible()) ?
"1" :
"0") <<
"\"" 773 <<
" show-percent=\"" << ((m->
doDispPercent()) ?
"1" :
"0") <<
"\"" 788 metricIdToFormula.insert(std::make_pair(mId, frm));
794 UIntToStringMap::iterator it = metricIdToFormula.find(mId);
796 combineFrm = it->second;
800 os <<
" <MetricFormula t=\"combine\"" 801 <<
" frm=\"" << combineFrm <<
"\"/>\n";
805 os <<
" <MetricFormula t=\"finalize\"" 812 <<
"<NV n=\"units\" v=\"events\"/>";
820 os <<
" </Metric>\n";
822 os <<
" </MetricTable>\n";
827 os <<
" <MetricDBTable>\n";
828 for (
uint i = 0; i < m_mMgr->size(); i++) {
837 os <<
" db-glob=\"" << m->
dbFileGlob() <<
"\"" 838 <<
" db-id=\"" << m->
dbId() <<
"\"" 844 os <<
" </MetricDBTable>\n";
849 if (!traceFileNameSet().empty()) {
850 os <<
" <TraceDBTable>\n";
853 <<
" db-min-time=\"" << m_traceMinTime <<
"\"" 854 <<
" db-max-time=\"" << m_traceMaxTime <<
"\"" 857 os <<
" </TraceDBTable>\n";
863 os <<
" <LoadModuleTable>\n";
866 m_remove_redundancy);
867 os <<
" </LoadModuleTable>\n";
872 os <<
" <FileTable>\n";
874 writeXML_help(os,
"File", m_structure, &filt1, 2, m_remove_redundancy);
875 os <<
" </FileTable>\n";
880 if ( !(oFlags & CCT::Tree::OFlg_Debug) ) {
881 os <<
" <ProcedureTable>\n";
883 writeXML_help(os,
"Procedure", m_structure, &filt2, 3,
true );
884 os <<
" </ProcedureTable>\n";
892 Profile::dump(std::ostream& os)
const 894 os << m_name << std::endl;
901 m_cct->dump(m_mMgr, os, CCT::Tree::OFlg_DebugAll);
908 Profile::ddump()
const 923 static std::pair<Prof::CCT::ADynNode*, Prof::CCT::ADynNode*>
926 const std::string& ctxtStr);
939 const char* Profile::FmtEpoch_NV_virtualMetrics =
"is-virtual-metrics";
946 if (rFlags & RFlg_VirtualMetrics) {
956 Profile::make(
const char* fnm,
uint rFlags, FILE* outfs)
963 fprintf(stderr,
"ERROR: measurement file or directory '%s' does not exist\n",
965 else if (errno == EACCES)
966 fprintf(stderr,
"ERROR: failed to open file '%s': file access denied\n",
969 fprintf(stderr,
"ERROR: failed to open file '%s': system failure\n",
976 DIAG_AssertWarn(ret == 0,
"Profile::make: setvbuf!");
978 rFlags |= RFlg_HpcrunData;
981 ret = fmt_fread(prof, fs, rFlags, fnm, fnm, outfs);
993 std::string ctxtStr,
const char* filename, FILE* outfs)
1003 fprintf(stderr,
"ERROR: error reading 'fmt-hdr' in '%s': either the file " 1004 "is not a profile or it is corrupted\n", filename);
1008 DIAG_Throw(
"unsupported file version '" << hdr.
versionStr <<
"'");
1022 uint num_epochs = 0;
1023 while ( !feof(infs) ) {
1028 ctxtStr +=
": " + myCtxtStr;
1031 ret = fmt_epoch_fread(myprof, infs, rFlags, hdr,
1032 ctxtStr, filename, outfs);
1039 DIAG_Throw(
"error reading " << ctxtStr <<
": " << x.
what());
1046 prof->
merge(*myprof, Profile::Merge_MergeMetricById);
1053 prof = make(rFlags);
1064 fprintf(outfs,
"\n[You look fine today! (num-epochs: %u)]\n", num_epochs);
1076 std::string ctxtStr,
const char* filename,
1079 using namespace Prof;
1081 string profFileName = (filename) ? filename :
"";
1098 DIAG_Throw(
"error reading 'epoch-hdr'");
1107 metric_tbl_t metricTbl;
1112 DIAG_Throw(
"error reading 'metric-tbl'");
1118 const uint numMetricsSrc = metricTbl.len;
1123 loadmap_t loadmap_tbl;
1126 DIAG_Throw(
"error reading 'loadmap'");
1147 if (val && strlen(val) > 0) {
1158 if (val && strlen(val) > 0) {
1166 string mpiRankStr, tidStr;
1184 bool haveTrace =
false;
1185 string traceFileName;
1187 string traceMinTimeStr, traceMaxTimeStr;
1188 uint64_t traceMinTime = UINT64_MAX, traceMaxTime = 0;
1192 traceMinTimeStr = val;
1198 traceMaxTimeStr = val;
1202 haveTrace = (traceMinTime != 0 && traceMaxTime != 0);
1205 if (haveTrace && !profFileName.empty()) {
1210 traceFileName = profFileName;
1211 size_t ext_pos = traceFileName.find(ext_prof);
1212 if (ext_pos != string::npos) {
1213 traceFileName.replace(traceFileName.begin() + ext_pos,
1214 traceFileName.end(), ext_trace);
1226 bool isVirtualMetrics =
false;
1228 if (val && strcmp(val,
"0") != 0) {
1229 isVirtualMetrics =
true;
1230 rFlags |= RFlg_NoMetricValues;
1248 if (!traceFileName.empty()) {
1261 if (!mpiRankStr.empty() && !tidStr.empty()) {
1262 m_sfx =
"[" + mpiRankStr +
"," + tidStr +
"]";
1264 else if (!mpiRankStr.empty()) {
1265 m_sfx =
"[" + mpiRankStr +
"]";
1267 else if (!tidStr.empty()) {
1268 m_sfx =
"[" + tidStr +
"]";
1271 if (rFlags & RFlg_NoMetricSfx) {
1277 for (
uint i = 0; i < numMetricsSrc; i++) {
1284 string nm = mdesc.
name;
1288 bool doMakeInclExcl = (rFlags & RFlg_MakeInclExcl);
1292 doMakeInclExcl =
false;
1297 "Prof::CallPath::Profile::fmt_epoch_fread: unexpected metric type '" 1301 !(rFlags & RFlg_MakeInclExcl)),
1309 profFileName, profRelId,
"HPCRUN");
1315 if (doMakeInclExcl) {
1316 m->
type(Metric::ADesc::TyIncl);
1320 m->
type(Metric::ADesc::TyExcl);
1326 if (!m_sfx.empty()) {
1352 if (doMakeInclExcl) {
1356 profFileName, profRelId,
"HPCRUN");
1357 mSmpl->
type(Metric::ADesc::TyExcl);
1358 if (!m_sfx.empty()) {
1369 if (isVirtualMetrics || (rFlags & RFlg_VirtualMetrics) ) {
1381 if ( !isVirtualMetrics ) {
1384 for (
uint mId = 0; mId < mMgr->
size(); ++mId) {
1395 uint num_lm = loadmap_tbl.len;
1399 for (
uint i = 0; i < num_lm; ++i) {
1400 string nm = loadmap_tbl.lst[i].name;
1406 DIAG_Assert(lm->
id() == i + 1,
"Profile::fmt_epoch_fread: Currently expect load module id's to be in dense ascending order.");
1411 std::vector<LoadMap::MergeEffect>* mrgEffect =
1422 fmt_cct_fread(*prof, infs, rFlags, metricTbl, ctxtStr, outfs);
1434 const metric_tbl_t& metricTbl,
1435 std::string ctxtStr, FILE* outfs)
1437 DIAG_Assert(infs,
"Bad file descriptor!");
1446 uint64_t numNodes = 0;
1454 fprintf(outfs,
"[cct: (num-nodes: %" PRIu64
")\n", numNodes);
1465 uint numMetricsSrc = metricTbl.len;
1467 if (rFlags & RFlg_NoMetricValues) {
1473 nodeFmt.
metrics = (numMetricsSrc > 0) ?
1478 DIAG_DevMsgIf(
DBG_DATA,
". read nodes: " << numNodes );
1480 for (
uint i = 0; i < numNodes; ++i) {
1486 DIAG_Throw(
"Error reading CCT node " << nodeFmt.
id);
1502 for (
uint i = 0; i < numMetricsSrc; i++) {
1503 char *expr = (
char*) m_lst[i].formula;
1504 if (expr ==
NULL || strlen(expr)==0)
continue;
1506 double res = eval.
Eval(expr, &var_map);
1513 int nodeId = (int)nodeFmt.
id;
1519 CCTIdToCCTNodeMap::iterator it = cctNodeMap.find(parentId);
1520 if (it != cctNodeMap.end()) {
1521 node_parent = it->second;
1524 DIAG_Throw(
"Cannot find parent for CCT node " << nodeId);
1533 if (! (abs(parentId) < abs(nodeId))) {
1534 DIAG_Throw(
"CCT node " << nodeId <<
" has invalid parent (" << parentId <<
")");
1542 std::pair<CCT::ADynNode*, CCT::ADynNode*> n2 =
1547 DIAG_DevMsgIf(0,
"fmt_cct_fread: " << hex << node <<
" -> " << node_parent << dec);
1552 if (node->
lmId_real() == LoadMap::LMId_NULL) {
1553 DIAG_WMsg(2, ctxtStr <<
": CCT (non-root) node " << nodeId <<
" has invalid normalized IP: " << node->
nameDyn());
1557 node->
link(node_parent);
1559 node_sib->
link(node_parent);
1563 DIAG_AssertWarn(cct->
empty(), ctxtStr <<
": CCT must only have one root!");
1564 DIAG_AssertWarn(!node_sib, ctxtStr <<
": CCT root cannot be split into interior and leaf!");
1568 cctNodeMap.insert(std::make_pair(nodeFmt.
id, node));
1571 std::cerr <<
"Error id= " << node->
id() <<
": hpcrun node type invalid: " << node->
hpcrun_node_type() <<
"\n" ;
1577 fprintf(outfs,
"]\n");
1599 "TODO:hdr-name",
"TODO:hdr-value",
1608 ret = fmt_epoch_fwrite(prof, fs, wFlags);
1623 const char* virtualMetrics =
"0";
1625 virtualMetrics =
"1";
1630 "TODO:epoch-name",
"TODO:epoch-value",
1631 FmtEpoch_NV_virtualMetrics, virtualMetrics,
1644 for (
uint i = 0; i < numMetrics; i++) {
1653 mdesc.
name =
const_cast<char*
>(nmFmt.c_str());
1654 mdesc.
description =
const_cast<char*
>(desc.c_str());
1686 lm_entry.
id = (uint16_t) lm->
id();
1687 lm_entry.
name =
const_cast<char*
>(lm->
name().c_str());
1697 ret = fmt_cct_fwrite(prof, fs, wFlags);
1715 uint64_t numNodes = 0;
1716 uint nodeId_next = 2;
1738 DIAG_DevMsgIf(
DBG_DATA,
". write nodes: " << numNodes );
1763 DIAG_DevMsgIf(
DBG_DATA,
"CallPath-Profile num nodes: " << numNodes << std::endl);
1786 using namespace Prof;
1794 if (root &&
typeid(*root) ==
typeid(
CCT::Root)) {
1810 secondaryRoot = n_dyn;
1835 if (rFlags & RFlg_HpcrunData) {
1861 root->
link(rootNew);
1864 m_cct->root(rootNew);
1870 if (secondaryRoot) {
1871 secondaryRoot->
link(rootNew);
1883 static std::pair<Prof::CCT::ADynNode*, Prof::CCT::ADynNode*>
1886 const std::string& ctxtStr)
1888 using namespace Prof;
1895 bool isLeaf =
false;
1900 int nodeId = (int)nodeFmt.
id;
1922 if (! (lmId <= loadmap.
size() ) ) {
1923 DIAG_WMsg(1, ctxtStr <<
": CCT node " << nodeId
1924 <<
" has invalid load module: " << lmId);
1925 lmId = LoadMap::LMId_NULL;
1929 DIAG_MsgIf(0,
"cct_makeNode(: "<< hex << lmIP << dec <<
", " << lmId <<
")");
1935 lip = CCT::ADynNode::clone_lip(&nodeFmt.
lip);
1941 if (! (lip_lmId <= loadmap.
size() ) ) {
1942 DIAG_WMsg(1, ctxtStr <<
": CCT node " << nodeId
1943 <<
" has invalid (logical) load module: " << lip_lmId);
1944 lip_lmId = LoadMap::LMId_NULL;
1946 loadmap.
lm(lip_lmId)->
isUsed(
true);
1956 bool hasMetrics =
false;
1965 for (
uint i_dst = 0, i_src = 0; i_dst < numMetricsDst; i_dst++) {
1968 DIAG_Assert(mdesc,
"inconsistency: no corresponding SampledDesc!");
1982 mval = (double)m.
i;
break;
1989 metricData.
metric(i_dst) = mval * (double)mdesc->
period();
2007 if (doZeroMetrics) {
2023 if (hasMetrics || isLeaf) {
2024 n =
new CCT::Stmt(
NULL, cpId, nodeFmt, lmId, lmIP, opIdx, lip,
2034 uint mSz = (doZeroMetrics) ? 0 : numMetricsDst;
2037 lush_lip_t* lipCopy = CCT::ADynNode::clone_lip(lip);
2040 lipCopy, metricData0);
2048 return std::make_pair(n, n_leaf);
2066 std::cerr <<
"Error: invalid-node-type: " << n_fmt.
node_type <<
", id: " << n_fmt.
id <<
"\n";
2085 n_fmt.
lm_ip = n_dyn.Prof::CCT::ADynNode::lmIP();
2103 DIAG_Die(
"fmt_cct_makeNode: unknown CCT node type");
void hpcrun_fmt_epochHdr_free(hpcrun_fmt_epochHdr_t *ehdr, hpcfmt_free_fn dealloc)
virtual void fileId(uint _id)=0
int hpcrun_fmt_hdr_fprint(hpcrun_fmt_hdr_t *hdr, FILE *fs)
#define HPCRUN_FMT_NV_tid
static const char * getFileName(Struct::ANode *strct)
static void writeXML_help(std::ostream &os, const char *entry_nm, Struct::Tree *structure, const Struct::ANodeFilter *filter, int type, bool remove_redundancy)
uint64_t m_measurementGranularity
static void lush_lip_setLMId(lush_lip_t *x, uint16_t lmId)
bool insert(Metric::ADesc *m)
int hpctrace_fmt_datum_fwrite(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, FILE *outfs)
const metric_desc_t metricDesc_NULL
void MONITOR_EXT_WRAP_NAME() free(void *ptr)
static const std::string UnknownFileNm
const std::string & nameSfx() const
virtual const char * unified_name()=0
void prof_abort(int error_code)
uint64_t toUInt64(const char *str, unsigned *endidx)
string toStr(const int x, int base)
static bool hpcrun_fmt_doRetainId(uint32_t id)
MetricFlags_ValTy_t valTy
void isMultiplexed(bool isMultiplexedEvent)
virtual const std::string & what() const
MetricFlags_ValFmt_t valFmt
static const char * ADescTyToXMLString(ADescTy type)
hpcrun_metricVal_t & metricObject(size_t mId)
double Eval(EVAL_CHAR *expr, BaseVarMap *var_map)
std::list< MergeEffect > MergeEffectList
std::string m_traceFileName
int hpcrun_fmt_metricTbl_fprint(metric_tbl_t *metric_tbl, metric_aux_info_t *aux_info, FILE *fs)
int hpcrun_fmt_cct_node_fprint(hpcrun_fmt_cct_node_t *x, FILE *fs, epoch_flags_t flags, const metric_tbl_t *metricTbl, const char *pre)
static uint16_t lush_lip_getLMId(const lush_lip_t *x)
lush_assoc_info_t lush_assoc_info_NULL
LoadMap::LMId_t lmId_real() const
double metric(size_t mId) const
std::string nameDyn() const
const hpcrun_metricFlags_t hpcrun_metricFlags_NULL
char versionStr[sizeof(HPCRUN_FMT_Version)]
static const char HPCRUN_TraceFnmSfx[]
static RealPathMgr & singleton()
static bool writeXML_FileFilter(const Struct::ANode &x, long GCC_ATTR_UNUSED type)
virtual uint numAccum() const =0
virtual std::string combineString1() const =0
bool doDispPercent() const
bool isPrimarySynthRoot() const
virtual const std::string & name() const
static int hpcfmt_int4_fwrite(uint32_t val, FILE *outfs)
static const std::string UnknownProcNm
const char * hpcfmt_nvpairList_search(const HPCFMT_List(hpcfmt_nvpair_t) *nvps, const char *name)
static const char HPCRUN_ProfileFnmSfx[]
std::string nameToFmt() const
ANode * firstChild() const
const std::string & linkName() const
int hpcrun_fmt_cct_node_fread(hpcrun_fmt_cct_node_t *x, epoch_flags_t flags, FILE *fs)
std::string MakeAttrStr(const char *x, int flags=ESC_TRUE)
int hpcrun_fmt_loadmap_fread(loadmap_t *loadmap, FILE *fs, hpcfmt_alloc_fn alloc)
#define DIAG_MsgIf(ifexpr,...)
std::string toString() const
int hpcrun_fmt_hdr_fwrite(FILE *fs,...)
void sampling_type(SamplingType_t type)
const std::string & name() const
static std::pair< Prof::CCT::ADynNode *, Prof::CCT::ADynNode * > cct_makeNode(Prof::CallPath::Profile &prof, const hpcrun_fmt_cct_node_t &nodeFmt, uint rFlags, const std::string &ctxtStr)
hpcfmt_uint_t num_metrics
void hpcrun_fmt_metricTbl_free(metric_tbl_t *metric_tbl, hpcfmt_free_fn dealloc)
#define HPCRUN_FMT_NV_mpiRank
void hpcrun_fmt_loadmap_free(loadmap_t *loadmap, hpcfmt_free_fn dealloc)
void num_samples(const uint64_t samples)
int hpcrun_fmt_epochHdr_fprint(hpcrun_fmt_epochHdr_t *ehdr, FILE *fs)
const char * pretty_name() const
void lm_insert(LoadMap::LM *x)
unsigned short int ushort
bool realpath(std::string &pathNm) const
std::string toString(const char *pfx="") const
MergeEffectList * merge(const Tree *y, uint x_newMetricBegIdx, uint mrgFlag=0, uint oFlag=0)
virtual std::string toValueTyStringXML() const
static std::map< std::string, uint, StringCompare > m_mapFiles
hpcrun_metricFlags_fields fields
union lush_lip lush_lip_t
int hpcrun_fmt_metricDesc_fwrite(metric_desc_t *x, metric_aux_info_t *aux_info, FILE *fs)
lush_assoc_info_t as_info
#define HPCRUN_METRIC_RetCnt
static int hpcfmt_int8_fread(uint64_t *val, FILE *infs)
static const LMId_t LMId_NULL
virtual const std::string & name() const
virtual std::string finalizeString() const =0
virtual const std::string & name() const
File * ancestorFile() const
uint dbNumMetrics() const
uint merge(Profile &y, int mergeTy, uint mrgFlag=0)
static int hpcfmt_int8_fwrite(uint64_t val, FILE *outfs)
const std::string dbFileGlob() const
const LoadMap * loadmap() const
std::map< int, Prof::CCT::ANode * > CCTIdToCCTNodeMap
static void lush_lip_init(lush_lip_t *x)
SimpleSymbolsFactories simpleSymbolsFactories
virtual void id(uint _id)=0
epoch_flags_bitfield fields
static void fmt_cct_makeNode(hpcrun_fmt_cct_node_t &n_fmt, const Prof::CCT::ANode &n, epoch_flags_t flags)
virtual ADesc * clone() const
#define HPCRUN_FMT_NV_traceMaxTime
SimpleSymbolsFactory * find(const char *pathname)
LoadMap::LMId_t lmId() const
bool m_isMetricMgrVirtual
lush_assoc_info_t assocInfo() const
bool isSecondarySynthRoot() const
int hpcrun_fmt_loadmap_fprint(loadmap_t *loadmap, FILE *fs)
const Metric::Mgr * metricMgr() const
static const char HPCPROF_TmpFnmSfx[]
static bool lush_lip_eq(const lush_lip_t *x, const lush_lip_t *y)
const char * DIAG_UnexpectedInput
uint64_t measurementGranularity
int hpcrun_fmt_hdr_fread(hpcrun_fmt_hdr_t *hdr, FILE *infs, hpcfmt_alloc_fn alloc)
static std::map< std::string, uint, StringCompare > m_mapProcs
std::map< uint, uint > m_mapProcIDs
StringSet m_traceFileNameSet
const char * normalize_name(const char *in, int &fake_procedure)
int hpcrun_fmt_cct_node_fwrite(hpcrun_fmt_cct_node_t *x, epoch_flags_t flags, FILE *fs)
#define HPCRUN_FMT_NV_envPath
void hpcrun_node_type(uint16_t type)
hpctrace_hdr_flags_t flags
void *MONITOR_EXT_WRAP_NAME() malloc(size_t bytes)
enum Prof::Metric::SamplingType_e SamplingType_t
void canonicalize(uint rFlags=0)
#define HPCRUN_FMT_NV_traceMinTime
int hpcrun_fmt_loadmapEntry_fwrite(loadmap_entry_t *x, FILE *fs)
FILE * hpcio_fopen_r(const char *fnm)
std::string MakeAttrNum(int x)
static const double HPCRUN_FMT_Version_20
std::vector< LoadMap::MergeEffect > * merge(const LoadMap &y)
int hpcrun_fmt_metricTbl_fread(metric_tbl_t *metric_tbl, metric_aux_info_t **aux_info, FILE *fs, double fmtVersion, hpcfmt_alloc_fn alloc)
static bool hpcrun_metricVal_isZero(hpcrun_metricVal_t x)
uint findGroup(const Mgr &y_mMgr) const
Metric::ADesc * metric(uint i)
const std::string & description() const
int hpcrun_fmt_epochHdr_fread(hpcrun_fmt_epochHdr_t *ehdr, FILE *fs, hpcfmt_alloc_fn alloc)
int hpctrace_fmt_hdr_fread(hpctrace_fmt_hdr_t *hdr, FILE *infs)
virtual NonUniformDegreeTreeNode * Current() const
int hpcio_fclose(FILE *fs)
void hpcrun_fmt_hdr_free(hpcrun_fmt_hdr_t *hdr, hpcfmt_free_fn dealloc)
int hpctrace_fmt_datum_fread(hpctrace_fmt_datum_t *x, hpctrace_hdr_flags_t flags, FILE *fs)
hpcrun_metricFlags_t flags() const
static const int HPCTRACE_FMT_HeaderLen
bool implies(bool p, bool q)
void merge_fixCCT(const std::vector< LoadMap::MergeEffect > *mrgEffects)
int hpcrun_fmt_epochHdr_fwrite(FILE *fs, epoch_flags_t flags, uint64_t measurementGranularity,...)
<!-- ********************************************************************--> n<!-- HPCToolkit Experiment DTD --> n<!-- Version 2.1 --> n<!-- ********************************************************************--> n<!ELEMENT HPCToolkitExperiment(Header,(SecCallPathProfile|SecFlatProfile) *)> n<!ATTLIST HPCToolkitExperiment\n version CDATA #REQUIRED > n n<!-- ******************************************************************--> n n<!-- Info/NV:flexible name-value pairs:(n) ame;(t) ype;(v) alue --> n<!ELEMENT Info(NV *)> n<!ATTLIST Info\n n CDATA #IMPLIED > n<!ELEMENT NV EMPTY > n<!ATTLIST NV\n n CDATA #REQUIRED\n t CDATA #IMPLIED\n v CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Header --> n<!-- ******************************************************************--> n<!ELEMENT Header(Info *)> n<!ATTLIST Header\n n CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Section Header --> n<!-- ******************************************************************--> n<!ELEMENT SecHeader(MetricTable?, MetricDBTable?, TraceDBTable?, LoadModuleTable?, FileTable?, ProcedureTable?, Info *)> n n<!-- MetricTable:--> n<!ELEMENT MetricTable(Metric) * > n n<!-- Metric:(i) d;(n) ame --> n<!--(v) alue-type:transient type of values --> n<!--(t) ype:persistent type of metric --> n<!-- fmt:format;show;--> n<!ELEMENT Metric(MetricFormula *, Info?)> n<!ATTLIST Metric\n i CDATA #REQUIRED\n n CDATA #REQUIRED\n es CDATA #IMPLIED\n em CDATA #IMPLIED\n ep CDATA #IMPLIED\n v(raw|final|derived-incr|derived) \"raw\\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ fmt CDATA #IMPLIED\ show (1|0) \1\\ show-percent (1|0) \1> n n<!-- MetricFormula represents derived metrics: (t)ype; (frm): formula --> n<!ELEMENT MetricFormula (Info?)> n<!ATTLIST MetricFormula\ t (combine|finalize) \finalize\\ i CDATA #IMPLIED\ frm CDATA #REQUIRED> n n<!-- Metric data, used in sections: (n)ame [from Metric]; (v)alue --> n<!ELEMENT M EMPTY> n<!ATTLIST M\ n CDATA #REQUIRED\ v CDATA #REQUIRED> n n<!-- MetricDBTable: --> n<!ELEMENT MetricDBTable (MetricDB)*> n n<!-- MetricDB: (i)d; (n)ame --> n<!-- (t)ype: persistent type of metric --> n<!-- db-glob: file glob describing files in metric db --> n<!-- db-id: id within metric db --> n<!-- db-num-metrics: number of metrics in db --> n<!-- db-header-sz: size (in bytes) of a db file header --> n<!ELEMENT MetricDB EMPTY> n<!ATTLIST MetricDB\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ db-glob CDATA #IMPLIED\ db-id CDATA #IMPLIED\ db-num-metrics CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- TraceDBTable: --> n<!ELEMENT TraceDBTable (TraceDB)> n n<!-- TraceDB: (i)d --> n<!-- db-min-time: min beginning time stamp (global) --> n<!-- db-max-time: max ending time stamp (global) --> n<!ELEMENT TraceDB EMPTY> n<!ATTLIST TraceDB\ i CDATA #REQUIRED\ db-glob CDATA #IMPLIED\ db-min-time CDATA #IMPLIED\ db-max-time CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- LoadModuleTable assigns a short name to a load module --> n<!ELEMENT LoadModuleTable (LoadModule)*> n n<!ELEMENT LoadModule (Info?)> n<!ATTLIST LoadModule\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- FileTable assigns a short name to a file --> n<!ELEMENT FileTable (File)*> n n<!ELEMENT File (Info?)> n<!ATTLIST File\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- ProcedureTable assigns a short name to a procedure --> n<!ELEMENT ProcedureTable (Procedure)*> n n<!-- Info/NV: flexible name-value pairs: (n)ame; (t)ype; (v)alue --> n<!-- f: family of the procedure (fake, root, ...)--> n<!ELEMENT Procedure (Info?)> n<!ATTLIST Procedure\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ f CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Call path profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecCallPathProfile (SecHeader, SecCallPathProfileData)> n<!ATTLIST SecCallPathProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecCallPathProfileData (PF|M)*> n<!-- Procedure frame --> n<!-- (i)d: unique identifier for cross referencing --> n<!-- (s)tatic scope id --> n<!-- (n)ame: a string or an id in ProcedureTable --> n<!-- (lm) load module: a string or an id in LoadModuleTable --> n<!-- (f)ile name: a string or an id in LoadModuleTable --> n<!-- (l)ine range: \beg-end\ (inclusive range) --> n<!-- (a)lien: whether frame is alien to enclosing P --> n<!-- (str)uct: hpcstruct node id --> n<!-- (t)ype: hpcrun node type: memory access, variable declaration, ... --> n<!-- (v)ma-range-set: \{[beg-end), [beg-end)...}\ --> n<!ELEMENT PF (PF|Pr|L|C|S|M)*> n<!ATTLIST PF\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Procedure (static): GOAL: replace with 'P' --> n<!ELEMENT Pr (Pr|L|C|S|M)*> n<!ATTLIST Pr\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ a (1|0) \0\\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Callsite (a special StatementRange) --> n<!ELEMENT C (PF|M)*> n<!ATTLIST C\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Flat profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecFlatProfile (SecHeader, SecFlatProfileData)> n<!ATTLIST SecFlatProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecFlatProfileData (LM|M)*> n<!-- Load module: (i)d; (n)ame; (v)ma-range-set --> n<!ELEMENT LM (F|P|M)*> n<!ATTLIST LM\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ v CDATA #IMPLIED> n<!-- File --> n<!ELEMENT F (P|L|S|M)*> n<!ATTLIST F\ i CDATA #IMPLIED\ n CDATA #REQUIRED> n<!-- Procedure (Note 1) --> n<!ELEMENT P (P|A|L|S|C|M)*> n<!ATTLIST P\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Alien (Note 1) --> n<!ELEMENT A (A|L|S|C|M)*> n<!ATTLIST A\ i CDATA #IMPLIED\ f CDATA #IMPLIED\ n CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Loop (Note 1,2) --> n<!ELEMENT L (A|Pr|L|S|C|M)*> n<!ATTLIST L\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ f CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Statement (Note 2) --> n<!-- (it): trace record identifier --> n<!ELEMENT S (S|M)*> n<!ATTLIST S\ i CDATA #IMPLIED\ it CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Note 1: Contained Cs may not contain PFs --> n<!-- Note 2: The 's' attribute is not used for flat profiles --> n
void merge_fixTrace(const CCT::MergeEffectList *mrgEffects)
const ANodeFilter ANodeTyFilter[ANode::TyNUMBER]
virtual std::string combineString2() const =0
void hpcrun_fmt_metric_set_value(metric_desc_t metric_desc, hpcrun_metricVal_t *metric, double value)
std::string m_profileFileName
virtual NonUniformDegreeTreeNode * Current() const
hpcrun_metricFlags_t flags
void hpcrun_getFileErrorString(const std::string &fnm, std::string &errorString)
static const int HPCMETRICDB_FMT_HeaderLen
FILE * hpcio_fopen_w(const char *fnm, int overwrite)
hpcrun_metricVal_t * metrics
bool isMetricMgrVirtual() const
void periodMean(float periodMeanEvent)
Prof::Struct::Tree * m_structure
virtual uint accumId(int) const =0
bool operator()(const std::string n1, const std::string n2) const
#define HPCRUN_FMT_NV_prog
std::map< uint, uint > m_mapFileIDs
#define HPCRUN_FMT_CCTNodeId_NULL
std::map< uint, uint > m_pairFakeLoadModule
int hpctrace_fmt_hdr_fwrite(hpctrace_hdr_flags_t flags, FILE *fs)
virtual NonUniformDegreeTreeNode * Current() const
static bool writeXML_ProcFilter(const Struct::ANode &x, long GCC_ATTR_UNUSED type)