Commit a6818d68 authored by lu43jih's avatar lu43jih

removing bug when stopping sensor

parent 303bc910
......@@ -19,7 +19,7 @@ CXXFLAGS = -std=c++11 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -DBOOST_NETWORK_EN
LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -ldl -lmosquitto -lboost_system -lboost_thread -lboost_log_setup -lboost_log -lboost_regex -lpthread -lcrypto -lssl -lcppnetlib-server-parsers -lcppnetlib-uri -rdynamic
OBJS = src/dcdbpusher.o src/Configuration.o src/MQTTPusher.o src/HttpsServer.o src/analytics/AnalyticsManager.o src/analytics/SensorNavigator.o
PLUGINS = procfs pdu sysfs ipmi bacnet snmp gpfsmon tester
PLUGINS = procfs pdu sysfs ipmi bacnet snmp gpfsmon tester msr
ANALYZERS = average
ifeq ($(OS),Darwin)
......
......@@ -42,7 +42,7 @@ void MSRSensorGroup::start() {
return;
}
program_fixed()
program_fixed();
for (auto &kv : cpuToFd) {
int cpu = kv.first;
......@@ -69,13 +69,14 @@ void MSRSensorGroup::start() {
}
void MSRSensorGroup::stop() {
//close file descriptors and leave counters running freely
_keepRunning = 0;
//close file descriptors and leave counters running freely
for (auto &kv: cpuToFd) {
close(kv.second);
kv.second = -1;
}
LOG(info) << "Sensorgroup " << _groupName << " stopped.";
LOG(info) << "Sensorgroup " << _groupName << " stopped.";
}
void MSRSensorGroup::read() {
......@@ -163,11 +164,10 @@ void MSRSensorGroup::program_fixed(){
msr_write(IA32_CR_FIXED_CTR_CTRL, ctrl_reg.value, kv.first);
// start counting, enable 3 fixed counters (enable also the programmables counters)
uint64 value = (1ULL << 0) + (1ULL << 1) + (1ULL << 2) + (1ULL << 3) + (1ULL << 32) + (1ULL << 33) + (1ULL << 34);
uint64_t value = (1ULL << 0) + (1ULL << 1) + (1ULL << 2) + (1ULL << 3) + (1ULL << 32) + (1ULL << 33) + (1ULL << 34);
//uint64_t value = (1ULL << 32) + (1ULL << 33) + (1ULL << 34);
msr_write(IA32_CR_PERF_GLOBAL_CTRL, value, kv.first);
}
return true;
}
void MSRSensorGroup::addCpu(unsigned int cpu){
......
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