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
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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();
}
......
......@@ -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";
}
}
......
......@@ -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_ */
......@@ -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