MSRConfigurator.cpp 886 Bytes
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
/*
 * MSRConfigurator.cpp
 *
 *  Created on: 28.01.2019
 *      Author: Your name goes here!
 */

#include "MSRConfigurator.h"

MSRConfigurator::MSRConfigurator() {
	_groupName = "group";
	_baseName = "sensor";
}

MSRConfigurator::~MSRConfigurator() {}

void MSRConfigurator::sensorBase(MSRSensorBase& s, CFG_VAL config) {
	ADD {
		if (boost::iequals(val.first, "delta")) {
			//it is explicitly stated to be off --> set it to false
			s.setDelta( !(val.second.data() == "off") );
		} else if (boost::iequals(val.first, "metric")){
			s.setMetric(std::stoull(val.second.data(),nullptr,16));
		}
	}
}

void MSRConfigurator::sensorGroup(MSRSensorGroup& s, CFG_VAL config) {
	ADD {
		if (boost::iequals(val.first, "cpus")){
			std::set<int> cpus = ConfiguratorTemplate::parseCpuString(val.second.data());
			for(int cpu: cpus){
				s.addCpu(static_cast<unsigned int>(cpu));
			}
		}
	}
}