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

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 {
}
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() {
_gpuFeatureMAP["GPU_CLK_GP"] = GPU_CLK_GP;
_gpuFeatureMAP["GPU_CLK_SM"] = GPU_CLK_SM;
_gpuFeatureMAP["GPU_CLK_MEM"] = GPU_CLK_MEM;
_gpuFeatureMAP["GPU_UTL_MEM"] = GPU_UTL_MEM;
_gpuFeatureMAP["GPU_UTL_GPU"] = GPU_UTL_GPU;
_groupName = "group";
_baseName = "sensor";
......
......@@ -48,6 +48,8 @@ enum GPU_FEATURE {
GPU_CLK_GP = 7,
GPU_CLK_SM = 8,
GPU_CLK_MEM = 9,
GPU_UTL_MEM = 10,
GPU_UTL_GPU = 11,
};
/**
......@@ -118,21 +120,27 @@ class nvmlSensorBase : public SensorBase {
case GPU_MEM_USED:
feature = "GPU_MEM_USED";
break;
case GPU_MEM_TOT:
feature = "GPU_MEM_TOT";
break;
case GPU_MEM_FREE:
feature = "GPU_MEM_FREE";
break;
case GPU_CLK_GP:
feature = "GPU_CLK_GP";
break;
case GPU_CLK_SM:
feature = "GPU_CLK_SM";
break;
case GPU_CLK_MEM:
feature = "GPU_CLK_MEM";
break;
case GPU_MEM_TOT:
feature = "GPU_MEM_TOT";
break;
case GPU_MEM_FREE:
feature = "GPU_MEM_FREE";
break;
case GPU_CLK_GP:
feature = "GPU_CLK_GP";
break;
case GPU_CLK_SM:
feature = "GPU_CLK_SM";
break;
case GPU_CLK_MEM:
feature = "GPU_CLK_MEM";
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;
}
......
......@@ -52,7 +52,7 @@ struct counters_t {
nvmlMemory_t memory;
unsigned int power;
// unsigned long long ecc_counts;
// nvmlUtilization_t utilization;
nvmlUtilization_t utilization;
} counters;
nvmlSensorGroup::nvmlSensorGroup(const std::string& name) :
......@@ -158,26 +158,35 @@ void nvmlSensorGroup::read() {
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.used;
break;
case(GPU_MEM_TOT):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.total;
break;
case(GPU_MEM_FREE):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.free;
break;
case(GPU_CLK_GP):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_GRAPHICS,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_graphics));
reading.value = counters.clockspeed_graphics;
break;
case(GPU_CLK_SM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_SM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_sm));
reading.value = counters.clockspeed_sm;
break;
case(GPU_CLK_MEM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_MEM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_mem));
reading.value = counters.clockspeed_mem;
break;
case(GPU_MEM_TOT):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.total;
break;
case(GPU_MEM_FREE):
err = nvmlDeviceGetMemoryInfo (env.device, &(counters.memory));
reading.value = counters.memory.free;
break;
case(GPU_CLK_GP):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_GRAPHICS,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_graphics));
reading.value = counters.clockspeed_graphics;
break;
case(GPU_CLK_SM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_SM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_sm));
reading.value = counters.clockspeed_sm;
break;
case(GPU_CLK_MEM):
err = nvmlDeviceGetClock (env.device, NVML_CLOCK_MEM,NVML_CLOCK_ID_CURRENT,&(counters.clockspeed_mem));
reading.value = counters.clockspeed_mem;
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);
#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