OpaSensorBase.h 5.23 KB
Newer Older
1
2
3
//================================================================================
// Name        : OpaSensorBase.h
// Author      : Micha Mueller
Micha Müller's avatar
Micha Müller committed
4
// Contact     : info@dcdb.it
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright   : Leibniz Supercomputing Centre
// Description : Sensor base class for Opa plugin.
//================================================================================

//================================================================================
// 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.
//================================================================================
Micha Mueller's avatar
Micha Mueller committed
27

28
29
30
31
32
33
34
/**
 * @defgroup opa OPA plugin
 * @ingroup  pusherplugins
 *
 * @brief Collect data from Intel Omni-Path Architecture (OPA) interfaces.
 */

Micha Mueller's avatar
Micha Mueller committed
35
36
37
#ifndef OPA_OPASENSORBASE_H_
#define OPA_OPASENSORBASE_H_

38
#include "sensorbase.h"
Micha Mueller's avatar
Micha Mueller committed
39
40

enum PORT_COUNTER_DATA {
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	portXmitData = 0,
	portRcvData = 1,
	portXmitPkts = 2,
	portRcvPkts = 3,
	portMulticastXmitPkts = 4,
	portMulticastRcvPkts = 5,
	localLinkIntegrityErrors = 6,
	fmConfigErrors = 7,
	portRcvErrors = 8,
	excessiveBufferOverruns = 9,
	portRcvConstraintErrors = 10,
	portRcvSwitchRelayErrors = 11,
	portXmitDiscards = 12,
	portXmitConstraintErrors = 13,
	portRcvRemotePhysicalErrors = 14,
	swPortCongestion = 15,
	portXmitWait = 16,
	portRcvFECN = 17,
	portRcvBECN = 18,
	portXmitTimeCong = 19,
	portXmitWastedBW = 20,
	portXmitWaitData = 21,
	portRcvBubble = 22,
	portMarkFECN = 23,
	linkErrorRecovery = 24,
	linkDowned = 25,
	uncorrectableErrors = 26
Micha Mueller's avatar
Micha Mueller committed
68
69
};

70
71
72
73
74
/**
 * @brief SensorBase specialization for this plugin.
 *
 * @ingroup opa
 */
75
class OpaSensorBase : public SensorBase {
76
77
78
79
80
81
      public:
	OpaSensorBase(const std::string &name)
	    : SensorBase(name),
	      _counterData(static_cast<PORT_COUNTER_DATA>(999)) {
		//default delta to true, as opa has only monotonic sensors usually
		_delta = true;
82
		_deltaMax = ULLONG_MAX;
83
	}
Micha Mueller's avatar
Micha Mueller committed
84

85
86
87
	OpaSensorBase(const OpaSensorBase &other)
	    : SensorBase(other),
	      _counterData(other._counterData) {}
88

Micha Mueller's avatar
Micha Mueller committed
89
90
	virtual ~OpaSensorBase() {}

91
92
93
	OpaSensorBase &operator=(const OpaSensorBase &other) {
		SensorBase::operator=(other);
		_counterData = other._counterData;
94

95
		return *this;
96
97
	}

Micha Mueller's avatar
Micha Mueller committed
98
99
	int getCounterData() const { return _counterData; }

Alessio Netti's avatar
Alessio Netti committed
100
	void setCounterData(int counterData) { _counterData = static_cast<PORT_COUNTER_DATA>(counterData); }
Micha Mueller's avatar
Micha Mueller committed
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	void printConfig(LOG_LEVEL ll, LOGGER &lg, unsigned leadingSpaces = 16) {
		std::string leading(leadingSpaces, ' ');
		std::string cntData("unknown");
		switch (_counterData) {
			case portXmitData:
				cntData = "portXmitData";
				break;
			case portRcvData:
				cntData = "portRcvData";
				break;
			case portXmitPkts:
				cntData = "portXmitPkts";
				break;
			case portRcvPkts:
				cntData = "portRcvPkts";
				break;
			case portMulticastXmitPkts:
				cntData = "portMulticastXmitPkts";
				break;
			case portMulticastRcvPkts:
				cntData = "portMulticastRcvPkts";
				break;
			case localLinkIntegrityErrors:
				cntData = "localLinkIntegrityErrors";
				break;
			case fmConfigErrors:
				cntData = "fmConfigErrors";
				break;
			case portRcvErrors:
				cntData = "portRcvErrors";
				break;
			case excessiveBufferOverruns:
				cntData = "excessiveBufferOverruns";
				break;
			case portRcvConstraintErrors:
				cntData = "portRcvConstraintErrors";
				break;
			case portRcvSwitchRelayErrors:
				cntData = "portRcvSwitchRelayErrors";
				break;
			case portXmitDiscards:
				cntData = "portXmitDiscards";
				break;
			case portXmitConstraintErrors:
				cntData = "portXmitConstraintErrors";
				break;
			case portRcvRemotePhysicalErrors:
				cntData = "portRcvRemotePhysicalErrors";
				break;
			case swPortCongestion:
				cntData = "swPortCongestion";
				break;
			case portXmitWait:
				cntData = "portXmitWait";
				break;
			case portRcvFECN:
				cntData = "portRcvFECN";
				break;
			case portRcvBECN:
				cntData = "portRcvBECN";
				break;
			case portXmitTimeCong:
				cntData = "portXmitTimeCong";
				break;
			case portXmitWastedBW:
				cntData = "portXmitWastedBW";
				break;
			case portXmitWaitData:
				cntData = "portXmitWaitData";
				break;
			case portRcvBubble:
				cntData = "portRcvBubble";
				break;
			case portMarkFECN:
				cntData = "portMarkFECN";
				break;
			case linkErrorRecovery:
				cntData = "linkErrorRecovery";
				break;
			case linkDowned:
				cntData = "linkDowned";
				break;
			case uncorrectableErrors:
				cntData = "uncorrectableErrors";
				break;
		}
		LOG_VAR(ll) << leading << "    Counter data:  " << cntData;
	}
Micha Mueller's avatar
Micha Mueller committed
190

191
192
      protected:
	PORT_COUNTER_DATA _counterData;
Micha Mueller's avatar
Micha Mueller committed
193
194
195
};

#endif /* OPA_OPASENSORBASE_H_ */