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

Commit 635b1b19 authored by Carla Guillen's avatar Carla Guillen

Fixing lookups for metadata in PerSystSql, only done once. And small...

Fixing lookups for metadata in PerSystSql, only done once. And small refactoring in SMUCNGPerfOperator
parent 5ead00a6
......@@ -51,7 +51,7 @@ PerSystSqlOperator::PerSystSqlOperator(const std::string& name) :
OperatorTemplate(name), JobOperatorTemplate(name), _number_of_even_quantiles(
0), _severity_formula(NOFORMULA), _severity_threshold(0), _severity_exponent(
0), _severity_max_memory(0), _go_back_ns(0), _backend(DEFAULT), _scaling_factor(
1), _property_id(0) {
1), _property_id(0), _searchedOnceForMetaData(false) {
_persystdb = MariaDB::getInstance();
}
......@@ -90,6 +90,7 @@ void PerSystSqlOperator::copy(const PerSystSqlOperator& other){
this->_conn.user = other._conn.user;
this->_property_id = other._property_id;
this->_persystdb = other._persystdb;
this->_searchedOnceForMetaData = other._searchedOnceForMetaData;
}
void PerSystSqlOperator::printConfig(LOG_LEVEL ll) {
......@@ -151,16 +152,14 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
for (const auto& subUnit : unit->getSubUnits()) {
// Since we do not clear the internal buffer, all sensor readings will be accumulated in the same vector
for (const auto& in : subUnit->getInputs()) {
if( _scaling_factor == 1){
if(!_searchedOnceForMetaData){
SensorMetadata buffer;
if(_queryEngine.queryMetadata(in->getName(), buffer) && buffer.getScale()){
_scaling_factor = *buffer.getScale();
LOG(debug) << "PerSystSql Operator " << _name << " using scaling factor of " << _scaling_factor;
_searchedOnceForMetaData = true;
}
}
/*if (!_queryEngine.querySensor(in->getName(), my_timestamp, my_timestamp, _buffer, false)) {
//LOG(debug)<< "PerSystSql Operator " << _name << " cannot read from sensor " << in->getName() << "!";
}*/
vectorOfSensorNames.push_back(in->getName());
}
}
......
......@@ -145,6 +145,7 @@ private:
int _go_back_ns;
Backend_t _backend;
double _scaling_factor;
bool _searchedOnceForMetaData;
struct MariaDB_conn_t {
std::string host;
......
......@@ -202,7 +202,6 @@ void SMUCNGPerfOperator::computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUC
SMUCSensorBase::Metric_t metric_divisor = found->second.second;
query(inputs[_metricToPosition[metric_dividend]]->getName(), timestamp, dividend);
query(inputs[_metricToPosition[metric_divisor]]->getName(), timestamp, divisor);
bool wascalced = false;
reading_t ratio;
if (dividend.size() > 0 && divisor.size() > 0 && calculateMetricRatio(dividend[0], divisor[0], ratio, *outSensor->getMetadata()->getScale())) {
outSensor->storeReading(ratio);
......
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