NVML_ERROR_UNKNOWN = 999 // An internal driver error occurred
} nvmlReturn_t;
+typedef enum nvmlClockType_enum {
+ NVML_CLOCK_GRAPHICS = 0,
+ NVML_CLOCK_SM = 1,
+ NVML_CLOCK_MEM = 2
+} nvmlClockType_t;
+
/*
* End of declarations from nvml.h
**/
typedef nvmlReturn_t (*NVML_DEVICE_GET_FAN_SPEED) (nvmlDevice_t, unsigned int *);
typedef nvmlReturn_t (*NVML_DEVICE_GET_POWER_USAGE) (nvmlDevice_t, unsigned int *);
typedef nvmlReturn_t (*NVML_DEVICE_GET_UTILIZATION_RATES) (nvmlDevice_t, nvmlUtilization_t *);
+typedef nvmlReturn_t (*NVML_DEVICE_GET_CLOCKINFO) (nvmlDevice_t, nvmlClockType_t, unsigned int *);
typedef struct
{
NVML_DEVICE_GET_FAN_SPEED nvmlDeviceGetFanSpeed;
NVML_DEVICE_GET_POWER_USAGE nvmlDeviceGetPowerUsage;
NVML_DEVICE_GET_UTILIZATION_RATES nvmlDeviceGetUtilizationRates;
+ NVML_DEVICE_GET_CLOCKINFO nvmlDeviceGetClockInfo;
} hm_nvml_lib_t;
nvmlReturn_t hm_NVML_nvmlDeviceGetFanSpeed (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *speed);
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerUsage (NVML_PTR *nvml, nvmlDevice_t device, unsigned int *power);
nvmlReturn_t hm_NVML_nvmlDeviceGetUtilizationRates (NVML_PTR *nvml, nvmlDevice_t device, nvmlUtilization_t *utilization);
+nvmlReturn_t hm_NVML_nvmlDeviceGetClockInfo (NVML_PTR *nvml, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock);
#endif // HAVE_HWMON && HAVE_NVML
HC_LOAD_FUNC(nvml, nvmlDeviceGetFanSpeed, NVML_DEVICE_GET_FAN_SPEED, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetPowerUsage, NVML_DEVICE_GET_POWER_USAGE, NVML, 0)
HC_LOAD_FUNC(nvml, nvmlDeviceGetUtilizationRates, NVML_DEVICE_GET_UTILIZATION_RATES, NVML, 0)
+ HC_LOAD_FUNC(nvml, nvmlDeviceGetClockInfo, NVML_DEVICE_GET_CLOCKINFO, NVML, 0)
return 0;
}
return nvml_rc;
}
+
+nvmlReturn_t hm_NVML_nvmlDeviceGetClockInfo (NVML_PTR *nvml, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock)
+{
+ if (!nvml) return -1;
+
+ nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clock);
+
+ if (nvml_rc != NVML_SUCCESS)
+ {
+ *clock = -1;
+
+ //const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
+
+ //log_info ("WARN: %s %d %s\n", "nvmlDeviceGetUtilizationRates()", nvml_rc, string);
+ }
+
+ return nvml_rc;
+}
+
}
#endif // HAVE_ADL
+ #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
+ {
+ #if defined(LINUX) && defined(HAVE_NVML)
+ unsigned int clock;
+
+ hm_NVML_nvmlDeviceGetClockInfo (data.hm_nv, data.hm_device[device_id].adapter_index.nv, NVML_CLOCK_MEM, &clock);
+
+ return clock;
+ #endif
+
+ #if defined(WIN) && defined(HAVE_NVAPI)
+
+ #endif
+ }
+ #endif // HAVE_NVML || HAVE_NVAPI
+
return -1;
}
}
#endif // HAVE_ADL
+ #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
+ {
+ #if defined(LINUX) && defined(HAVE_NVML)
+ unsigned int clock;
+
+ hm_NVML_nvmlDeviceGetClockInfo (data.hm_nv, data.hm_device[device_id].adapter_index.nv, NVML_CLOCK_SM, &clock);
+
+ return clock;
+ #endif
+
+ #if defined(WIN) && defined(HAVE_NVAPI)
+
+ #endif
+ }
+ #endif // HAVE_NVML || HAVE_NVAPI
+
return -1;
}