Commit d6370083 authored by Weronika's avatar Weronika

added the untilisation sensors to the nvml plugin

parent 925799e1
...@@ -77,3 +77,24 @@ group nvml_clock { ...@@ -77,3 +77,24 @@ group nvml_clock {
} }
group nvml_utilisation {
default def1
sensor gpu_utl_memory {
mqttsuffix /util_mem
feature GPU_UTL_MEM
}
sensor gpu_utl_gpu {
mqttsuffix /util_gpu
feature GPU_UTL_GPU
}
}
...@@ -43,6 +43,8 @@ nvmlConfigurator::nvmlConfigurator() { ...@@ -43,6 +43,8 @@ nvmlConfigurator::nvmlConfigurator() {
_gpuFeatureMAP["GPU_CLK_GP"] = GPU_CLK_GP; _gpuFeatureMAP["GPU_CLK_GP"] = GPU_CLK_GP;
_gpuFeatureMAP["GPU_CLK_SM"] = GPU_CLK_SM; _gpuFeatureMAP["GPU_CLK_SM"] = GPU_CLK_SM;
_gpuFeatureMAP["GPU_CLK_MEM"] = GPU_CLK_MEM; _gpuFeatureMAP["GPU_CLK_MEM"] = GPU_CLK_MEM;
_gpuFeatureMAP["GPU_UTL_MEM"] = GPU_UTL_MEM;
_gpuFeatureMAP["GPU_UTL_GPU"] = GPU_UTL_GPU;
_groupName = "group"; _groupName = "group";
_baseName = "sensor"; _baseName = "sensor";
......
...@@ -48,6 +48,8 @@ enum GPU_FEATURE { ...@@ -48,6 +48,8 @@ enum GPU_FEATURE {
GPU_CLK_GP = 7, GPU_CLK_GP = 7,
GPU_CLK_SM = 8, GPU_CLK_SM = 8,
GPU_CLK_MEM = 9, GPU_CLK_MEM = 9,
GPU_UTL_MEM = 10,
GPU_UTL_GPU = 11,
}; };
/** /**
...@@ -118,21 +120,27 @@ class nvmlSensorBase : public SensorBase { ...@@ -118,21 +120,27 @@ class nvmlSensorBase : public SensorBase {
case GPU_MEM_USED: case GPU_MEM_USED:
feature = "GPU_MEM_USED"; feature = "GPU_MEM_USED";
break; break;
case GPU_MEM_TOT: case GPU_MEM_TOT:
feature = "GPU_MEM_TOT"; feature = "GPU_MEM_TOT";
break; break;
case GPU_MEM_FREE: case GPU_MEM_FREE:
feature = "GPU_MEM_FREE"; feature = "GPU_MEM_FREE";
break; break;
case GPU_CLK_GP: case GPU_CLK_GP:
feature = "GPU_CLK_GP"; feature = "GPU_CLK_GP";
break; break;
case GPU_CLK_SM: case GPU_CLK_SM:
feature = "GPU_CLK_SM"; feature = "GPU_CLK_SM";
break; break;
case GPU_CLK_MEM: case GPU_CLK_MEM:
feature = "GPU_CLK_MEM"; feature = "GPU_CLK_MEM";
break; break;
case GPU_UTL_MEM:
feature = "GPU_UTL_MEM";
break;
case GPU_UTL_GPU:
feature = "GPU_UTL_GPU";
break;
} }
LOG_VAR(ll) << leading << " Feature type: " << feature; LOG_VAR(ll) << leading << " Feature type: " << feature;
} }
......
...@@ -52,7 +52,7 @@ struct counters_t { ...@@ -52,7 +52,7 @@ struct counters_t {
nvmlMemory_t memory; nvmlMemory_t memory;
unsigned int power; unsigned int power;
// unsigned long long ecc_counts; // unsigned long long ecc_counts;
// nvmlUtilization_t utilization; nvmlUtilization_t utilization;
} counters; } counters;
nvmlSensorGroup::nvmlSensorGroup(const std::string& name) : nvmlSensorGroup::nvmlSensorGroup(const std::string& name) :
...@@ -158,26 +158,35 @@ void nvmlSensorGroup::read() { ...@@ -158,26 +158,35 @@ void nvmlSensorGroup::read() {
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory)); err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.used; reading.value = counters.memory.used;
break; break;
case(GPU_MEM_TOT): case(GPU_MEM_TOT):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory)); err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.total; reading.value = counters.memory.total;
break; break;
case(GPU_MEM_FREE): case(GPU_MEM_FREE):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory)); err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.free; reading.value = counters.memory.free;
break; break;
case(GPU_CLK_GP): case(GPU_CLK_GP):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_GRAPHICS,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_graphics)); err = nvmlDeviceGetClock (env.device, NVML_CLOCK_GRAPHICS,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_graphics));
reading.value = counters.clockspeed_graphics; reading.value = counters.clockspeed_graphics;
break; break;
case(GPU_CLK_SM): case(GPU_CLK_SM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_SM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_sm)); err = nvmlDeviceGetClock (env.device, NVML_CLOCK_SM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_sm));
reading.value = counters.clockspeed_sm; reading.value = counters.clockspeed_sm;
break; break;
case(GPU_CLK_MEM): case(GPU_CLK_MEM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_MEM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_mem)); err = nvmlDeviceGetClock (env.device, NVML_CLOCK_MEM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_mem));
reading.value = counters.clockspeed_mem; reading.value = counters.clockspeed_mem;
break; break;
case(GPU_UTL_MEM):
err = nvmlDeviceGetUtilizationRates (env.device, &(counters.utilization));
reading.value = counters.utilization.memory;
break;
case(GPU_UTL_GPU):
err = nvmlDeviceGetUtilizationRates (env.device, &(counters.utilization));
reading.value = counters.utilization.gpu;
break;
} }
s->storeReading(reading); s->storeReading(reading);
#ifdef DEBUG #ifdef DEBUG
......
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