02.04., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 58de956d authored by Weronika's avatar Weronika

added the temperature sensor

parent 81d7b58c
......@@ -35,6 +35,7 @@ nvmlConfigurator::nvmlConfigurator() {
_gpuFeatureMAP["GPU_ENERGY"] = GPU_ENERGY;
_gpuFeatureMAP["GPU_POWER"] = GPU_POWER;
_gpuFeatureMAP["GPU_TEMP"] = GPU_TEMP;
_groupName = "group";
_baseName = "sensor";
......@@ -44,7 +45,7 @@ nvmlConfigurator::~nvmlConfigurator() {}
void nvmlConfigurator::sensorBase(nvmlSensorBase& s, CFG_VAL config) {
//ADD {
*/
BOOST_FOREACH (boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "feature")) {
gpuFeatureMap_t::iterator it = _gpuFeatureMAP.find(val.second.data());
......
......@@ -40,6 +40,7 @@
enum GPU_FEATURE {
GPU_ENERGY = 0,
GPU_POWER = 1,
GPU_TEMP = 2,
};
/**
......@@ -101,6 +102,9 @@ class nvmlSensorBase : public SensorBase {
case GPU_POWER:
feature = "GPU_POWER";
break;
case GPU_TEMP:
feature = "GPU_TEMP";
break;
}
LOG_VAR(ll) << leading << " Feature type: " << feature;
}
......
......@@ -31,20 +31,13 @@
// Used to ensure we get a sensible value of energy by computing the difference
// between calls to the read function
static int isfirsttime=0;
// We need the energy values to be global too
//unsigned long long energy_initial;
//unsigned long long energy_current;
//unsigned long long energy_previous;
// FR defn of env was global in our test case
struct env_t {
nvmlDevice_t device;
} env;
// FR
struct counters_t {
// unsigned long long energy_start;
// unsigned long long energy_stop;
unsigned long long energy_initial;
unsigned long long energy_current;
unsigned long long energy_previous;
......@@ -52,38 +45,25 @@ struct counters_t {
// unsigned int freq2;
// unsigned int freq3;
unsigned int temperature;
unsigned int fanspeed;
// unsigned int fanspeed;
// unsigned int clockspeed_graphics;
// unsigned int clockspeed_sm;
// unsigned int clockspeed_mem;
nvmlMemory_t memory;
// nvmlMemory_t memory;
unsigned int power;
unsigned long long ecc_counts;
// unsigned long long ecc_counts;
// nvmlUtilization_t utilization;
} counters;
nvmlSensorGroup::nvmlSensorGroup(const std::string& name) :
SensorGroupTemplate(name) {
/*
* TODO
* Construct attributes
*/
}
nvmlSensorGroup::nvmlSensorGroup(const nvmlSensorGroup& other) :
SensorGroupTemplate(other) {
/*
* TODO
* Copy construct attributes
*/
}
nvmlSensorGroup::~nvmlSensorGroup() {
/*
* TODO
* Tear down attributes
*/
}
nvmlSensorGroup::~nvmlSensorGroup() {}
nvmlSensorGroup& nvmlSensorGroup::operator=(const nvmlSensorGroup& other) {
SensorGroupTemplate::operator=(other);
......@@ -166,11 +146,15 @@ void nvmlSensorGroup::read() {
err = nvmlDeviceGetPowerUsage(env.device,&(counters.power));
reading.value = counters.power;
break;
case(GPU_TEMP):
err = nvmlDeviceGetTemperature(env.device,NVML_TEMPERATURE_GPU,&(counters.temperature));
reading.value = counters.temperature;
break;
}
s->storeReading(reading);
#ifdef DEBUG
//ifdef DEBUG
LOG(debug) << _groupName << "::" << s->getName() << " raw reading: \"" << reading.value << "\"";
#endif
//endif
}
} catch (const std::exception& e) {
LOG(error) << "Sensorgroup" << _groupName << " could not read value: " << e.what();
......
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