nvml: Use #ifdef HAVE_XNVCTRL to check if xnvctrl is available

This commit is contained in:
Bill Li 2023-05-05 17:21:33 +08:00 committed by flightlessmango
parent 3daf7d73b3
commit 2101090f00

View File

@ -51,9 +51,11 @@ void getNvidiaGpuInfo(const struct overlay_params& params){
gpu_info.is_power_throttled = (nvml_throttle_reasons & 0x000000000000008CLL) != 0; gpu_info.is_power_throttled = (nvml_throttle_reasons & 0x000000000000008CLL) != 0;
gpu_info.is_other_throttled = (nvml_throttle_reasons & 0x0000000000000112LL) != 0; gpu_info.is_other_throttled = (nvml_throttle_reasons & 0x0000000000000112LL) != 0;
} }
static bool nvctrl_available = checkXNVCtrl(); #ifdef HAVE_XNVCTRL
if (nvctrl_available) static bool nvctrl_available = checkXNVCtrl();
gpu_info.fan_speed = getNvctrlFanSpeed(); if (nvctrl_available)
gpu_info.fan_speed = getNvctrlFanSpeed();
#endif
return; return;
} }