Commit eec37385 authored by Carla Guillen's avatar Carla Guillen

using MS_TO_NS function

parent bea7ae7c
......@@ -100,7 +100,7 @@ void PerSystSqlOperator::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << "PerSystSQL Operator " << _name;
LOG_VAR(ll) << "====================================";
LOG_VAR(ll) << "backend=" << _backend;
LOG_VAR(ll) << "go_back_ms=" << _go_back_ns/1000000;
LOG_VAR(ll) << "go_back_ms=" << _go_back_ns/1e6;
LOG_VAR(ll) << "scaling_factor=" << _scaling_factor;
LOG_VAR(ll) << "batch_domain=" << _batch_domain;
if(_backend == MARIADB){
......
......@@ -203,7 +203,7 @@ void SMUCNGPerfConfigurator::operatorAttributes(SMUCNGPerfOperator& op, CFG_VAL
}
} else if(boost::iequals(val.first, "go_back_ms")) {
try {
auto go_back_ms = std::stod(val.second.data());
auto go_back_ms = std::stoull(val.second.data());
op.setGoBackMs(go_back_ms);
} catch (const std::exception &e) {
LOG(error) << " Error parsing go_back_ms \"" << val.second.data() << "\": " << e.what();
......
......@@ -228,7 +228,7 @@ void SMUCNGPerfOperator::computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUC
void SMUCNGPerfOperator::computeProfileMetric(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp){
auto queryMetrics = _profileMetricToMetricIds[outSensor->getMetric()]; //should be here since this was queried in the compute() member function
for(std::size_t i = 0; i < queryMetrics.size(); ++i){
if(!_queryEngine.querySensor(inputs[_metricToPosition[queryMetrics[i]]]->getName(), timestamp - (_interval * 1e6), timestamp, _buffers[i], false)){
if(!_queryEngine.querySensor(inputs[_metricToPosition[queryMetrics[i]]]->getName(), timestamp - MS_TO_NS(_interval), timestamp, _buffers[i], false)){
LOG(debug) << "Could not find data for metric id " << queryMetrics[i];
return;
}
......
......@@ -50,7 +50,7 @@ public:
_measuring_interval_s = measurement_interval_s;
}
void setGoBackMs(int go_back_ms){
_go_back_ns = go_back_ms * 1e6;
_go_back_ns = MS_TO_NS(go_back_ms);
}
protected:
......@@ -63,8 +63,9 @@ protected:
vector<vector<reading_t>> _buffers;
const unsigned int MAX_FREQ_MHZ = 2700;
const unsigned int MIN_FREQ_MHZ = 1200;
double _go_back_ns;
double _measuring_interval_s;
uint64_t _go_back_ns;
double _measuring_interval_s; //<! preferred as double since we need decimal places
// and use it in divisionis (metric/s)
virtual void compute(U_Ptr unit) override;
......
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