HPCToolkit
Args.cpp
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 //************************* System Include Files ****************************
61 
62 #include <iostream>
63 using std::cerr;
64 using std::endl;
65 
66 #include <string>
67 using std::string;
68 
69 //*************************** User Include Files ****************************
70 
71 #include <include/hpctoolkit-config.h>
72 
73 #include "Args.hpp"
74 
75 #include <lib/analysis/Util.hpp>
77 #include <lib/support/FileUtil.hpp>
78 #include <lib/support/StrUtil.hpp>
79 
80 //*************************** Forward Declarations **************************
81 
82 // Cf. DIAG_Die.
83 #define ARG_ERROR(streamArgs) \
84  { std::ostringstream WeIrDnAmE; \
85  WeIrDnAmE << streamArgs /*<< std::ends*/; \
86  printError(std::cerr, WeIrDnAmE.str()); \
87  exit(1); }
88 
89 //***************************************************************************
90 
91 static const char* version_info = HPCTOOLKIT_VERSION_STRING;
92 
93 static const char* usage_summary =
94 "[options] <binary>\n";
95 
96 static const char* usage_details = "\
97 Given an application binary or DSO <binary>, hpcstruct recovers the program\n\
98 structure of its object code. Program structure is a mapping of a program's\n\
99 static source-level structure to its object code. By default, hpcstruct\n\
100 writes its results to the file 'basename(<binary>).hpcstruct'. This file\n\
101 is typically passed to HPCToolkit's correlation tool hpcprof.\n\
102 \n\
103 hpcstruct is designed primarily for highly optimized binaries created from\n\
104 C, C++ and Fortran source code. Because hpcstruct's algorithms exploit a\n\
105 binary's debugging information, for best results, binary should be compiled\n\
106 with standard debugging information. See the documentation for more\n\
107 information.\n\
108 \n\
109 Options: General\n\
110  -v [<n>], --verbose [<n>]\n\
111  Verbose: generate progress messages to stderr at\n\
112  verbosity level <n>. {1}\n\
113  -V, --version Print version information.\n\
114  -h, --help Print this help.\n\
115  --debug=[<n>] Debug: use debug level <n>. {1}\n\
116  --debug-proc <glob> Debug structure recovery for procedures matching\n\
117  the procedure glob <glob>\n\
118  -j <num>, --jobs <num> Use <num> openmp threads (jobs), default 1.\n\
119  --jobs-parse <num> Use <num> openmp threads for ParseAPI::parse(),\n\
120  default is same value for --jobs.\n\
121  --jobs-symtab <num> Use <num> openmp threads for Symtab methods.\n\
122  --time Display stats on time and space usage.\n\
123 \n\
124 Options: Structure recovery\n\
125  -I <path>, --include <path>\n\
126  Use <path> when resolving source file names. For a\n\
127  recursive search, append a '*' after the last slash,\n\
128  e.g., '/mypath/*' (quote or escape to protect from\n\
129  the shell.) May pass multiple times.\n"
130 
131 #if 0
132  --loop-intvl <yes|no>\n\
133  Should loop recovery heuristics assume an irreducible\n\
134  interval is a loop? {yes}\n\
135  --loop-fwd-subst <yes|no>\n\
136  Should loop recovery heuristics assume forward\n\
137  substitution may occur? {yes}\n\
138  -N <all|safe|none>, --normalize <all|safe|none>\n\
139  Specify normalizations to apply to structure. {all}\n\
140  all : apply all normalizations\n\
141  safe: apply only safe normalizations\n\
142  none: apply no normalizations\n
143 #endif
144 
145 " -R '<old-path>=<new-path>', --replace-path '<old-path>=<new-path>'\n\
146  Substitute instances of <old-path> with <new-path>;\n\
147  apply to all paths (profile's load map, source code)\n\
148  for which <old-path> is a prefix. Use '\\' to escape\n\
149  instances of '=' within a path. May pass multiple\n\
150  times.\n\
151  --use-binutils Use binutils as the default binary instruction decoder\n\
152  On x86 default is Intel XED library.\n\
153  --show-gaps Experimental feature to show unclaimed vma ranges (gaps)\n\
154  in the control-flow graph.\n\
155 \n\
156 Options: Demangling\n\
157  --demangle-library <path to demangling library>\n\
158  Specify the pathname for a dynamically-linked\n\
159  library whose demangler function should \n\
160  be used for demangling. By default, the demangler used\n\
161  is __cxa_demangle in the C++ Standard Library linked into\n\
162  hpcstruct.\n\
163 \n\
164  --demangle-function <name of the demangler>\n\
165  By default, the demangler used is __cxa_demangle, a function\n\
166  provided by the C++ Standard Library. This option enables\n\
167  one to specify an alternate demangler, e.g., cplus_demangle\n\
168  provided by the BFD library.\n\
169 \n\
170 Options: Output:\n\
171  -o <file>, --output <file>\n\
172  Write hpcstruct file to <file>.\n\
173  Use '--output=-' to write output to stdout.\n\
174  --compact Generate compact output, eliminating extra white space\n\
175 ";
176 
177 // Possible extensions:
178 // --Li : Select the opposite of the --loop-intvl default.
179 // --Lf : Select the opposite of the --loop-fwd-subst default.
180 
181 
182 #define CLP CmdLineParser
183 #define CLP_SEPARATOR "!!!"
184 
185 // Note: Changing the option name requires changing the name in Parse()
187  { 0 , "agent-c++", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
188  NULL },
189  { 0 , "agent-cilk", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
190  NULL },
191 
192  { 'j', "jobs", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL, NULL },
193  { 0 , "jobs-parse", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL, NULL },
194  { 0 , "jobs-symtab", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL, NULL },
195  { 0 , "time", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL, NULL },
196 
197  // Demangler library
198  { 0 , "demangle-library", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL,
199  NULL },
200 
201  // Demangler function
202  { 0 , "demangle-function", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL,
203  NULL },
204 
205  // Structure recovery options
206  { 'I', "include", CLP::ARG_REQ, CLP::DUPOPT_CAT, ":",
207  NULL },
208  { 0 , "loop-intvl", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL,
209  NULL },
210  { 0 , "loop-fwd-subst", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL,
211  NULL },
212  { 'R', "replace-path", CLP::ARG_REQ, CLP::DUPOPT_CAT, CLP_SEPARATOR,
213  NULL},
214  { 0 , "show-gaps", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
215  NULL },
216 
217  // Output options
218  { 'o', "output", CLP::ARG_REQ , CLP::DUPOPT_CLOB, NULL,
219  NULL },
220  { 0 , "compact", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
221  NULL },
222 
223  // General
224  { 'v', "verbose", CLP::ARG_OPT, CLP::DUPOPT_CLOB, NULL,
225  CLP::isOptArg_long },
226  { 'V', "version", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
227  NULL },
228  { 'h', "help", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
229  NULL },
230  { 0 , "debug", CLP::ARG_OPT, CLP::DUPOPT_CLOB, NULL,
231  CLP::isOptArg_long },
232  { 0 , "debug-proc", CLP::ARG_REQ, CLP::DUPOPT_CLOB, NULL,
233  NULL },
234 
235  // Instruction decoder options
236  { 0, "use-binutils", CLP::ARG_NONE, CLP::DUPOPT_CLOB, NULL,
237  NULL },
238 
239  CmdLineParser_OptArgDesc_NULL_MACRO // SGI's compiler requires this version
240 };
241 
242 #undef CLP
243 
244 
245 //***************************************************************************
246 // Args
247 //***************************************************************************
248 
249 Args::Args()
250 {
251  Ctor();
252 }
253 
254 
255 Args::Args(int argc, const char* const argv[])
256 {
257  Ctor();
258  parse(argc, argv);
259 }
260 
261 
262 void
263 Args::Ctor()
264 {
265  jobs = -1;
266  jobs_parse = -1;
267  jobs_symtab = -1;
268  show_time = false;
269  searchPathStr = ".";
271  isForwardSubstitution = true;
272  prettyPrintOutput = true;
273  useBinutils = false;
274  show_gaps = false;
275 }
276 
277 
278 Args::~Args()
279 {
280 }
281 
282 
283 void
284 Args::printVersion(std::ostream& os) const
285 {
286  os << getCmd() << ": " << version_info << endl;
287 }
288 
289 
290 void
291 Args::printUsage(std::ostream& os) const
292 {
293  os << "Usage: " << getCmd() << " " << usage_summary << endl
294  << usage_details << endl;
295 }
296 
297 
298 void
299 Args::printError(std::ostream& os, const char* msg) const
300 {
301  os << getCmd() << ": " << msg << endl
302  << "Try '" << getCmd() << " --help' for more information." << endl;
303 }
304 
305 void
306 Args::printError(std::ostream& os, const std::string& msg) const
307 {
308  printError(os, msg.c_str());
309 }
310 
311 
312 const std::string&
313 Args::getCmd() const
314 {
315  return parser.getCmd();
316 }
317 
318 
319 void
320 Args::parse(int argc, const char* const argv[])
321 {
322  try {
323  // -------------------------------------------------------
324  // Parse the command line
325  // -------------------------------------------------------
326  parser.parse(optArgs, argc, argv);
327 
328  // -------------------------------------------------------
329  // Sift through results, checking for semantic errors
330  // -------------------------------------------------------
331 
332  // Special options that should be checked first
333  if (parser.isOpt("debug")) {
334  int dbg = 1;
335  if (parser.isOptArg("debug")) {
336  const string& arg = parser.getOptArg("debug");
337  dbg = (int)CmdLineParser::toLong(arg);
338  }
340  }
341  if (parser.isOpt("help")) {
342  printUsage(std::cerr);
343  exit(1);
344  }
345  if (parser.isOpt("version")) {
346  printVersion(std::cerr);
347  exit(1);
348  }
349  if (parser.isOpt("verbose")) {
350  int verb = 1;
351  if (parser.isOptArg("verbose")) {
352  const string& arg = parser.getOptArg("verbose");
353  verb = (int)CmdLineParser::toLong(arg);
354  }
356  }
357  if (parser.isOpt("debug-proc")) {
358  dbgProcGlob = parser.getOptArg("debug-proc");
359  }
360 
361  // Number of openmp threads (jobs, jobs-parse)
362  if (parser.isOpt("jobs")) {
363  const string & arg = parser.getOptArg("jobs");
364  jobs = (int) CmdLineParser::toLong(arg);
365  }
366  if (parser.isOpt("jobs-parse")) {
367  const string & arg = parser.getOptArg("jobs-parse");
368  jobs_parse = (int) CmdLineParser::toLong(arg);
369  }
370  if (parser.isOpt("jobs-symtab")) {
371  const string & arg = parser.getOptArg("jobs-symtab");
372  jobs_symtab = (int) CmdLineParser::toLong(arg);
373  }
374  if (parser.isOpt("time")) {
375  show_time = true;
376  }
377 
378  // Check for LUSH options (TODO)
379  if (parser.isOpt("agent-c++")) {
380  lush_agent = "agent-c++";
381  }
382  if (parser.isOpt("agent-cilk")) {
383  lush_agent = "agent-cilk";
384  }
385 
386  // Check for other options: Structure recovery
387  if (parser.isOpt("include")) {
388  searchPathStr += ":" + parser.getOptArg("include");
389  }
390  if (parser.isOpt("loop-intvl")) {
391  const string& arg = parser.getOptArg("loop-intvl");
393  CmdLineParser::parseArg_bool(arg, "--loop-intvl option");
394  }
395  if (parser.isOpt("loop-fwd-subst")) {
396  const string& arg = parser.getOptArg("loop-fwd-subst");
398  CmdLineParser::parseArg_bool(arg, "--loop-fwd-subst option");
399  }
400 
401  if (parser.isOpt("replace-path")) {
402  string arg = parser.getOptArg("replace-path");
403 
404  std::vector<std::string> replacePaths;
405  StrUtil::tokenize_str(arg, CLP_SEPARATOR, replacePaths);
406 
407  for (uint i = 0; i < replacePaths.size(); ++i) {
408  int occurancesOfEquals =
409  Analysis::Util::parseReplacePath(replacePaths[i]);
410 
411  if (occurancesOfEquals > 1) {
412  ARG_ERROR("Too many occurances of \'=\'; make sure to escape any \'=\' in your paths");
413  }
414  else if(occurancesOfEquals == 0) {
415  ARG_ERROR("The \'=\' between the old path and new path is missing");
416  }
417  }
418  }
419 
420  if (parser.isOpt("show-gaps")) {
421  show_gaps = true;
422  }
423 
424  // Instruction decoder options
425  useBinutils = parser.isOpt("use-binutils");
426 
427  // Check for other options: Demangling
428  if (parser.isOpt("demangle-library")) {
429  demangle_library = parser.getOptArg("demangle-library");
430  }
431 
432  // Check for other options: Demangling
433  if (parser.isOpt("demangle-function")) {
434  demangle_function = parser.getOptArg("demangle-function");
435  }
436 
437  // Check for other options: Output options
438  if (parser.isOpt("output")) {
439  out_filenm = parser.getOptArg("output");
440  }
441  if (parser.isOpt("compact")) {
442  prettyPrintOutput = false;
443  }
444 
445  // Check for required arguments
446  if (parser.getNumArgs() != 1) {
447  ARG_ERROR("Incorrect number of arguments!");
448  }
449  in_filenm = parser.getArg(0);
450 
451  if (out_filenm.empty()) {
452  string base_filenm = FileUtil::basename(in_filenm);
453  out_filenm = base_filenm + ".hpcstruct";
454  }
455  }
456  catch (const CmdLineParser::ParseError& x) {
457  ARG_ERROR(x.what());
458  }
459  catch (const CmdLineParser::Exception& x) {
460  DIAG_EMsg(x.message());
461  exit(1);
462  }
463 }
464 
465 
466 void
467 Args::dump(std::ostream& os) const
468 {
469  os << "Args.cmd= " << getCmd() << endl;
470  os << "Args.in_filenm= " << in_filenm << endl;
471 }
472 
473 
474 void
475 Args::ddump() const
476 {
477  dump(std::cerr);
478 }
479 
480 
481 //***************************************************************************
482 
483 #if 0
484 void
486 {
487  char * home = getenv(HPCTOOLKIT.c_str());
488  if (home == NULL) {
489  cerr << "Error: Please set your " << HPCTOOLKIT << " environment variable."
490  << endl;
491  exit(1);
492  }
493 
494  // chop of trailing slashes
495  int len = strlen(home);
496  if (home[len-1] == '/') home[--len] = 0;
497 
498  DIR *fp = opendir(home);
499  if (fp == NULL) {
500  cerr << "Error: " << home << " is not a directory" << endl;
501  exit(1);
502  }
503  closedir(fp);
504  hpcHome = home;
505 }
506 #endif
507 
~Args()
Definition: Args.cpp:173
bool isOpt(const char swShort) const
void printUsage(std::ostream &os) const
Definition: Args.cpp:186
const std::string & getOptArg(const char swShort) const
#define CLP_SEPARATOR
Definition: Args.cpp:183
std::string demangle_function
Definition: Args.hpp:121
const std::string & getCmd() const
int parseReplacePath(const std::string &arg)
Definition: Util.cpp:242
#define DIAG_EMsg(...)
Definition: diagnostics.h:251
bool show_gaps
Definition: Args.hpp:129
void setHPCHome()
Definition: Args.cpp:476
virtual const std::string & what() const
Definition: Exception.hpp:126
int jobs_parse
Definition: Args.hpp:113
bool isIrreducibleIntervalLoop
Definition: Args.hpp:122
bool isOptArg(const char swShort) const
void Ctor()
Definition: Args.cpp:162
void parse(const OptArgDesc *optArgDescs, int argc, const char *const argv[])
CmdLineParser parser
Definition: Args.hpp:120
int jobs
Definition: Args.hpp:112
bool prettyPrintOutput
Definition: Args.hpp:127
unsigned int getNumArgs() const
void printVersion(std::ostream &os) const
Definition: Args.cpp:179
void parse(int argc, const char *const argv[])
Definition: Args.cpp:208
void tokenize_str(const std::string &tokenstr, const char *delim, std::vector< std::string > &tokenvec)
Definition: StrUtil.cpp:122
std::string in_filenm
Definition: Args.hpp:132
virtual std::string message() const
Definition: Exception.hpp:134
exit
Definition: names.cpp:1
unsigned int uint
Definition: uint.h:124
std::string dbgProcGlob
Definition: Args.hpp:124
static const char * usage_summary
Definition: Args.cpp:93
std::string out_filenm
Definition: Args.hpp:126
std::string searchPathStr() const
Definition: Args.cpp:214
Args()
Definition: Args.cpp:150
void ddump() const
Definition: Args.cpp:305
#define CmdLineParser_OptArgDesc_NULL_MACRO
bool isForwardSubstitution
Definition: Args.hpp:123
bool useBinutils
Definition: Args.hpp:128
void printError(std::ostream &os, const char *msg) const
Definition: Args.cpp:194
void Diagnostics_SetDiagnosticFilterLevel(int lvl)
Definition: diagnostics.cpp:80
static CmdLineParser::OptArgDesc optArgs[]
Definition: Args.hpp:119
bool show_time
Definition: Args.hpp:115
const std::string & getArg(unsigned int i) const
#define NULL
Definition: ElfHelper.cpp:85
static const std::string HPCTOOLKIT
Definition: Args.hpp:125
#define ARG_ERROR(streamArgs)
Definition: Args.cpp:83
static bool parseArg_bool(const std::string &value, const char *errTag)
std::string hpcHome
Definition: Args.hpp:111
string basename(const char *fName)
Definition: FileUtil.cpp:90
const std::string & getCmd() const
Definition: Args.hpp:102
static const char * version_info
Definition: Args.cpp:91
int jobs_symtab
Definition: Args.hpp:114
void dump(std::ostream &os=std::cerr) const
Definition: Args.cpp:296
<!-- ********************************************************************--> 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
static const char * usage_details
Definition: Args.cpp:96
static long toLong(const std::string &str)
std::string demangle_library
Definition: Args.hpp:120