102 const char* metricList,
const char* excludeMList);
116 catch (
const std::bad_alloc& x) {
117 DIAG_EMsg(
"[std::bad_alloc] " << x.what());
120 catch (
const std::exception& x) {
121 DIAG_EMsg(
"[std::exception] " << x.what());
125 DIAG_EMsg(
"Unknown exception encountered!");
142 if (!pcprof) {
exit(1); }
144 catch (std::bad_alloc& x) {
145 cerr <<
"Error: Memory alloc failed while reading profile!\n";
159 binutils::LM* lm =
NULL;
166 std::ifstream ifile(lmNm.c_str(), std::ios::in);
167 if ( !ifile.is_open() || ifile.fail() ) {
168 cerr <<
"Error: Could not find associated binary '" << lmNm
169 <<
"'; please specify explicitly.\n";
175 lm =
new binutils::LM();
176 lm->open(lmNm.c_str());
177 lm->read(binutils::LM::ReadFlg_ALL);
180 DIAG_EMsg(
"Exception encountered while reading " << lmNm);
210 cerr <<
"Error: Could not find any metrics to convert to PROFILE!\n";
236 const char* emsg =
NULL);
266 if (!out.empty()) { out +=
":"; }
274 cout <<
"No derived metrics available for this DCPI profile.";
276 cout <<
"The following metrics are available for this DCPI profile:\n";
280 cout <<
" -M " << out << endl;
281 cout <<
"(This line may be edited and passed to xprof.)" << endl;
296 const char* metricList,
const char* excludeMList)
306 if (metricList[0] !=
'\0') {
315 if (excludeMList[0] !=
'\0') {
339 for (
StringListIt it = mlist->begin(); it != mlist->end(); ++it) {
340 const string& nm = *it;
356 flist->push_back(
string(e->
name));
372 for (
StringListIt it = flist->begin(); it != flist->end(); ++it) {
373 const string& nm = *it;
379 cerr << emsg <<
" The DCPI filter '" << nm <<
"' is invalid for this profile.\n";
410 bool pmavail =
false;
436 if (!str) {
return l; }
438 char* tok = strtok(const_cast<char*>(str),
":");
439 while (tok !=
NULL) {
440 l->push_back(
string(tok));
441 tok = strtok((
char*)
NULL,
":");
452 for (
StringListIt it2 = l2->begin(); it2 != l2->end(); ++it2) {
453 const string& nm2 = *it2;
456 for (
StringListIt it1 = l1->begin(); it1 != l1->end(); ) {
457 const string& nm1 = *it1;
459 it1 = l1->erase(it1);
unsigned int GetNumMetrics() const
StringList::const_iterator StringListCIt
StringList * ConvertColonListToStringList(const char *str)
static PCProfile * ReadProfileFile(const char *profFile)
std::list< string > StringList
PCProfileFilter * GetPredefinedDCPIFilter(const char *metric, binutils::LM *lm)
static Entry * FindEntry(const char *token)
StringList * GetAvailPredefDCPIFilterNms(DCPIProfile *prof, binutils::LM *lm)
unsigned int listAvailableMetrics
static void WriteProfile(std::ostream &os, DerivedProfile *profData, binutils::LM *lm)
static Entry * Index(unsigned int i)
virtual std::string message() const
bool IsPredefDCPIFilterAvail(DCPIProfile *prof, StringList *flist, const char *emsg=NULL)
int main(int argc, char *argv[])
int real_main(int argc, char *argv[])
static unsigned int GetSize()
PCProfileFilterList * GetDCPIFilters(DCPIProfile *prof, binutils::LM *lm, const char *metricList, const char *excludeMList)
void ListAvailPredefDCPIFilters(DCPIProfile *prof, bool longlist=false)
StringList::iterator StringListIt
const std::string & GetProfiledFile() const
const std::string & GetName() const
void RemoveFromList(StringList *l1, StringList *l2)