Commit 9d77eae5 authored by Micha Müller's avatar Micha Müller

Add printConfig method to MSR plugin

parent 3919c08c
......@@ -16,10 +16,7 @@ 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")){
if (boost::iequals(val.first, "metric")){
s.setMetric(std::stoull(val.second.data(),nullptr,16));
}
}
......
......@@ -14,7 +14,8 @@ class MSRSensorBase : public SensorBase {
public:
MSRSensorBase(const std::string& name) :
SensorBase(name), _cpu(0), _metric(0) {
//default delta to true, as msr has only monotonic sensors usually
_delta = true;
}
MSRSensorBase(const MSRSensorBase& other)=default;
......@@ -40,6 +41,11 @@ public:
_metric = metric;
}
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " CPU: " << _cpu;
LOG_VAR(ll) << " Metric: " << _metric;
}
protected:
unsigned int _cpu;
uint64_t _metric;
......
......@@ -184,3 +184,14 @@ void MSRSensorGroup::program_fixed(){
void MSRSensorGroup::addCpu(unsigned int cpu){
cpuToFd[cpu] = -1; /* -1 because no file descriptor has been assigned yet. */
}
void MSRSensorGroup::printConfig(LOG_LEVEL ll) {
std::stringstream ss;
const char* separator = "";
for (auto &kv : cpuToFd) {
ss << separator << kv.first;
separator = ", ";
}
LOG_VAR(ll) << " CPUs: " << ss.str();
}
......@@ -28,6 +28,8 @@ public:
void addCpu(unsigned int cpu);
//void init(boost::asio::io_service& io) override;
void printConfig(LOG_LEVEL ll) override;
private:
void read() override;
void readAsync() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment