MetroCollect  2.3.4
MetricsSourceArray.h
Go to the documentation of this file.
1 //
2 // MetricsSources.h
3 //
4 // Created on August 8th 2018
5 //
6 // Copyright 2018 CFM (www.cfm.fr)
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 //
20 
21 #pragma once
22 
23 #include "SourceProcStat.h"
24 #include "SourceProcMeminfo.h"
25 #include "SourceProcNetDev.h"
26 #include "SourceEthtool.h"
27 
28 
38 
39  static constexpr size_t count = 4;
40 
41 
46 
47 
54  template<typename Function>
55  void forEach(Function func) {
56  func(procStat, 0);
57  func(procMemInfo, 1);
58  func(procNetDev, 2);
59  func(ethtool, 3);
60  }
61 
68  template<typename Function>
69  void forEach(Function func) const {
70  func(procStat, 0);
71  func(procMemInfo, 1);
72  func(procNetDev, 2);
73  func(ethtool, 3);
74  }
75  };
76 }
Sources of network metrics extracted from the file /proc/net/dev.
static constexpr size_t count
Number of sources.
SourceProcStat & procStat
CPU metrics source (index: 1)
Namespace for sources of metrics objects and operations.
Sources of network metrics extracted from Ethtool interface.
Definition: SourceEthtool.h:40
Simple struct to hold references to each source singleton.
SourceEthtool & ethtool
Ethtool metrics source (index: 4)
Sources of CPU metrics extracted from the file /proc/stat.
void forEach(Function func) const
Execute a const function for each source.
void forEach(Function func)
Execute a function for each source.
Sources of memory metrics extracted from the file /proc/meminfo.
SourceProcMeminfo & procMemInfo
Memory metrics source (index: 2)
SourceProcNetDev & procNetDev
Network metrics source (index: 3)
MetricsSourceArray()
Construct a new Metrics Source Array object.