Commit 3cbed5d2 authored by Ondrej Vysocky's avatar Ondrej Vysocky
Browse files

ENH handling return values of system calls #38

parent 08ac7aec
......@@ -14,7 +14,8 @@ int JETSON::FREQUENCY = 10;
void JETSON::init() //int rank = 0)
{
//start energy measurement
system((std::string(MERIC_PATH)+"/tools/getJTX1measurements.py "+ARM_INFO+" &").c_str());
if (system((std::string(MERIC_PATH)+"/tools/getJTX1measurements.py "+ARM_INFO+" &").c_str()))
std::cerr << "JETSON energy measurement system ERROR: connection failed\n";
//get name of the file with measurements
char hostname[50];
......@@ -36,7 +37,8 @@ int JETSON::getSamples() //prejmenovat loadSamples()
if (timestamp == prevstamp)
{
std::cerr << "MERIC ERROR: missing energy samples, energy measurement has already ended\n";
system("pkill -f -INT getJTX1measurements.py 2> /dev/null"); //just to be sure
if (system("pkill -f -INT getJTX1measurements.py 2> /dev/null")) //just to be sure
std::cerr << "JETSON energy measurement system ERROR: connection failed\n";
return 1;
}
prevstamp = timestamp;
......@@ -81,7 +83,8 @@ int JETSON::getSamples() //prejmenovat loadSamples()
}while(timestamp <= currentTime);
//stop energy measurement
system("pkill -f -INT getJTX1measurements.py");
if (system("pkill -f -INT getJTX1measurements.py"))
std::cerr << "JETSON energy measurement system ERROR: connection failed\n";
//load samples
std::ifstream iFile(filename);
......
......@@ -14,7 +14,8 @@ int THUNDER::FREQUENCY = 1;
void THUNDER::init() //int rank = 0)
{
//start energy measurement
system(("ssh -f hca \""+std::string(MERIC_PATH)+"/tools/getYokogawaMeasurements.py "+ARM_INFO+"\"").c_str());
if (system(("ssh -f hca \""+std::string(MERIC_PATH)+"/tools/getYokogawaMeasurements.py "+ARM_INFO+"\"").c_str()))
std::cerr << "THUNDER energy measurement system ERROR: connection failed\n";
filename = std::string(MERIC_PATH)+"/tools/yokogawaMeasurement/hca-server.csv"; //one file for all nodes
}
......@@ -29,7 +30,8 @@ int THUNDER::getSamples() //prejmenovat loadSamples()
double prevstamp = 0.0;
//stop energy measurement
sleep(5); //output file is located at hca-server and it will be moved to the system when the measurement is closed
system("ssh hca \"pkill -f -INT getYokogawaMeasurements.py\"");
if (system("ssh hca \"pkill -f -INT getYokogawaMeasurements.py\""))
std::cerr << "THUNDER energy measurement system ERROR: connection failed\n";
sleep(1);
//load samples
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment