From: Eero Tamminen Date: Mon, 14 Feb 2022 17:23:52 +0000 (+0200) Subject: gpu_sysman: Add memory "health" label if memory health is known X-Git-Tag: 6.0.0-rc0~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22aad76dbe5f13bbf71722b9d744b330dae894f6;p=thirdparty%2Fcollectd.git gpu_sysman: Add memory "health" label if memory health is known Already in L0 spec v1.0. Included only to memory usage metrics which are already querying memory state (unlike memory BW metrics). --- diff --git a/src/gpu_sysman.c b/src/gpu_sysman.c index 1f87bbfee..af4f9790e 100644 --- a/src/gpu_sysman.c +++ b/src/gpu_sysman.c @@ -1025,6 +1025,28 @@ static bool gpu_mems(gpu_device_t *gpu, unsigned int cache_idx) { ok = false; break; } + /* get health status from last i.e. zeroeth sample */ + zes_mem_health_t value = gpu->memory[0][i].health; + if (value != ZES_MEM_HEALTH_UNKNOWN) { + const char *health; + switch (value) { + case ZES_MEM_HEALTH_OK: + health = "ok"; + break; + case ZES_MEM_HEALTH_DEGRADED: + health = "degraded"; + break; + case ZES_MEM_HEALTH_CRITICAL: + health = "critical"; + break; + case ZES_MEM_HEALTH_REPLACE: + health = "replace"; + break; + default: + health = "unknown"; + } + metric_label_set(&metric, "health", health); + } double mem_used; if (config.samples < 2) { const uint64_t mem_free = gpu->memory[0][i].free;