HPCToolkit
CallPath.hpp
Go to the documentation of this file.
1 // -*-Mode: C++;-*-
2 
3 // * BeginRiceCopyright *****************************************************
4 //
5 // $HeadURL$
6 // $Id$
7 //
8 // --------------------------------------------------------------------------
9 // Part of HPCToolkit (hpctoolkit.org)
10 //
11 // Information about sources of support for research and development of
12 // HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
13 // --------------------------------------------------------------------------
14 //
15 // Copyright ((c)) 2002-2019, Rice University
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are
20 // met:
21 //
22 // * Redistributions of source code must retain the above copyright
23 // notice, this list of conditions and the following disclaimer.
24 //
25 // * Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimer in the
27 // documentation and/or other materials provided with the distribution.
28 //
29 // * Neither the name of Rice University (RICE) nor the names of its
30 // contributors may be used to endorse or promote products derived from
31 // this software without specific prior written permission.
32 //
33 // This software is provided by RICE and contributors "as is" and any
34 // express or implied warranties, including, but not limited to, the
35 // implied warranties of merchantability and fitness for a particular
36 // purpose are disclaimed. In no event shall RICE or contributors be
37 // liable for any direct, indirect, incidental, special, exemplary, or
38 // consequential damages (including, but not limited to, procurement of
39 // substitute goods or services; loss of use, data, or profits; or
40 // business interruption) however caused and on any theory of liability,
41 // whether in contract, strict liability, or tort (including negligence
42 // or otherwise) arising in any way out of the use of this software, even
43 // if advised of the possibility of such damage.
44 //
45 // ******************************************************* EndRiceCopyright *
46 
47 //***************************************************************************
48 //
49 // File:
50 // $HeadURL$
51 //
52 // Purpose:
53 // [The purpose of this file]
54 //
55 // Description:
56 // [The set of functions, macros, etc. defined in the file]
57 //
58 //***************************************************************************
59 
60 #ifndef Analysis_CallPath_CallPath_hpp
61 #define Analysis_CallPath_CallPath_hpp
62 
63 //************************* System Include Files ****************************
64 
65 #include <iostream>
66 #include <vector>
67 #include <stack>
68 #include <string>
69 
70 //*************************** User Include Files ****************************
71 
72 #include <include/uint.h>
73 
74 #include "Args.hpp"
75 #include "Util.hpp"
76 
77 #include <lib/binutils/LM.hpp>
78 
80 #include <lib/prof/Struct-Tree.hpp>
81 
82 //*************************** Forward Declarations ***************************
83 
84 //****************************************************************************
85 
86 namespace Analysis {
87 
88 namespace CallPath {
89 
90 extern std::ostream* dbgOs; // for parallel debugging
91 
92 
93 // ---------------------------------------------------------
94 //
95 // ---------------------------------------------------------
96 
98 read(const Util::StringVec& profileFiles, const Util::UIntVec* groupMap,
99  int mergeTy, uint rFlags = 0, uint mrgFlags = 0);
100 
102 read(const char* prof_fnm, uint groupId, uint rFlags = 0);
103 
104 static inline Prof::CallPath::Profile*
105 read(const string& prof_fnm, uint groupId, uint rFlags = 0)
106 {
107  return read(prof_fnm.c_str(), groupId, rFlags);
108 }
109 
110 
111 void
113 
114 
115 // ---------------------------------------------------------
116 //
117 // ---------------------------------------------------------
118 
119 // overlayStaticStructure: In the CCT collected by hpcrun, call sites
120 // (CCT::Call) and statements (CCT::Stmt) have no procedure frames.
121 // Overlaying static structure creates frames for CCT::Call and
122 // CCT::Stmt nodes.
123 //
124 // After static structure has been overlayed on the CCT, CCT::Stmt's
125 // are still distinct by instruction pointer even if they map to the
126 // same Struct::Stmt. Currently,
127 // coalesceStmts(Prof::CallPath::Profile) applies the Non-Overlapping
128 // Principle to scope within the CCT.
129 //
130 // The resulting CCT obeys the following invariants:
131 // - Every CCT:Call node has one or more CCT::ProcFrm nodes as
132 // children. Conversely, except for the root, every CCT::ProcFrm
133 // has a CCT::Call node for a parent.
134 // - Every CCT::Call and CCT::Stmt is a descendant of a CCT::ProcFrm
135 // - A CCT::Stmt node is always a leaf.
136 void
138  string agent, bool doNormalizeTy,
139  bool printProgress);
140 
141 void
143  Prof::LoadMap::LM* loadmap_lm,
144  Prof::Struct::LM* lmStrct,
145  bool printProgress);
146 
147 
148 // lm is optional and may be NULL
149 void
151  Prof::LoadMap::LM* loadmap_lm,
152  Prof::Struct::LM* lmStrct, BinUtil::LM* lm);
153 
154 // specialty function for hpcprof-mpi
155 void
157 
158 void
159 pruneBySummaryMetrics(Prof::CallPath::Profile& prof, uint8_t* prunedNodes);
160 
161 void
162 normalize(Prof::CallPath::Profile& prof, string agent, bool doNormalizeTy);
163 
164 void
166 
167 
168 // ---------------------------------------------------------
169 //
170 // ---------------------------------------------------------
171 
172 void
174 
175 void
177 
178 
179 // ---------------------------------------------------------
180 //
181 // ---------------------------------------------------------
182 
183 void
185 
186 
187 } // namespace CallPath
188 
189 } // namespace Analysis
190 
191 //****************************************************************************
192 
193 #endif // Analysis_CallPath_CallPath_hpp
void readStructure(Prof::Struct::Tree *structure, const Analysis::Args &args)
Definition: CallPath.cpp:210
void applySummaryMetricAgents(Prof::CallPath::Profile &prof, string agent)
Definition: CallPath.cpp:1015
void normalize(Prof::CallPath::Profile &prof, string agent, bool doNormalizeTy)
void overlayStaticStructureMain(Prof::CallPath::Profile &prof, string agent, bool doNormalizeTy, bool printProgress)
Definition: CallPath.cpp:347
void pruneStructTree(Prof::CallPath::Profile &prof)
Definition: CallPath.cpp:839
std::vector< uint > UIntVec
Definition: Util.hpp:109
void makeDatabase(Prof::CallPath::Profile &prof, const Analysis::Args &args)
Definition: CallPath.cpp:1106
unsigned int uint
Definition: uint.h:124
void pruneBySummaryMetrics(Prof::CallPath::Profile &prof, uint8_t *prunedNodes)
Definition: CallPath.cpp:805
void noteStaticStructureOnLeaves(Prof::CallPath::Profile &prof)
Definition: CallPath.cpp:454
Prof::CallPath::Profile * read(const Util::StringVec &profileFiles, const Util::UIntVec *groupMap, int mergeTy, uint rFlags, uint mrgFlags)
Definition: CallPath.cpp:142
void overlayStaticStructure(Prof::CallPath::Profile &prof, Prof::LoadMap::LM *loadmap_lm, Prof::Struct::LM *lmStrct, BinUtil::LM *lm)
Definition: CallPath.cpp:443
std::ostream * dbgOs
Definition: CallPath.cpp:117
std::vector< std::string > StringVec
Definition: Util.hpp:108
void applyThreadMetricAgents(Prof::CallPath::Profile &prof, string agent)
Definition: CallPath.cpp:985