Commit 5d792aaa authored by lu43jih's avatar lu43jih
Browse files

adding severity formulae

parent 45d0f53d
......@@ -62,4 +62,50 @@ protected:
unsigned int number_of_even_quantiles;
};
float severity_formula1(float metric, float threshold, float exponent){
float val = metric - threshold;
if (val > 0) {
float ret = (pow(val, exponent));
if(ret > 1){
return 1;
}
return ret;
}
return 0;
}
float severity_formula2(float metric, float threshold, float exponent){
if(threshold == 0){
return -1;
}
float val = metric / threshold - 1;
if (val > 0) {
float ret= (pow(val, exponent));
if(ret > 1){
return 1;
}
return ret;
}
return 0;
}
float severity_formula3(float metric, float threshold, float exponent){
if (threshold == 0) {
return -1;
}
float val = metric / threshold;
if (val > 0) {
float ret= (1 - pow(val, exponent));
if(ret > 1 ){
return 1;
}
if( ret < 0 ){
return 0;
}
return ret;
}
return 0;
}
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_ */
Supports Markdown
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