Commit 7739c24f authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

developing severity computations

parent a95dd970
......@@ -9,7 +9,13 @@ relaxed true
persystsql cpi_p {
default def1
number_quantiles 10
topic_quantiles
topic_quantiles
severity_threshold 1.5
severity_exponent 2
severity_formula formula1
severity_max_memory 100000000
input {
;/.../computenode/cpux/cpi
sensor "<bottomup 1>cpi"
......
......@@ -76,6 +76,26 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
if (boost::iequals(val.first, "number_quantiles")) {
unsigned int num_quantiles = std::stoul(val.second.data());
op.setNumberOfEvenQuantiles(num_quantiles);
}else if (boost::iequals(val.first, "severity_threshold")){
auto threshold = std::stof(val.second.data());
op.setSeverityThreshold(threshold);
} else if (boost::iequals(val.first, "severity_exponent")){
auto exponent = std::stof(val.second.data());
op.setSeverityThreshold(exponent);
} else if (boost::iequals(val.first, "severity_formula")){
std::string formula = val.second.data();
if(formula == "formula1"){
op.setSeverityFormula(PerSystSqlOperator::FORMULA1);
} else if (formula == "formula2") {
op.setSeverityFormula(PerSystSqlOperator::FORMULA2);
} else if (formula == "formula3") {
op.setSeverityFormula(PerSystSqlOperator::FORMULA3);
} else if (formula == "memory_formula"){
op.setSeverityFormula(PerSystSqlOperator::MEMORY_FORMULA);
}
} else if (boost::iequals(val.first, "severity_max_memory")){
auto max_memory = std::stof(val.second.data());
op.setSeverityMaxMemory(max_memory);
}
}
}
......
......@@ -41,7 +41,9 @@
#include "PerSystSqlOperator.h"
PerSystSqlOperator::PerSystSqlOperator(const std::string& name) :
OperatorTemplate(name), JobOperatorTemplate(name), number_of_even_quantiles(0) {
OperatorTemplate(name), JobOperatorTemplate(name), _number_of_even_quantiles(0),
_severity_formula(NOFORMULA), _severity_threshold(0), _severity_exponent(0),
_severity_max_memory(0) {
}
PerSystSqlOperator::~PerSystSqlOperator() {
......@@ -99,6 +101,9 @@ void PerSystSqlOperator::compute_internal(U_Ptr unit, vector<reading_t> buffer)
case AggregatorSensorBase::OBS:
reading.value = computeObs(buffer);
break;
case AggregatorSensorBase::AVG_SEV:
reading.value = computeSeverityAverage(buffer);
break;
default:
LOG(warning) << _name << ": Encountered unknown operation!";
reading.value = 0;
......@@ -112,7 +117,7 @@ void PerSystSqlOperator::compute_internal(U_Ptr unit, vector<reading_t> buffer)
if(!_quantileSensors.empty()) {
vector<int64_t> quantiles;
computeEvenQuantiles(buffer, number_of_even_quantiles, quantiles);
computeEvenQuantiles(buffer, _number_of_even_quantiles, quantiles);
for(unsigned idx=0; idx<quantiles.size(); idx++) {
reading.value = quantiles[idx];
_quantileSensors[idx]->storeReading(reading);
......@@ -182,3 +187,7 @@ float severity_memory(float metric, float threshold, float max_memory){
}
return severity;
}
void PerSystSqlOperator::computeSeverityAverage(vector<reading_t> & buffer){
}
......@@ -35,31 +35,60 @@
#include "../aggregator/AggregatorSensorBase.h"
class PerSystSqlOperator: public JobOperatorTemplate<AggregatorSensorBase>{
public:
enum Formula {
NOFORMULA = 0,
FORMULA1 = 1,
FORMULA2 = 2,
FORMULA3 = 3,
MEMORY_FORMULA = 4,
};
public:
PerSystSqlOperator(const std::string& name);
virtual ~PerSystSqlOperator();
void compute(U_Ptr unit, qeJobData& jobData) override;
unsigned int getNumberOfEvenQuantiles() const {
return number_of_even_quantiles;
return _number_of_even_quantiles;
}
void setNumberOfEvenQuantiles(unsigned int numberOfEvenQuantiles) {
number_of_even_quantiles = numberOfEvenQuantiles;
_number_of_even_quantiles = numberOfEvenQuantiles;
}
void setQuantileSensor(AggregatorSBPtr qSensor){
void pushbackQuantileSensor(AggregatorSBPtr qSensor){
_quantileSensors.push_back(qSensor);
}
void setSeverityExponent(float severityExponent) {
_severity_exponent = severityExponent;
}
void setSeverityFormula(Formula severityFormula) {
_severity_formula = severityFormula;
}
void setSeverityMaxMemory(float severityMaxMemory) {
_severity_max_memory = severityMaxMemory;
}
void setSeverityThreshold(float severityThreshold) {
_severity_threshold = severityThreshold;
}
private:
std::vector<reading_t> _buffer;
protected:
virtual void compute(U_Ptr unit) override;
void compute_internal(U_Ptr unit, vector<reading_t> buffer);
void computeSeverityAverage(vector<reading_t> & buffer);
std::vector<AggregatorSBPtr> _quantileSensors;
unsigned int number_of_even_quantiles;
unsigned int _number_of_even_quantiles;
Formula _severity_formula;
float _severity_threshold;
float _severity_exponent;
float _severity_max_memory;
};
float severity_formula1(float metric, float threshold, float exponent);
......
......@@ -37,32 +37,31 @@ SMUCNGPerfConfigurator::~SMUCNGPerfConfigurator() {
}
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
{
if (boost::iequals(val.first, "position")) {
unsigned int position = std::stoul(val.second.data());
s.setPosition(position);
std::string name = s.getName();
if(name.find("instructions") != std::string::npos){
_metricToPosition[SMUCSensorBase::INSTRUCTIONS] = position;
s.setMetric(SMUCSensorBase::INSTRUCTIONS);
} else if(name.find("clocks") != std::string::npos){
_metricToPosition[SMUCSensorBase::CLOCKS] = position;
s.setMetric(SMUCSensorBase::CLOCKS);
} else if(name.find("ref_clocks") != std::string::npos){
_metricToPosition[SMUCSensorBase::CLOCKS_REF] = position;
s.setMetric(SMUCSensorBase::CLOCKS_REF);
} else if(name.find("cpi") != std::string::npos){
_metricToPosition[SMUCSensorBase::CPI] = position;
s.setMetric(SMUCSensorBase::CPI);
} else if(name.find("frequency") != std::string::npos){
_metricToPosition[SMUCSensorBase::FREQUENCY] = position;
s.setMetric(SMUCSensorBase::FREQUENCY);
}
} else if (boost::iequals(val.first, "scaling_factor")){
unsigned int scaling_factor = std::stoul(val.second.data());
s.setScalingFactor(scaling_factor);
}
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "position")) {
unsigned int position = std::stoul(val.second.data());
s.setPosition(position);
std::string name = s.getName();
if(name.find("instructions") != std::string::npos) {
_metricToPosition[SMUCSensorBase::INSTRUCTIONS] = position;
s.setMetric(SMUCSensorBase::INSTRUCTIONS);
} else if(name.find("clocks") != std::string::npos) {
_metricToPosition[SMUCSensorBase::CLOCKS] = position;
s.setMetric(SMUCSensorBase::CLOCKS);
} else if(name.find("ref_clocks") != std::string::npos) {
_metricToPosition[SMUCSensorBase::CLOCKS_REF] = position;
s.setMetric(SMUCSensorBase::CLOCKS_REF);
} else if(name.find("cpi") != std::string::npos) {
_metricToPosition[SMUCSensorBase::CPI] = position;
s.setMetric(SMUCSensorBase::CPI);
} else if(name.find("frequency") != std::string::npos) {
_metricToPosition[SMUCSensorBase::FREQUENCY] = position;
s.setMetric(SMUCSensorBase::FREQUENCY);
}
} else if (boost::iequals(val.first, "scaling_factor")){
unsigned int scaling_factor = std::stoul(val.second.data());
s.setScalingFactor(scaling_factor);
}
}
}
......
......@@ -55,7 +55,6 @@ protected:
const unsigned int MAX_FREQ_MHZ = 2700;
const unsigned int MIN_FREQ_MHZ = 1200;
//unsigned int _measurement_interval;
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