71 #include <include/hpctoolkit-config.h> 85 "[options] [<binary>] <profile>\n";
88 "[options] -p [<binary>]\n";
91 "Converts various types of profile output into the PROFILE format, which in\n" 92 "particular, associates source file line information from <binary> with\n" 93 "profile data from <profile>. In effect, the output is a [source-line to\n" 94 "PC-profile-data] map represented as a XML scope tree (e.g. file, procedure,\n" 95 "statement). Output is sent to stdout.\n" 97 "To find source line information, access to the profiled binary is required.\n" 98 "xprof will try to find the binary from data within <profile>. If this\n" 99 "information is missing, <binary> must be explicitly specified.\n" 101 "By default, xprof determines a set of metrics available for the given\n" 102 "profile data and includes all of them in the PROFILE output.\n" 104 "The following <profile> formats are currently supported: \n" 105 " - DEC/Compaq/HP's DCPI 'dcpicat' (including ProfileMe) \n" 107 "Listing available metrics:\n" 108 " Note: with these options, <binary> is optional and will not be read\n" 109 " -l List all derived metrics, in compact form, available from <profile>\n" 110 " and suppress generation of PROFILE output. Note that this output\n" 111 " can be used with the -M option.\n" 112 " -L List all derived metrics, in long form, available from <profile>\n" 113 " and suppress generation of PROFILE output.\n" 115 "Selecting metrics:\n" 116 " -M <list>, --metrics <list>\n" 117 " Replace the default metric set with the colon-separated <list> and\n" 118 " define the metric ordering. May be passed multiple times. Duplicates\n" 119 " are allowed (though not recommended).\n" 120 " -X <list>, --exclude-metrics <list>\n" 121 " Exclude metrics in the colon-separated <list> from either the default\n" 122 " metric set or from those specified with -M. May be passed multiple\n" 124 " -R, --raw-metrics\n" 125 " Generate 'raw' metrics, disabling computation of derived metrics. For\n" 126 " some profile data, such as DCPI's ProfileMe, the default is to output\n" 127 " derived metrics, not the underlying raw metrics.\n" 130 " -p, --pipe Supply <profile> on stdin. E.g., it is often desirable to\n" 131 " pipe the output of 'dcpicat' into xprof.\n" 132 " -V, --version Print version information.\n" 133 " -h, --help Print this help.\n";
136 #define CLP CmdLineParser 141 {
'l',
NULL, CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
142 {
'L',
NULL, CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
145 {
'M',
"metrics", CLP::ARG_REQ , CLP::DUPOPT_CAT,
":", NULL },
146 {
'X',
"exclude-metrics", CLP::ARG_REQ , CLP::DUPOPT_CAT,
":", NULL },
147 {
'R',
"raw-metrics", CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
148 { 0 ,
"pcmap", CLP::ARG_REQ , CLP::DUPOPT_ERR,
NULL, NULL },
151 {
'p',
"pipe", CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
152 {
'V',
"version", CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
153 {
'h',
"help", CLP::ARG_NONE, CLP::DUPOPT_CLOB,
NULL, NULL },
154 { 0 ,
"debug", CLP::ARG_OPT, CLP::DUPOPT_CLOB,
NULL, NULL },
170 Args::Args(
int argc,
const char*
const argv[])
199 os <<
"Usage: " << endl
209 os <<
getCmd() <<
": " << msg << endl
210 <<
"Try '" <<
getCmd() <<
" --help' for more information." << endl;
273 PrintError(std::cerr,
"Error: -M or -X cannot be used with -R.\n");
278 bool profFileFromStdin =
false;
280 profFileFromStdin =
true;
286 if (profFileFromStdin) {
290 default: errtxt =
"Too many arguments!";
299 default: errtxt =
"Incorrect number of arguments!";
303 if (!errtxt.empty()) {
323 os <<
"Args.cmd= " <<
getCmd() << endl;
324 os <<
"Args.progFile= " <<
progFile << endl;
325 os <<
"Args.profFile= " <<
profFile << endl;
326 os <<
"::trace " <<
::trace << endl;
void PrintUsage(std::ostream &os) const
bool isOpt(const char swShort) const
const std::string & getOptArg(const char swShort) const
void PrintVersion(std::ostream &os) const
virtual const std::string & what() const
bool isOptArg(const char swShort) const
void Dump(std::ostream &os=std::cerr) const
void parse(const OptArgDesc *optArgDescs, int argc, const char *const argv[])
void Parse(int argc, const char *const argv[])
unsigned int getNumArgs() const
unsigned int listAvailableMetrics
virtual std::string message() const
#define CmdLineParser_OptArgDesc_NULL_MACRO
static CmdLineParser::OptArgDesc optArgs[]
const std::string & getArg(unsigned int i) const
void PrintError(std::ostream &os, const char *msg) const
const std::string & getCmd() const
static long toLong(const std::string &str)