]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
gpu_sysman: Warn if enabled metric has no enabled output variant
authorEero Tamminen <eero.t.tamminen@intel.com>
Fri, 9 Sep 2022 15:51:59 +0000 (18:51 +0300)
committerMatthias Runge <mrunge@matthias-runge.de>
Tue, 8 Nov 2022 12:24:36 +0000 (13:24 +0100)
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/gpu_sysman.c

index 5f7744514cdb3ad406b5ab5113e5ab32ecf817a5..c0f41ee37dc5520940a73ee4dbae1117a289ac25 100644 (file)
@@ -1380,6 +1380,11 @@ static bool gpu_freqs_throttle(gpu_device_t *gpu) {
     gpu->throttle = scalloc(freq_count, sizeof(*gpu->throttle));
     gpu->throttle_count = freq_count;
   }
+  if (!(config.output & (OUTPUT_COUNTER | OUTPUT_RATIO))) {
+    ERROR(PLUGIN_NAME ": no throttle-time output variants selected");
+    free(freqs);
+    return false;
+  }
 
   metric_family_t fam_ratio = {
       .help =
@@ -1555,6 +1560,11 @@ static bool gpu_powers(gpu_device_t *gpu) {
     gpu->power = scalloc(power_count, sizeof(*gpu->power));
     gpu->power_count = power_count;
   }
+  if (!(config.output & (OUTPUT_COUNTER | OUTPUT_RATE))) {
+    ERROR(PLUGIN_NAME ": no power output variants selected");
+    free(powers);
+    return false;
+  }
 
   metric_family_t fam_power = {
       .help = "Average power usage (in Watts) over query interval",
@@ -1639,6 +1649,11 @@ static bool gpu_engines(gpu_device_t *gpu) {
     gpu->engine = scalloc(engine_count, sizeof(*gpu->engine));
     gpu->engine_count = engine_count;
   }
+  if (!(config.output & (OUTPUT_COUNTER | OUTPUT_RATIO))) {
+    ERROR(PLUGIN_NAME ": no engine output variants selected");
+    free(engines);
+    return false;
+  }
 
   metric_family_t fam_ratio = {
       .help = "Average GPU engine / group utilization ratio (0-1) over query "