60 #ifndef prof_Prof_CCT_Tree_hpp 61 #define prof_Prof_CCT_Tree_hpp 111 os <<
"[" << x.
i <<
" " << x.
r <<
"]";
139 OFlg_Compressed = (1 << 0),
140 OFlg_LeafMetricsOnly = (1 << 1),
141 OFlg_Debug = (1 << 2),
142 OFlg_DebugAll = (1 << 3),
143 OFlg_StructId = (1 << 4)
169 {
return (m_root ==
NULL); }
173 {
return m_metadata; }
179 merge(
const Tree* y,
uint x_newMetricBegIdx,
189 makeDensePreorderIds();
194 {
return m_maxDenseId; }
201 findNode(
uint nodeId)
const;
209 pruneCCTByNodeId(
const uint8_t* prunedNodes);
227 uint oFlags = 0)
const;
230 dump(
const Metric::Mgr *metricMgr, std::ostream& os = std::cerr,
uint oFlags = 0)
const;
237 return m_nodeidMap->size();
245 doXMLEscape(
uint oFlags);
299 typedef std::vector<ANode*>
Vec;
313 static const std::string&
317 IntToANodeType(
long i);
321 static const std::string NodeNames[TyNUMBER];
328 m_type(type), m_hpcrun_type(
NODE_TYPE_REGULAR), m_id(s_nextUniqueId), m_strct(strct)
336 Metric::IData(metrics),
337 m_type(type), m_hpcrun_type(
NODE_TYPE_REGULAR),m_id(s_nextUniqueId), m_strct(strct)
393 virtual const std::string&
395 {
return ANodeTyToName(type()); }
410 {
return (m_strct) ? m_strct->id() : 0; }
414 {
return (m_strct) ? m_strct->begLine() :
ln_NULL; }
418 {
return (m_strct) ? m_strct->endLine() :
ln_NULL; }
423 { m_hpcrun_type = type; }
427 {
return m_hpcrun_type; }
449 if (parent()->lastChild() !=
this) {
459 if (parent()->firstChild() !=
this) {
474 ancestorRoot()
const;
477 ancestorProcFrm()
const;
480 ancestorProc()
const;
483 ancestorLoop()
const;
486 ancestorCall()
const;
489 ancestorStmt()
const;
498 zeroMetricsDeep(
uint mBegId,
uint mEndId);
504 aggregateMetricsIncl(
uint mBegId,
uint mEndId);
511 { aggregateMetricsIncl(mBegId, mBegId + 1); }
517 aggregateMetricsExcl(
uint mBegId,
uint mEndId);
524 { aggregateMetricsExcl(mBegId, mBegId + 1); }
562 const ANode* root,
double thresholdPct,
563 uint8_t* prunedNodes =
NULL);
567 pruneChildrenByNodeId(
const uint8_t* prunedNodes);
571 pruneByNodeId(
ANode*& x,
const uint8_t* prunedNodes);
578 deleteChaff(
ANode* x, uint8_t* deletedNodes =
NULL);
592 std::list<MergeEffect>*
616 findDynChild(
const ADynNode& y_dyn);
626 makeDensePreorderIds(
uint nextId);
634 toString(
const Metric::Mgr *metricMgr,
uint oFlags = 0,
const char* pfx =
"")
const;
637 toStringMe(
uint oFlags = 0)
const;
644 uint oFlags = 0,
const char* pfx =
"")
const;
648 writeXML_path(std::ostream& os,
652 uint oFlags = 0,
const char* pfx =
"")
const;
656 std::ostream& os = std::cerr,
uint oFlags = 0,
const char* pfx =
"")
const;
673 writeXML_pre(std::ostream& os,
const Metric::Mgr *metricMgr,
677 const char* pfx =
"")
const;
679 writeXML_post(std::ostream& os,
uint oFlags = 0,
const char* pfx =
"")
const;
687 mergeDeep_fixInsert(
int newMetrics,
MergeContext& mrgCtxt);
723 :
ANode(type, parent, strct),
726 m_lmId(
LoadMap::LMId_NULL), m_lmIP(0), m_opIdx(0), m_lip(
NULL)
732 :
ANode(type, parent, strct),
734 m_as_info(node_fmt.as_info),
735 m_lmId(lmId), m_lmIP(ip), m_opIdx(opIdx), m_lip(lip)
742 :
ANode(type, parent, strct, metrics),
744 m_as_info(node_fmt.as_info),
745 m_lmId(lmId), m_lmIP(ip), m_opIdx(opIdx), m_lip(lip)
755 m_as_info(x.m_as_info),
757 m_lmIP(x.m_lmIP), m_opIdx(x.m_opIdx),
758 m_lip(clone_lip(x.m_lip))
776 m_lip = clone_lip(x.
m_lip);
806 {
return m_as_info; }
951 if (x.
isLeaf() && (x_strct && y_strct)
954 && ((x_strct == y_strct) ||
955 (ancestorIfNotProc(x_strct) == ancestorIfNotProc(y_strct)
985 assocInfo_str()
const;
994 writeDyn(std::ostream& os,
uint oFlags = 0,
const char*
prefix =
"")
const;
1027 :
ANode(type, parent, strct)
1043 ANode::operator=(x);
1053 virtual const std::string&
1055 {
return (m_strct) ? m_strct->ancestorLM()->name() : BOGUS; }
1059 {
return (m_strct) ? m_strct->ancestorLM()->id() : 0; }
1062 virtual const std::string&
1066 return (isAlien()) ?
1080 id = (isAlien()) ? m_strct->id() : m_strct->ancestorFile()->id();
1085 virtual const std::string&
1087 {
return (m_strct) ? m_strct->name() : BOGUS; }
1091 {
return (m_strct) ? m_strct->id() : 0; }
1095 isAlien()
const = 0;
1125 m_name((nm) ? nm :
"")
1136 toStringMe(
uint oFlags = 0)
const;
1170 virtual const std::string&
1172 {
return (m_strct) ? m_strct->ancestorFile()->name() : BOGUS; }
1176 {
return (m_strct) ? m_strct->ancestorFile()->id() : 0; }
1183 procNameDbg()
const;
1191 toStringMe(
uint oFlags = 0)
const;
1223 {
return (m_strct &&
typeid(*m_strct) ==
typeid(
Struct::Alien)); }
1231 toStringMe(
uint oFlags = 0)
const;
1247 :
ANode(TyLoop, parent, strct)
1265 toStringMe(
uint oFlags = 0)
const;
1289 cpId, node_fmt, lmId, ip, opIdx, lip,
1300 VMA ip = ADynNode::lmIP_real();
1301 if (isValid_lip()) {
1306 return (ip != 0) ? (ip - 1) : 0;
1312 {
return ADynNode::lmIP_real(); }
1316 toStringMe(
uint oFlags = 0)
const;
1332 m_id_node_alloc(0), m_node_alloc(
NULL), m_start_address(0)
1340 cpId, node_fmt, lmId, ip, opIdx, lip,
1341 metrics), m_id_node_alloc(0), m_node_alloc(
NULL), m_start_address(0)
1351 ADynNode::operator=(x);
1359 m_id_node_alloc = id;
1365 return m_id_node_alloc;
1371 m_start_address = address;
1377 return m_start_address;
1383 m_node_alloc =
node;
1389 return m_node_alloc;
1394 toStringMe(
uint oFlags = 0)
const;
Struct::ACodeNode * structure() const
uint16_t hpcrun_node_type() const
ADynNode & operator=(const ADynNode &x)
AProcNode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct)
static void lush_lip_setLMId(lush_lip_t *x, uint16_t lmId)
void aggregateMetricsExcl(uint mBegId)
virtual const std::string & fileName() const
virtual uint procId() const
Call(ANode *parent, uint cpId)
ADynNode(const ADynNode &x)
virtual bool isAlien() const
const std::string & name() const
static bool hasMergeEffects(const ADynNode &x, const ADynNode &y)
Struct::ACodeNode * m_strct
void writeXML(std::ostream &os, const Prof::Struct::Tree &strctTree, bool prettyPrint)
std::list< MergeEffect > MergeEffectList
ANode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct=NULL)
Proc(ANode *parent, Struct::ACodeNode *strct=NULL)
static uint16_t lush_lip_getLMId(const lush_lip_t *x)
Stmt(ANode *parent, uint cpId, hpcrun_fmt_cct_node_t node_fmt, LoadMap::LMId_t lmId, VMA ip, ushort opIdx, lush_lip_t *lip, const Metric::IData &metrics)
SrcFile::ln endLine() const
lush_assoc_info_t lush_assoc_info_NULL
static bool isMergable(const ADynNode &x, const ADynNode &y)
LoadMap::LMId_t lmId_real() const
Stmt & operator=(const Stmt &x)
ANode * lastChild() const
ACodeNode * ACodeNodeParent() const
virtual uint fileId() const
bool isPrimarySynthRoot() const
virtual const std::string & name() const
lush_assoc_info_t m_as_info
ADynNode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct, uint cpId, hpcrun_fmt_cct_node_t node_fmt, LoadMap::LMId_t lmId, VMA ip, ushort opIdx, lush_lip_t *lip)
ADynNode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct, uint cpId)
ANode * firstChild() const
std::ostream & operator<<(std::ostream &os, const hpcrun_metricVal_t x)
static void lush_lip_setLMIP(lush_lip_t *x, uint64_t lm_ip)
unsigned short int ushort
static uint64_t lush_lip_getLMIP(const lush_lip_t *x)
static uint s_nextUniqueId
virtual bool isAlien() const
virtual const std::string & name() const
ANode * nextSibling() const
SrcFile::ln begLine() const
AProcNode(const AProcNode &x)
union lush_lip lush_lip_t
void structure(const Struct::ACodeNode *strct)
virtual uint fileId() const
std::map< uint, ANode * > NodeIdToANodeMap
#define HPCRUN_FMT_LMIp_Flag1
ProcFrm(const ProcFrm &x)
static const LMId_t LMId_NULL
lush_assoc_t assoc() const
const CallPath::Profile * m_metadata
virtual const std::string & procName() const
File * ancestorFile() const
virtual const std::string & lmName() const
int ANodeLineComp(ANode *x, ANode *y)
void aggregateMetricsIncl(uint mBegId)
virtual uint lmId() const
static lush_assoc_t lush_assoc_info__get_assoc(lush_assoc_info_t x)
LoadMap::LMId_t lmId() const
ANode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct, const Metric::IData &metrics)
lush_assoc_info_t assocInfo() const
bool isSecondarySynthRoot() const
AProcNode & operator=(const AProcNode &x)
static bool lush_lip_eq(const lush_lip_t *x, const lush_lip_t *y)
void lmIP(VMA lmIP, ushort opIdx)
enum lush_assoc lush_assoc_t
const CallPath::Profile * metadata() const
void hpcrun_node_type(uint16_t type)
Call(ANode *parent, uint cpId, hpcrun_fmt_cct_node_t node_fmt, LoadMap::LMId_t lmId, VMA ip, ushort opIdx, lush_lip_t *lip, const Metric::IData &metrics)
virtual uint fileId() const
void lmId(LoadMap::LMId_t x)
void start_address(uint64_t address)
int metrics[MAX_EVENTS][MAX_METRICS]
static bool lush_assoc_info__path_len_eq(lush_assoc_info_t x, lush_assoc_info_t y)
Root(const std::string &nm)
std::vector< ANode * > Vec
Stmt(ANode *parent, uint cpId)
#define NODE_TYPE_REGULAR
virtual const std::string & fileName() const
void assocInfo(lush_assoc_info_t x)
ANode & operator=(const ANode &x)
void id_node_alloc(uint id)
void lip(const lush_lip_t *lip)
static Struct::ACodeNode * ancestorIfNotProc(Struct::ACodeNode *n)
SrcFile::ln begLine() const
IData & operator=(const IData &x)
ANode * prevSibling() const
void node_alloc(ANode *node)
static lush_lip_t * clone_lip(const lush_lip_t *x)
static bool lush_assoc_class_eq(lush_assoc_t x, lush_assoc_t y)
<!-- ********************************************************************--> 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
ProcFrm(ANode *parent, Struct::ACodeNode *strct=NULL)
MergeContext * m_mergeCtxt
void lmId_real(LoadMap::LMId_t x)
#define HPCRUN_FMT_LMIp_NULL
NodeIdToANodeMap * m_nodeidMap
#define HPCRUN_FMT_CCTNodeId_NULL
Loop(ANode *parent, Struct::ACodeNode *strct=NULL)
ADynNode(ANodeTy type, ANode *parent, Struct::ACodeNode *strct, uint cpId, hpcrun_fmt_cct_node_t node_fmt, LoadMap::LMId_t lmId, VMA ip, ushort opIdx, lush_lip_t *lip, const Metric::IData &metrics)