2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 88f3104f authored by Alessio Netti's avatar Alessio Netti
Browse files

PrintConfig functionality added to Data Analytics Framework

- Added some more indentation to make the configurations more readable
- Fixed one more warning in dcdbquery
parent abf6af19
......@@ -193,5 +193,5 @@ void MSRSensorGroup::printConfig(LOG_LEVEL ll) {
separator = ", ";
}
LOG_VAR(ll) << " CPUs: " << ss.str();
LOG_VAR(ll) << " CPUs: " << ss.str();
}
......@@ -65,7 +65,8 @@ public:
void setCounterData(int counterData) { _counterData = static_cast<PORT_COUNTER_DATA>(counterData); }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
std::string cntData("unknown");
switch (_counterData) {
case portXmitData:
......@@ -150,7 +151,7 @@ public:
cntData = "uncorrectableErrors";
break;
}
LOG_VAR(ll) << " Counter data: " << cntData;
LOG_VAR(ll) << leading << " Counter data: " << cntData;
}
protected:
......
......@@ -199,6 +199,6 @@ void OpaSensorGroup::readAsync() {
}
void OpaSensorGroup::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " HFI Num: " << _hfiNum;
LOG_VAR(ll) << " Port Num: " << _portNum;
LOG_VAR(ll) << " HFI Num: " << _hfiNum;
LOG_VAR(ll) << " Port Num: " << _portNum;
}
......@@ -106,8 +106,9 @@ public:
}
}
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " XML Path: " << getXMLPathString();
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
LOG_VAR(ll) << leading << " XML Path: " << getXMLPathString();
}
protected:
......
......@@ -152,9 +152,9 @@ void PDUSensorGroup::readAsync() {
void PDUSensorGroup::printConfig(LOG_LEVEL ll) {
if (_pdu) {
LOG_VAR(ll) << " PDU Unit: " << _pdu->getHost();
LOG_VAR(ll) << " PDU Unit: " << _pdu->getHost();
} else {
LOG_VAR(ll) << " No Host set!";
LOG_VAR(ll) << " No Host set!";
}
LOG_VAR(ll) << " Request: " << _request;
LOG_VAR(ll) << " Request: " << _request;
}
......@@ -44,9 +44,10 @@ public:
void setType(unsigned type) { _type = type; }
void setConfig(unsigned config) { _config = config; }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " Type: " << _type;
LOG_VAR(ll) << " Config: " << _config;
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
LOG_VAR(ll) << leading << " Type: " << _type;
LOG_VAR(ll) << leading << " Config: " << _config;
}
protected:
......
......@@ -275,9 +275,9 @@ uint64_t PerfSensorGroup::calculateIntervalValue(uint64_t previous, uint64_t cur
void PerfSensorGroup::printConfig(LOG_LEVEL ll) {
if (_sensorGroupLeader) {
LOG_VAR(ll) << " This is a Leader Group";
LOG_VAR(ll) << " This is a Leader Group";
} else {
LOG_VAR(ll) << " This is a Non-Leader Group";
LOG_VAR(ll) << " This is a Non-Leader Group";
}
LOG_VAR(ll) << " CPU Id: " << _cpuId;
LOG_VAR(ll) << " CPU Id: " << _cpuId;
}
......@@ -47,14 +47,11 @@ public:
void setCPUId(int i) { this->_cpuId = i; }
int getCPUId() { return this->_cpuId; }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " Metric: " << _metric;
LOG_VAR(ll) << " CPU Id: " << _cpuId;
if (_perCPU) {
LOG_VAR(ll) << " perCPU: true";
} else {
LOG_VAR(ll) << " perCPU: false";
}
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
LOG_VAR(ll) << leading << " Metric: " << _metric;
LOG_VAR(ll) << leading << " CPU Id: " << _cpuId;
LOG_VAR(ll) << leading << " PerCPU: " << (_perCPU ? "enabled" : "disabled");
}
protected:
......
......@@ -148,11 +148,11 @@ void ProcfsSensorGroup::readAsync() {
void ProcfsSensorGroup::printConfig(LOG_LEVEL ll) {
if (_parser) {
LOG_VAR(ll) << " Parser set";
LOG_VAR(ll) << " Parser set";
} else {
LOG_VAR(ll) << " No Parser set!";
LOG_VAR(ll) << " No Parser set!";
}
LOG_VAR(ll) << " Type: " << _type;
LOG_VAR(ll) << " Path: " << _path;
LOG_VAR(ll) << " MQTT start: " << _mqttStart;
LOG_VAR(ll) << " Type: " << _type;
LOG_VAR(ll) << " Path: " << _path;
LOG_VAR(ll) << " MQTT start: " << _mqttStart;
}
......@@ -67,8 +67,9 @@ public:
}
const std::string getOIDSuffix() const { return _oidSuffix; }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " OID: " << getOIDString();
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
LOG_VAR(ll) << leading << " OID: " << getOIDString();
}
......
......@@ -88,8 +88,8 @@ void SNMPSensorGroup::readAsync() {
void SNMPSensorGroup::printConfig(LOG_LEVEL ll) {
if (_connection) {
LOG_VAR(ll) << " Connection: " << _connection->getHost();
LOG_VAR(ll) << " Connection: " << _connection->getHost();
} else {
LOG_VAR(ll) << " No Connection set!";
LOG_VAR(ll) << " No Connection set!";
}
}
......@@ -64,12 +64,13 @@ public:
void setRegex(boost::regex regx) { _regx = regx; }
void setSubstitution(const std::string& substitution) { _substitution = substitution; }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) {
std::string leading(leadingSpaces, ' ');
if (_filter) {
LOG_VAR(ll) << " Using regular expression as filter";
LOG_VAR(ll) << " Substitution: " << _substitution;
LOG_VAR(ll) << leading << " Using regular expression as filter";
LOG_VAR(ll) << leading << " Substitution: " << _substitution;
} else {
LOG_VAR(ll) << " Not using any filter";
LOG_VAR(ll) << leading << " Not using any filter";
}
}
......
......@@ -119,5 +119,5 @@ void SysfsSensorGroup::readAsync() {
}
void SysfsSensorGroup::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " File path: " << _path;
LOG_VAR(ll) << " File path: " << _path;
}
......@@ -16,7 +16,7 @@ public:
TesterSensorBase(const std::string& name) : SensorBase(name) {}
virtual ~TesterSensorBase() {}
void printConfig(LOG_LEVEL ll, LOGGER& lg) { /* nothing to print */ }
void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces=16) { /* nothing to print */ }
};
#endif /* TESTER_TESTERSENSORBASE_H_ */
......@@ -83,7 +83,7 @@ void TesterSensorGroup::readAsync() {
}
void TesterSensorGroup::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " Value: " << _value;
LOG_VAR(ll) << " Num Sensors: " << _numSensors;
LOG_VAR(ll) << " MQTT start: " << _mqttStart;
LOG_VAR(ll) << " Value: " << _value;
LOG_VAR(ll) << " Num Sensors: " << _numSensors;
LOG_VAR(ll) << " MQTT start: " << _mqttStart;
}
......@@ -106,7 +106,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
}
std::cout << std::endl;
int64_t prevValue;
int64_t prevValue=0;
DCDB::TimeStamp prevT((uint64_t) 0);
for (std::list<DCDB::SensorDataStoreReading>::iterator reading = results.begin(); reading != results.end(); reading++) {
int64_t value = (*reading).value;
......
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