83 realmain(
int argc,
char*
const* argv);
86 main(
int argc,
char*
const* argv)
97 catch (
const std::bad_alloc& x) {
98 DIAG_EMsg(
"[std::bad_alloc] " << x.what());
101 catch (
const std::exception& x) {
102 DIAG_EMsg(
"[std::exception] " << x.what());
106 DIAG_EMsg(
"Unknown exception encountered!");
139 int ret = driver.
run();
149 #define NUM_PREFIX_LINES 2 152 buildConfFile(
const string& hpcHome,
const string& confFile);
163 DIAG_Msg(2,
"Initializing from: " << cfgFile);
170 parser.
parse(args, metricMgr);
172 catch (
const SAXParseException& ) {
173 unlink(tmpFile.c_str());
178 unlink(tmpFile.c_str());
183 unlink(tmpFile.c_str());
184 DIAG_EMsg(
"While processing '" << cfgFile <<
"'...");
188 unlink(tmpFile.c_str());
198 string hpcloc = hpcHome;
199 if (hpcloc[hpcloc.length()-1] !=
'/') {
202 std::ofstream os(tmpFile.c_str(), std::ios_base::out);
205 DIAG_Throw(
"Unable to write temporary file: " << tmpFile);
209 os <<
"<?xml version=\"1.0\"?>" << std::endl
210 <<
"<!DOCTYPE HPCPROF SYSTEM \"" << hpcloc
211 <<
"share/hpctoolkit/dtd/hpcprof-config.dtd\">" << std::endl;
225 #define MAX_IO_SIZE (64 * 1024) 227 std::ifstream src(srcFile);
229 DIAG_Throw(
"Unable to read file: " << srcFile);
233 for(; !src.eof(); ) {
236 ssize_t nRead = src.gcount();
237 if (nRead == 0)
break;
238 dest.write(buf, nRead);
240 DIAG_Throw(
"appendContents: failed!");
void makeRawMetrics(const std::vector< std::string > &profileFiles, bool isUnitsEvents=true, bool doDispPercent=true)
virtual std::string message() const
static int realmain(int argc, char *const *argv)
static RealPathMgr & singleton()
std::string searchPathStr
bool configurationFileMode
static string buildConfFile(const string &hpcHome, const string &confFile)
virtual std::string message() const
void parse(Analysis::Args &args, Prof::Metric::Mgr &metricMgr)
std::string configurationFile
static void readConfFile(Args &args, Prof::Metric::Mgr &metricMgr)
int main(int argc, char *argv[])
std::vector< std::string > profileFiles
const std::string & searchPaths() const
#define DIAG_Msg(level,...)
static void appendContents(std::ofstream &dest, const char *srcFile)