HPCToolkit
CallPath-MetricComponentsFact.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_MetricComponentsFact_hpp
61 #define Analysis_CallPath_MetricComponentsFact_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 
75 
76 //*************************** Forward Declarations ***************************
77 
78 //****************************************************************************
79 
80 namespace Analysis {
81 
82 namespace CallPath {
83 
84 
86 {
87 public:
89 
90  virtual ~MetricComponentsFact() { }
91 
92  virtual void
94 
95  virtual bool
96  isSeparable(const Prof::CCT::AProcNode* x) = 0;
97 
98 protected:
99 
100  void
102  const std::vector<uint>& m_src, const std::vector<uint>& m_dst,
103  bool isSeparableCtxt);
104 
105 
106  static inline bool
108  {
109  const std::string& nm = mdesc->nameBase();
110  return ((nm.find("PAPI_TOT_CYC") == 0) || (nm.find("WALLCLOCK") == 0));
111  }
112 
113 
114  static const std::string s_sum; // FIXME: share w/ MetricMgr
115  static const std::string s_cfvar; // FIXME: share w/ MetricMgr
116 
117  static inline bool
118  isDerivedMetric(const Prof::Metric::ADesc* mdesc, const std::string& type)
119  {
120  const std::string& nm = mdesc->nameBase();
121  size_t pos = nm.find(type);
122  return ((pos != std::string::npos) && (pos + type.length() == nm.length()));
123  }
124 
125 
126  static void
128 
129 };
130 
131 
132 //***************************************************************************
133 
135 {
136 public:
139 
140  virtual void
142 
143  virtual bool
145 
146 private:
147  // make imbalance and idleness metrics
148  void
150  const std::vector<uint>& m_src,
151  const std::vector<uint>& m_imbalIncl,
152  const std::vector<uint>& m_imbalExcl,
153  const std::vector<uint>& m_idleIncl,
154  uint mId_bal,
155  Prof::Metric::AExprIncr* balancedExpr,
156  double balancedThreshold,
157  Prof::CCT::ANode* balancedFrm,
158  Prof::CCT::ANode* balancedNode);
159 
160 private:
161  static const std::string s_tag1;
162  static const std::string s_tag2;
163  static const std::string s_tag3;
164 
165 };
166 
167 
168 //***************************************************************************
169 
171 {
172 public:
175 
176  virtual bool
178 
179 private:
180  static const std::string s_tag;
181 
182 };
183 
184 
185 //***************************************************************************
186 
188 {
189 public:
192 
193  virtual bool
195 
196 private:
197  static const std::string s_tag;
198 
199 };
200 
201 
202 //***************************************************************************
203 
204 } // namespace CallPath
205 
206 } // namespace Analysis
207 
208 //****************************************************************************
209 
210 #endif // Analysis_CallPath_MetricComponentsFact_hpp
static void convertToWorkMetric(Prof::Metric::ADesc *mdesc)
virtual void make(Prof::CallPath::Profile &prof)
static bool isTimeMetric(const Prof::Metric::ADesc *mdesc)
cct_node_t * node
Definition: cct.c:128
const std::string & nameBase() const
unsigned int uint
Definition: uint.h:124
static void makeMetrics(Prof::CallPath::Profile &prof, const Analysis::Args &args, const Analysis::Util::NormalizeProfileArgs_t &nArgs)
static bool isDerivedMetric(const Prof::Metric::ADesc *mdesc, const std::string &type)
virtual bool isSeparable(const Prof::CCT::AProcNode *x)=0