HPCToolkit
Util.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 
64 #include <string>
65 using std::string;
66 
67 #include <algorithm>
68 #include <typeinfo>
69 
70 #include <cstring> // strlen()
71 
72 #include <dirent.h> // scandir()
73 
74 //*************************** User Include Files ****************************
75 
76 #include <include/gcc-attr.h>
77 #include <include/uint.h>
78 
79 #include "Util.hpp"
80 
82 
83 #include <lib/prof-lean/hpcio.h>
84 #include <lib/prof-lean/hpcfmt.h>
87 
91 #include <lib/support/realpath.h>
92 
93 //*************************** Forward Declarations **************************
94 
95 //***************************************************************************
96 
97 static inline int
98 fileExtensionFilter(const struct dirent* entry,
99  const string& ext, uint extLen)
100 {
101  // FileUtil::fnmatch("*.hpcrun", entry->d_name);
102  uint nmLen = strlen(entry->d_name);
103  if (nmLen > extLen) {
104  int cmpbeg = (nmLen - extLen);
105  return (strncmp(&entry->d_name[cmpbeg], ext.c_str(), extLen) == 0);
106  }
107  return 0;
108 }
109 
110 
111 static int
112 hpcrunFileFilter(const struct dirent* entry)
113 {
114  static const string ext = string(".") + HPCRUN_ProfileFnmSfx;
115  static const uint extLen = ext.length();
116 
117  return fileExtensionFilter(entry, ext, extLen);
118 }
119 
120 
121 #if 0
122 static int
123 hpctraceFileFilter(const struct dirent* entry)
124 {
125  static const string ext = string(".") + HPCRUN_TraceFnmSfx;
126  static const uint extLen = ext.length();
127 
128  return fileExtensionFilter(entry, ext, extLen);
129 }
130 #endif
131 
132 
133 //***************************************************************************
134 //
135 //***************************************************************************
136 
137 namespace Analysis {
138 namespace Util {
139 
141 getProfileType(const std::string& filenm)
142 {
143  static const int bufSZ = 32;
144  char buf[bufSZ] = { '\0' };
145 
146  std::istream* is = IOUtil::OpenIStream(filenm.c_str());
147  is->read(buf, bufSZ);
149 
151  if (strncmp(buf, HPCRUN_FMT_Magic, HPCRUN_FMT_MagicLen) == 0) {
152  ty = ProfType_Callpath;
153  }
154  else if (strncmp(buf, HPCMETRICDB_FMT_Magic, HPCMETRICDB_FMT_MagicLen) == 0) {
156  }
157  else if (strncmp(buf, HPCTRACE_FMT_Magic, HPCTRACE_FMT_MagicLen) == 0) {
159  }
160  else if (strncmp(buf, HPCRUNFLAT_FMT_Magic, HPCRUNFLAT_FMT_MagicLen) == 0) {
161  ty = ProfType_Flat;
162  }
163 
164  return ty;
165 }
166 
167 } // end of Util namespace
168 } // end of Analysis namespace
169 
170 
171 //***************************************************************************
172 //
173 //***************************************************************************
174 
175 namespace Analysis {
176 namespace Util {
177 
180 {
182 
183  for (StringVec::const_iterator it = inPaths.begin();
184  it != inPaths.end(); ++it) {
185  std::string path = *it; // copy
186  if (FileUtil::isDir(path.c_str())) {
187  // ensure 'path' ends in '/'
188  if (path[path.length() - 1] != '/') {
189  path += "/";
190  }
191 
192  struct dirent** dirEntries = NULL;
193  int dirEntriesSz = scandir(path.c_str(), &dirEntries,
194  hpcrunFileFilter, alphasort);
195  if (dirEntriesSz < 0) {
196  DIAG_Throw("could not read directory: " << path);
197  }
198  else {
199  out.groupMax++; // obtain next group;
200  for (int i = 0; i < dirEntriesSz; ++i) {
201  string nm = path + dirEntries[i]->d_name;
202  free(dirEntries[i]);
203  out.paths->push_back(nm);
204  out.pathLenMax = std::max(out.pathLenMax, (uint)nm.length());
205  out.groupMap->push_back(out.groupMax);
206  }
207  free(dirEntries);
208  }
209  // TODO: collect group
210  }
211  else {
212  out.groupMax++; // obtain next group;
213  out.paths->push_back(path);
214  out.pathLenMax = std::max(out.pathLenMax, (uint)path.length());
215  out.groupMap->push_back(out.groupMax);
216  }
217  }
218 
219  return out;
220 }
221 
222 } // end of Util namespace
223 } // end of Analysis namespace
224 
225 
226 //***************************************************************************
227 //
228 //***************************************************************************
229 
230 namespace Analysis {
231 namespace Util {
232 
233 // Parses a string to get 2 values, 'oldVal' and 'newVal', which are
234 // syntatically separated by a '=' character. To avoid confusions with '='
235 // characters in the path name, convention is for the user to escape all '=',
236 // and only '=' characters,in their path.
237 //
238 // @param arg: A string with only '=' characters escaped
239 // @return: How many occurances of unescaped '=' characters there are.
240 // A value other than 1 indicates an error
241 int
242 parseReplacePath(const std::string& arg)
243 {
244  size_t in = arg.find_first_of('=');
245  size_t indexOfEqual = 0;
246  int numEquals = 0;
247  int numBackslashesBeforeTrueEqual = 0;
248 
249  size_t trailingIn = 0;
250  string trueArg; // arg with the '\' stripped out
251  while (in != arg.npos) {
252  if (arg[in-1] != '\\') { // indicates the true equals character
253  numEquals++;
254  trueArg += arg.substr(trailingIn, in - trailingIn + 1);
255  indexOfEqual = in;
256  }
257  else {
258  if (indexOfEqual == 0) {
259  numBackslashesBeforeTrueEqual++;
260  }
261 
262  // to copy everything up till the '\', and then add on a '='
263  // that is known
264  trueArg += arg.substr(trailingIn, in - trailingIn - 1);
265  trueArg += '=';
266  }
267 
268  trailingIn = in+1;
269  in = arg.find_first_of('=', (in + 1));
270  }
271 
272 
273  if (numEquals == 1) {
274  trueArg += arg.substr(arg.find_last_of('=') + 1);
275  indexOfEqual -= numBackslashesBeforeTrueEqual; // b/c '/' were removed
276 
277  string oldVal = trueArg.substr(0, indexOfEqual);
278  string newVal = trueArg.substr(indexOfEqual + 1);
279 
280  PathReplacementMgr::singleton().addPath(oldVal, newVal);
281  }
282 
283  return numEquals;
284 }
285 
286 
287 } // end of Util namespace
288 } // end of Analysis namespace
289 
290 
291 //***************************************************************************
292 //
293 //***************************************************************************
294 
295 namespace Analysis {
296 namespace Util {
297 
298 // Always consult the load module's structure information (Struct::LM)
299 // and perform a lookup by VMA first. If this fails:
300 //
301 // - If the structure was seeded by full structure by
302 // Struct::makeStructure (useStruct), then use the "unknown" file
303 // procedures and
304 //
305 // - Otherwise, create structure using BAnal::Struct::makeStructureSimple.
306 //
307 // In either case, return a Struct::Stmt. This is important because
308 // it ensures that every sample maps to a Stmt, a fact that is
309 // exploited by Analysis::CallPath::noteStaticStructureOnLeaves().
310 //
311 // The above policy assumes that when full structure has been
312 // provided, BAnal::Struct::makeStructureSimple could have undesirable
313 // effects. One example of a problem is that for simple structure, a
314 // line -> Struct::Stmt map is consulted which is ambiguous in the
315 // presence of inline (Struct::Alien).
318  BinUtil::LM* lm, bool useStruct,
319  const string* unknownProcNm)
320 {
321  using namespace Prof;
322 
323  Struct::ACodeNode* strct = lmStrct->findByVMA(vma);
324  if (!strct) {
325  if (useStruct) {
326  Struct::File* fileStrct =
327  Struct::File::demand(lmStrct, Struct::Tree::UnknownFileNm);
328 
329  const string* unkProcNm =
330  (unknownProcNm) ? unknownProcNm : &Struct::Tree::UnknownProcNm;
331 
332  Struct::Proc* procStrct =
333  Struct::Proc::demand(fileStrct, *unkProcNm);
334 
335  strct = BAnal::Struct::demandStmtStructure(lmStrct, procStrct,
336  Struct::Tree::UnknownLine,
337  vma, vma + 1);
338  }
339  else {
340  strct = BAnal::Struct::makeStructureSimple(lmStrct, lm, vma, unknownProcNm);
341  }
342  }
343  return strct;
344 }
345 
346 } // end of Util namespace
347 } // end of Analysis namespace
348 
349 
350 //***************************************************************************
351 //
352 //***************************************************************************
353 
354 static string
355 copySourceFileMain(const string& fnm_orig,
356  std::map<string, string>& processedFiles,
357  const Analysis::PathTupleVec& pathVec,
358  const string& dstDir);
359 
360 static bool
362 {
363  return (x.type() == Prof::Struct::ANode::TyFile ||
366 }
367 
368 
369 namespace Analysis {
370 namespace Util {
371 
372 // copySourceFiles: For every Prof::Struct::File and
373 // Prof::Struct::Alien x in 'structure' that can be reached with paths
374 // in 'pathVec', copy x to its appropriate viewname path and update
375 // x's path to be relative to this location.
376 void
378  const Analysis::PathTupleVec& pathVec,
379  const string& dstDir)
380 {
381  // Prevent multiple copies of the same file (Alien scopes)
382  std::map<string, string> processedFiles;
383 
384  Prof::Struct::ANodeFilter filter(Flat_Filter, "Flat_Filter", 0);
385  for (Prof::Struct::ANodeIterator it(structure, &filter); it.Current(); ++it) {
386  Prof::Struct::ANode* strct = it.current();
387 
388  // Note: 'fnm_orig' will be not be absolute if it is not possible
389  // to resolve it on the current filesystem. (cf. RealPathMgr)
390 
391  // DIAG_Assert( , DIAG_UnexpectedInput);
392  const string& fnm_orig =
393  ((typeid(*strct) == typeid(Prof::Struct::Alien)) ?
394  dynamic_cast<Prof::Struct::Alien*>(strct)->fileName() :
395  ((typeid(*strct) == typeid(Prof::Struct::Loop)) ?
396  dynamic_cast<Prof::Struct::Loop*>(strct)->fileName() :
397  strct->name()));
398 
399  // ------------------------------------------------------
400  // Given fnm_orig, attempt to find and copy fnm_new
401  // ------------------------------------------------------
402  string fnm_new =
403  copySourceFileMain(fnm_orig, processedFiles, pathVec, dstDir);
404 
405  // ------------------------------------------------------
406  // Update static structure
407  // ------------------------------------------------------
408  if (!fnm_new.empty()) {
409  if (typeid(*strct) == typeid(Prof::Struct::Alien)) {
410  dynamic_cast<Prof::Struct::Alien*>(strct)->fileName(fnm_new);
411  } else if (typeid(*strct) == typeid(Prof::Struct::Loop)) {
412  dynamic_cast<Prof::Struct::Loop*>(strct)->fileName(fnm_new);
413  } else {
414  dynamic_cast<Prof::Struct::File*>(strct)->name(fnm_new);
415  }
416  }
417  }
418 }
419 
420 } // end of Util namespace
421 } // end of Analysis namespace
422 
423 
424 
425 static std::pair<int, string>
426 matchFileWithPath(const string& filenm, const Analysis::PathTupleVec& pathVec);
427 
428 static string
429 copySourceFile(const string& filenm, const string& dstDir,
430  const Analysis::PathTuple& pathTpl);
431 
432 static string
433 copySourceFileMain(const string& fnm_orig,
434  std::map<string, string>& processedFiles,
435  const Analysis::PathTupleVec& pathVec,
436  const string& dstDir)
437 {
438  string fnm_new;
439 
440  std::map<string, string>::iterator it = processedFiles.find(fnm_orig);
441  if (it != processedFiles.end()) {
442  fnm_new = it->second;
443  }
444  else {
445  std::pair<int, string> fnd = matchFileWithPath(fnm_orig, pathVec);
446  int idx = fnd.first;
447  if (idx >= 0) {
448  // fnm_orig explicitly matches a <search-path, path-view> tuple
449  fnm_new = copySourceFile(fnd.second, dstDir, pathVec[idx]);
450  }
451  else if (fnm_orig[0] == '/' && FileUtil::isReadable(fnm_orig.c_str())) {
452  // fnm_orig does not match a pathVec tuple; but if it is an
453  // absolute path that is readable, use the default <search-path,
454  // path-view> tuple.
455  static const Analysis::PathTuple
456  defaultTpl("/", Analysis::DefaultPathTupleTarget);
457  fnm_new = copySourceFile(fnm_orig, dstDir, defaultTpl);
458  }
459 
460  if (fnm_new.empty()) {
461  DIAG_WMsg(2, "lost: " << fnm_orig);
462  }
463  else {
464  DIAG_Msg(2, " cp:" << fnm_orig << " -> " << fnm_new);
465  }
466  processedFiles.insert(make_pair(fnm_orig, fnm_new));
467  }
468 
469  return fnm_new;
470 }
471 
472 
473 //***************************************************************************
474 
475 // matchFileWithPath: Given a file name 'filenm' and a vector of paths
476 // 'pathVec', use 'pathfind_r' to determine which path in 'pathVec',
477 // if any, reaches 'filenm'. Returns an index and string pair. If a
478 // match is found, the index is an index in pathVec; otherwise it is
479 // negative. If a match is found, the string is the found file name.
480 static std::pair<int, string>
481 matchFileWithPath(const string& filenm, const Analysis::PathTupleVec& pathVec)
482 {
483  // Find the index to the path that reaches 'filenm'.
484  // It is possible that more than one path could reach the same
485  // file because of substrings.
486  // E.g.: p1: /p1/p2/p3/*, p2: /p1/p2/*, f: /p1/p2/p3/f.c
487  // Choose the path that is most qualified (We assume RealPath length
488  // is valid test.)
489  int foundIndex = -1; // index into 'pathVec'
490  int foundPathLn = 0; // length of the path represented by 'foundIndex'
491  string foundFnm;
492 
493  for (uint i = 0; i < pathVec.size(); i++) {
494  // find the absolute form of 'curPath'
495  const string& curPath = pathVec[i].first;
496  string realPath(curPath);
497  if (PathFindMgr::isRecursivePath(curPath.c_str())) {
498  realPath[realPath.length() - PathFindMgr::RecursivePathSfxLn] = '\0';
499  }
500  realPath = RealPath(realPath.c_str());
501  int realPathLn = realPath.length();
502 
503  // 'filenm' should be relative as input for pathfind_r. If 'filenm'
504  // is absolute and 'realPath' is a prefix, make it relative.
505  string tmpFile(filenm);
506  char* curFile = const_cast<char*>(tmpFile.c_str());
507  if (filenm[0] == '/') { // is 'filenm' absolute?
508  if (strncmp(curFile, realPath.c_str(), realPathLn) == 0) {
509  curFile = &curFile[realPathLn];
510  while (curFile[0] == '/') { ++curFile; } // should not start with '/'
511  }
512  else {
513  continue; // pathfind_r can't posibly find anything
514  }
515  }
516 
517  const char* fnd_fnm = PathFindMgr::singleton().pathfind(curPath.c_str(),
518  curFile, "r");
519 
520  if (fnd_fnm) {
521  bool update = false;
522  if (foundIndex < 0) {
523  update = true;
524  }
525  else if ((foundIndex >= 0) && (realPathLn > foundPathLn)) {
526  update = true;
527  }
528 
529  if (update) {
530  foundIndex = i;
531  foundPathLn = realPathLn;
532  foundFnm = RealPath(fnd_fnm);
533  }
534  }
535  }
536  return make_pair(foundIndex, foundFnm);
537 }
538 
539 
540 // Given a file 'filenm' a destination directory 'dstDir' and a
541 // PathTuple, form a database file name, copy 'filenm' into the
542 // database and return the database file name.
543 // NOTE: assume filenm is already a 'real path'
544 static string
545 copySourceFile(const string& filenm, const string& dstDir,
546  const Analysis::PathTuple& pathTpl)
547 {
548  const string& fnm_fnd = filenm;
549  const string& viewnm = pathTpl.second;
550 
551  // Create new file name and copy commands
552  string fnm_new = "./" + viewnm + fnm_fnd;
553 
554  string fnm_to;
555  if (dstDir[0] != '/') {
556  fnm_to = "./";
557  }
558  fnm_to = fnm_to + dstDir + "/" + viewnm + fnm_fnd;
559  string dir_to(fnm_to); // need to strip off ending filename to
560  uint end; // get full path for 'fnm_to'
561  for (end = dir_to.length() - 1; dir_to[end] != '/'; end--) { }
562  dir_to[end] = '\0'; // should not end with '/'
563 
564  try {
565  FileUtil::mkdir(dir_to);
566  FileUtil::copy(fnm_to, fnm_fnd);
567  DIAG_DevMsgIf(0, "cp " << fnm_to);
568  }
569  catch (const Diagnostics::Exception& x) {
570  DIAG_EMsg(x.message());
571  }
572 
573  return fnm_new;
574 }
575 
576 
577 //***************************************************************************
578 //
579 //***************************************************************************
580 
581 namespace Analysis {
582 namespace Util {
583 
584 // copyTraceFiles:
585 void
586 copyTraceFiles(const std::string& dstDir, const std::set<string>& srcFiles)
587 {
588  bool tryMove = true;
589 
590  for (std::set<string>::iterator it = srcFiles.begin();
591  it != srcFiles.end(); ++it) {
592 
593  const string& x = *it;
594 
595  const string srcFnm1 = x + "." + HPCPROF_TmpFnmSfx;
596  const string& srcFnm2 = x;
597  const string dstFnm = dstDir + "/" + FileUtil::basename(x);
598 
599  // Note: the source and destination directories may be on
600  // different mount points. For the trace.tmp files, we try move
601  // first (faster), if that fails, try copy and delete. If any
602  // move fails, then always copy (so only one failed move).
603 
604  if (FileUtil::isReadable(srcFnm1)) {
605  // trace.tmp exists: try move, then copy and delete
606  bool copyDone = false;
607  if (tryMove) {
608  try {
609  DIAG_Msg(2, "trace (mv): '" << srcFnm1 << "' -> '" << dstFnm << "'");
610  FileUtil::move(dstFnm, srcFnm1);
611  copyDone = true;
612  }
613  catch (const Diagnostics::Exception& ex) {
614  DIAG_Msg(2, "trace mv failed, trying cp");
615  tryMove = false;
616  }
617  }
618  if (! copyDone) {
619  try {
620  DIAG_Msg(2, "trace (cp): '" << srcFnm1 << "' -> '" << dstFnm << "'");
621  FileUtil::copy(dstFnm, srcFnm1);
622  FileUtil::remove(srcFnm1.c_str());
623  }
624  catch (const Diagnostics::Exception& ex) {
625  DIAG_EMsg("While copying trace files ['"
626  << srcFnm1 << "' -> '" << dstFnm << "']:" << ex.message());
627  }
628  }
629  }
630  else {
631  // no trace.tmp file: always copy (keep original)
632  try {
633  DIAG_Msg(2, "trace (cp): '" << srcFnm2 << "' -> '" << dstFnm << "'");
634  FileUtil::copy(dstFnm, srcFnm2);
635  }
636  catch (const Diagnostics::Exception& ex) {
637  DIAG_EMsg("While copying trace files ['"
638  << srcFnm2 << "' -> '" << dstFnm << "']:" << ex.message());
639  }
640  }
641  }
642 }
643 
644 
645 } // end of Util namespace
646 } // end of Analysis namespace
647 
648 
649 //****************************************************************************
static const char HPCRUN_FMT_Magic[]
Definition: hpcrun-fmt.h:113
void CloseStream(std::istream *s)
Definition: IOUtil.cpp:127
static int isRecursivePath(const char *path)
static const int HPCMETRICDB_FMT_MagicLen
Definition: hpcrun-fmt.h:734
static const int HPCTRACE_FMT_MagicLen
Definition: hpcrun-fmt.h:649
static int fileExtensionFilter(const struct dirent *entry, const string &ext, uint extLen)
Definition: Util.cpp:98
NormalizeProfileArgs_t normalizeProfileArgs(const StringVec &inPaths)
Definition: Util.cpp:179
static PathFindMgr & singleton()
void MONITOR_EXT_WRAP_NAME() free(void *ptr)
std::istream * OpenIStream(const char *filenm)
Definition: IOUtil.cpp:85
int parseReplacePath(const std::string &arg)
Definition: Util.cpp:242
bfd_vma VMA
Definition: ISATypes.hpp:79
Prof::Struct::Stmt * makeStructureSimple(Prof::Struct::LM *lmStrct, BinUtil::LM *lm, VMA vma, const string *unknownProcNm)
#define DIAG_EMsg(...)
Definition: diagnostics.h:251
const char * pathfind(const char *pathList, const char *name, const char *mode)
static std::pair< int, string > matchFileWithPath(const string &filenm, const Analysis::PathTupleVec &pathVec)
Definition: Util.cpp:481
Analysis::Util::ProfType_t getProfileType(const std::string &filenm)
Definition: Util.cpp:141
void copy(const char *dst,...)
Definition: FileUtil.cpp:233
bool isReadable(const char *path)
Definition: FileUtil.cpp:171
Definition: fmt.c:108
static const char HPCRUN_TraceFnmSfx[]
Definition: hpcrun-fmt.h:96
int remove(const char *file)
Definition: FileUtil.cpp:282
void move(const char *dst, const char *src)
Definition: FileUtil.cpp:272
static const char HPCRUN_ProfileFnmSfx[]
Definition: hpcrun-fmt.h:93
#define HPCRUNFLAT_FMT_Magic
static const char HPCMETRICDB_FMT_Magic[]
Definition: hpcrun-fmt.h:726
void copySourceFiles(Prof::Struct::Root *structure, const Analysis::PathTupleVec &pathVec, const string &dstDir)
Definition: Util.cpp:377
void addPath(const std::string &oldPath, const std::string &newPath)
Prof::Struct::Stmt * demandStmtStructure(Prof::Struct::LM *lmStrct, Prof::Struct::Proc *procStrct, SrcFile::ln line, VMA begVMA, VMA endVMA)
bool isDir(const char *path)
Definition: FileUtil.cpp:182
virtual std::string message() const
Definition: Exception.hpp:134
unsigned int uint
Definition: uint.h:124
static PathReplacementMgr & singleton()
void copyTraceFiles(const std::string &dstDir, const std::set< string > &srcFiles)
Definition: Util.cpp:586
Prof::Struct::ACodeNode * demandStructure(VMA vma, Prof::Struct::LM *lmStrct, BinUtil::LM *lm, bool useStruct, const string *unknownProcNm)
Definition: Util.cpp:317
static string copySourceFile(const string &filenm, const string &dstDir, const Analysis::PathTuple &pathTpl)
Definition: Util.cpp:545
static const int HPCRUN_FMT_MagicLen
Definition: hpcrun-fmt.h:117
virtual const std::string & name() const
const std::string DefaultPathTupleTarget
Definition: Args.hpp:85
std::vector< PathTuple > PathTupleVec
Definition: Args.hpp:83
static const int RecursivePathSfxLn
Definition: PathFindMgr.hpp:86
static string copySourceFileMain(const string &fnm_orig, std::map< string, string > &processedFiles, const Analysis::PathTupleVec &pathVec, const string &dstDir)
Definition: Util.cpp:433
static const char HPCPROF_TmpFnmSfx[]
Definition: hpcrun-fmt.h:104
#define DIAG_Msg(level,...)
Definition: diagnostics.h:241
int mkdir(const char *dir)
Definition: FileUtil.cpp:289
const char * RealPath(const char *nm)
Definition: realpath.c:69
static int hpcrunFileFilter(const struct dirent *entry)
Definition: Util.cpp:112
#define NULL
Definition: ElfHelper.cpp:85
#define HPCRUNFLAT_FMT_MagicLen
ACodeNode * findByVMA(VMA vma) const
virtual NonUniformDegreeTreeNode * Current() const
string basename(const char *fName)
Definition: FileUtil.cpp:90
static const char HPCTRACE_FMT_Magic[]
Definition: hpcrun-fmt.h:625
static bool Flat_Filter(const Prof::Struct::ANode &x, long GCC_ATTR_UNUSED type)
Definition: Util.cpp:361
#define GCC_ATTR_UNUSED
Definition: gcc-attr.h:80
std::pair< std::string, std::string > PathTuple
Definition: Args.hpp:82
std::vector< std::string > StringVec
Definition: Util.hpp:108
ANodeTy type() const