Skip to content
Snippets Groups Projects
Commit 227be0c1 authored by Elizabeth's avatar Elizabeth
Browse files

Added option to input command line args to binary to run

parent b58b4d27
No related branches found
No related tags found
No related merge requests found
...@@ -201,11 +201,11 @@ private: ...@@ -201,11 +201,11 @@ private:
} }
// Executes the program to be profiled // Executes the program to be profiled
void runProgram(const char * const program) { void runProgram(const std::string& program) {
// Tell the profiling thread to start, execute the program that needs // Tell the profiling thread to start, execute the program that needs
// to be profiled, and then tell the profiling thread to stop. // to be profiled, and then tell the profiling thread to stop.
start_ = true; start_ = true;
const auto result = std::system(program); const auto result = std::system(program.c_str());
stop_ = true; stop_ = true;
} }
...@@ -471,7 +471,7 @@ public: ...@@ -471,7 +471,7 @@ public:
sys_stream_.close(); sys_stream_.close();
} }
void profile(const char * const program, const int iterations) { void profile(const std::string& program, const int iterations) {
iterations_ = iterations; iterations_ = iterations;
resetGlobal(); resetGlobal();
...@@ -568,16 +568,26 @@ public: ...@@ -568,16 +568,26 @@ public:
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < NUM_ARGS) { if (argc < NUM_ARGS) {
std::cout << "Usage: " << argv[0] << " <program> <iterations> <tensor output file> [power output file]\n"; std::cout << "Usage: " << argv[0] << " <program> <params> END_PARAM <iterations> <tensor output file> [power output file]\n";
exit(1); exit(1);
} }
std::string program(argv[1]);
size_t i = 2;
for (; i < argc; i++){
if (std::string(argv[i]) == "END_PARAM"){
break;
}
program += " " + std::string(argv[i]);
}
i += 1;
Profiler pp; Profiler pp;
pp.profile(argv[1], std::stoi(argv[2])); pp.profile(program, std::stoi(argv[i + 1]));
pp.dumpTensorInfo(argv[3]); pp.dumpTensorInfo(argv[i + 2]);
if (argc > NUM_ARGS) if (argc > NUM_ARGS)
pp.dumpPowerReadings(argv[4]); pp.dumpPowerReadings(argv[i + 3]);
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment