Send a notice to user in case the drivers temperature threshold for slowdown is reach...
[hashcat.git] / src / shared.c
index 6f17e88..0396e93 100644 (file)
@@ -3057,6 +3057,34 @@ int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list,
 }
 #endif // HAVE_ADL
 
+int hm_get_threshold_slowdown_with_device_id (const uint device_id)
+{
+  if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
+
+  #ifdef HAVE_ADL
+
+  #endif
+
+  #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)
+    int target = 0;
+
+    hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nv, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target);
+
+    return target;
+    #endif
+
+    #if defined(WIN) && defined(HAVE_NVAPI)
+
+    #endif // WIN && HAVE_NVAPI
+  }
+  #endif // HAVE_NVML || HAVE_NVAPI
+
+  return -1;
+}
+
 int hm_get_temperature_with_device_id (const uint device_id)
 {
   if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
@@ -3169,7 +3197,6 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
       #endif
 
       #if defined(WIN) && defined(HAVE_NVAPI)
-
       NV_GPU_COOLER_SETTINGS pCoolerSettings;
 
       pCoolerSettings.Version = GPU_COOLER_SETTINGS_VER | sizeof (NV_GPU_COOLER_SETTINGS);