From: Eero Tamminen Date: Fri, 9 Sep 2022 15:51:59 +0000 (+0300) Subject: gpu_sysman: Warn if enabled metric has no enabled output variant X-Git-Tag: 6.0.0-rc0~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=300bb512c1250b7e99e19c35eebd3382f167b392;p=thirdparty%2Fcollectd.git gpu_sysman: Warn if enabled metric has no enabled output variant Signed-off-by: Eero Tamminen --- diff --git a/src/gpu_sysman.c b/src/gpu_sysman.c index 5f7744514..c0f41ee37 100644 --- a/src/gpu_sysman.c +++ b/src/gpu_sysman.c @@ -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 "