JobTSAggregatorOperator.h 2.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//================================================================================
// Name        : JobTSAggregatorOperator.h
// Author      : Carla Guillen
// Contact     : info@dcdb.it
// Copyright   : Leibniz Supercomputing Centre
// Description : Template implementing features to use Units in Operators.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2018-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================

#ifndef ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_
#define ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_

#include <vector>

#include "../../../common/include/cacheentry.h"
#include "../../includes/JobOperatorTemplate.h"
#include "../aggregator/AggregatorSensorBase.h"

class JobTSAggregatorOperator: public JobOperatorTemplate<AggregatorSensorBase>{
public:
	JobTSAggregatorOperator(const std::string& name);
	virtual ~JobTSAggregatorOperator();
	void compute(U_Ptr unit, qeJobData& jobData) override;

	unsigned int getNumberOfEvenQuantiles() const {
		return number_of_even_quantiles;
	}

	void setNumberOfEvenQuantiles(unsigned int numberOfEvenQuantiles) {
		number_of_even_quantiles = numberOfEvenQuantiles;
	}

	void setQuantileSensor(AggregatorSBPtr qSensor){
		_quantileSensors.push_back(qSensor);
	}

private:
	std::vector<reading_t> _buffer;

protected:
	virtual void compute(U_Ptr unit)	 override;
	void compute_internal(U_Ptr unit, vector<reading_t> buffer);
	std::vector<AggregatorSBPtr> _quantileSensors;
	unsigned int number_of_even_quantiles;
};

Carla Guillen Carias's avatar
Carla Guillen Carias committed
65
66
67
68
69
float severity_formula1(float metric, float threshold, float exponent);
float severity_formula2(float metric, float threshold, float exponent);
float severity_formula3(float metric, float threshold, float exponent);
float severity_memory(float metric, float threshold, float max_memory);
constexpr float severity_noformula(){return 0;} //No severity
lu43jih's avatar
lu43jih committed
70

71
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_ */