Add PCI-E Lanes to status display, if available
authorJens Steube <jens.steube@gmail.com>
Sun, 29 May 2016 13:54:51 +0000 (15:54 +0200)
committerJens Steube <jens.steube@gmail.com>
Sun, 29 May 2016 13:54:51 +0000 (15:54 +0200)
include/shared.h
src/hashcat.c
src/shared.c

index 2724587..03316e8 100644 (file)
@@ -1457,6 +1457,8 @@ int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_
 int hm_get_threshold_slowdown_with_device_id (const uint device_id);
 int hm_get_temperature_with_device_id        (const uint device_id);
 int hm_get_fanspeed_with_device_id           (const uint device_id);
+int hm_get_maxbuslanes_with_device_id        (const uint device_id);
+int hm_get_currentbuslanes_with_device_id    (const uint device_id);
 int hm_get_utilization_with_device_id        (const uint device_id);
 int hm_get_memoryspeed_with_device_id        (const uint device_id);
 int hm_get_corespeed_with_device_id          (const uint device_id);
index 9a60017..42e8e5c 100644 (file)
@@ -1545,40 +1545,23 @@ void status_display ()
 
       #define HM_STR_BUF_SIZE 255
 
-      if (data.hm_device[device_id].fan_supported == 1)
-      {
-        char utilization[HM_STR_BUF_SIZE] = { 0 };
-        char temperature[HM_STR_BUF_SIZE] = { 0 };
-        char fanspeed[HM_STR_BUF_SIZE]    = { 0 };
-        char corespeed[HM_STR_BUF_SIZE]   = { 0 };
-        char memoryspeed[HM_STR_BUF_SIZE] = { 0 };
-
-        hm_device_val_to_str ((char *) utilization, HM_STR_BUF_SIZE,   "%", hm_get_utilization_with_device_id (device_id));
-        hm_device_val_to_str ((char *) temperature, HM_STR_BUF_SIZE,   "c", hm_get_temperature_with_device_id (device_id));
-        hm_device_val_to_str ((char *) corespeed,   HM_STR_BUF_SIZE, "Mhz", hm_get_corespeed_with_device_id   (device_id));
-        hm_device_val_to_str ((char *) memoryspeed, HM_STR_BUF_SIZE, "Mhz", hm_get_memoryspeed_with_device_id (device_id));
-
-        if (device_param->device_vendor_id == VENDOR_ID_AMD)
-        {
-          hm_device_val_to_str ((char *) fanspeed, HM_STR_BUF_SIZE, "%", hm_get_fanspeed_with_device_id (device_id));
-        }
-        else if (device_param->device_vendor_id == VENDOR_ID_NV)
-        {
-          hm_device_val_to_str ((char *) fanspeed, HM_STR_BUF_SIZE, "%", hm_get_fanspeed_with_device_id (device_id));
-        }
-
-        log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan, %s Core, %s Mem", device_id + 1, utilization, temperature, fanspeed, corespeed, memoryspeed);
-      }
-      else
-      {
-        char utilization[HM_STR_BUF_SIZE] = { 0 };
-        char temperature[HM_STR_BUF_SIZE] = { 0 };
-
-        hm_device_val_to_str ((char *) utilization, HM_STR_BUF_SIZE, "%", hm_get_utilization_with_device_id (device_id));
-        hm_device_val_to_str ((char *) temperature, HM_STR_BUF_SIZE, "c", hm_get_temperature_with_device_id (device_id));
-
-        log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id + 1, utilization, temperature);
-      }
+      char utilization[HM_STR_BUF_SIZE]     = { 0 };
+      char temperature[HM_STR_BUF_SIZE]     = { 0 };
+      char fanspeed[HM_STR_BUF_SIZE]        = { 0 };
+      char corespeed[HM_STR_BUF_SIZE]       = { 0 };
+      char memoryspeed[HM_STR_BUF_SIZE]     = { 0 };
+      char currentbuslanes[HM_STR_BUF_SIZE] = { 0 };
+      char maxbuslanes[HM_STR_BUF_SIZE]     = { 0 };
+
+      hm_device_val_to_str ((char *) utilization,     HM_STR_BUF_SIZE,   "%", hm_get_utilization_with_device_id     (device_id));
+      hm_device_val_to_str ((char *) temperature,     HM_STR_BUF_SIZE,   "c", hm_get_temperature_with_device_id     (device_id));
+      hm_device_val_to_str ((char *) fanspeed,        HM_STR_BUF_SIZE,   "%", hm_get_fanspeed_with_device_id        (device_id));
+      hm_device_val_to_str ((char *) corespeed,       HM_STR_BUF_SIZE, "Mhz", hm_get_corespeed_with_device_id       (device_id));
+      hm_device_val_to_str ((char *) memoryspeed,     HM_STR_BUF_SIZE, "Mhz", hm_get_memoryspeed_with_device_id     (device_id));
+      hm_device_val_to_str ((char *) currentbuslanes, HM_STR_BUF_SIZE,    "", hm_get_currentbuslanes_with_device_id (device_id));
+      hm_device_val_to_str ((char *) maxbuslanes,     HM_STR_BUF_SIZE,    "", hm_get_maxbuslanes_with_device_id     (device_id));
+
+      log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan, %s Core, %s Mem, %s/%s Lanes", device_id + 1, utilization, temperature, fanspeed, corespeed, memoryspeed, currentbuslanes, maxbuslanes);
     }
 
     hc_thread_mutex_unlock (mux_adl);
index e50db80..905d81f 100644 (file)
@@ -3232,6 +3232,78 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
   return -1;
 }
 
+int hm_get_maxbuslanes_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
+  if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
+  {
+    if (data.hm_amd)
+    {
+      ADLPMActivity PMActivity;
+
+      PMActivity.iSize = sizeof (ADLPMActivity);
+
+      if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
+
+      return PMActivity.iMaximumBusLanes;
+    }
+  }
+  #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)
+
+    #endif
+
+    #if defined(WIN) && defined(HAVE_NVAPI)
+
+    #endif
+  }
+  #endif // HAVE_NVML || HAVE_NVAPI
+
+  return -1;
+}
+
+int hm_get_currentbuslanes_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
+  if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
+  {
+    if (data.hm_amd)
+    {
+      ADLPMActivity PMActivity;
+
+      PMActivity.iSize = sizeof (ADLPMActivity);
+
+      if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
+
+      return PMActivity.iCurrentBusLanes;
+    }
+  }
+  #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)
+
+    #endif
+
+    #if defined(WIN) && defined(HAVE_NVAPI)
+
+    #endif
+  }
+  #endif // HAVE_NVML || HAVE_NVAPI
+
+  return -1;
+}
+
 int hm_get_utilization_with_device_id (const uint device_id)
 {
   if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;