SMUCNGPerfOperator.h 4.59 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
//================================================================================
// Name        : SMUCNGPerfOperator.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.
//================================================================================
27

28
29
#ifndef ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_
#define ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_
30

31
#include "../../includes/OperatorTemplate.h"
32
#include "SMUCSensorBase.h"
Carla Guillen's avatar
Carla Guillen committed
33
#include "SKXPMUMetrics.h"
34
#include <map>
35
#include <set>
36

37
class SMUCNGPerfOperator: virtual public OperatorTemplate<SMUCSensorBase>{
38
public:
Carla Guillen's avatar
Carla Guillen committed
39
40
41
42
    SMUCNGPerfOperator(const std::string& name);
    virtual ~SMUCNGPerfOperator();
    SMUCNGPerfOperator(const SMUCNGPerfOperator& other);
    SMUCNGPerfOperator& operator=(const SMUCNGPerfOperator& other);
43
44
    void printConfig(LOG_LEVEL ll) override;

Carla Guillen's avatar
Carla Guillen committed
45
    void setMetricToPosition(const std::map<SMUCSensorBase::Metric_t,unsigned int>&metricToPosition) {
46
		_metricToPosition = metricToPosition;
Carla Guillen's avatar
Carla Guillen committed
47
    }
48

49
50
51
    void setMeasuringInterval(double measurement_interval_s){
    	_measuring_interval_s = measurement_interval_s;
    }
Carla Guillen's avatar
Carla Guillen committed
52
    void setGoBackMs(int go_back_ms){
53
    	_go_back_ns = go_back_ms * 1e6;
Carla Guillen's avatar
Carla Guillen committed
54
    }
55

56
protected:
57
    std::map<SMUCSensorBase::Metric_t, unsigned int> _metricToPosition;
58
    std::map<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t> _metricPerSecToId;
59
    std::map<SMUCSensorBase::Metric_t, std::pair<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t>> _metricRatioToPair;
60
    std::map<SMUCSensorBase::Metric_t, std::vector<SMUCSensorBase::Metric_t>> _profileMetricToMetricIds;
61
    std::set<SMUCSensorBase::Metric_t> _flop_metric;
62
    std::map<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t> _as_is_metric;
Carla Guillen Carias's avatar
Carla Guillen Carias committed
63
    vector<vector<reading_t>> _buffers;
Carla Guillen's avatar
Carla Guillen committed
64
65
    const unsigned int MAX_FREQ_MHZ = 2700;
    const unsigned int MIN_FREQ_MHZ = 1200;
Carla Guillen's avatar
Carla Guillen committed
66
    double _go_back_ns;
67
    double _measuring_interval_s;
Carla Guillen's avatar
Carla Guillen committed
68

69
70
    virtual void compute(U_Ptr unit) override;

Carla Guillen Carias's avatar
Carla Guillen Carias committed
71

Carla Guillen's avatar
Carla Guillen committed
72
73
    void resetBuffers();
    void query(const std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer);
74
75

    void copy(const SMUCNGPerfOperator& other);
76
77
78
79

    void computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
    void computeMetricPerSecond(std::vector<SMUCNGPtr> &inputs, SMUCNGPtr& outSensor, const uint64_t timestamp);

80
81
    void computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
	void computeFLOPS(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
82
	void computeLOADIMBALANCES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
83
84
85
	void computeL3_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
	void computeL3HIT_TO_L3MISS_RATIO(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
	void computeMEMORY_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
86
87
	void computeProfileMetric(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);

Carla Guillen's avatar
Carla Guillen committed
88
89
90
91
92
93
	/**
         * Both DRAM and PACKAGE are calculated the same way: first divide by the interval and then 
         * aggregate socket-wise
	 **/
	void computePOWER(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr & outSensor, const uint64_t timestamp);

Carla Guillen's avatar
Carla Guillen committed
94
	bool isAMetricPerSecond(SMUCSensorBase::Metric_t comp);
95
	bool isAMetricRatio(SMUCSensorBase::Metric_t comp);
96
	bool isAProfileMetric(SMUCSensorBase::Metric_t comp);
97
98
};

99
#endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */