From e97fa06a7a7b7fe901f0dd14d9c560749de242c5 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sat, 28 May 2016 16:32:45 +0200 Subject: [PATCH] Added current engine clock and current memory clock to the status display (ADL only atm) Automatically enable AMD powertune in benchmark-mode --- docs/changes.txt | 1 + include/shared.h | 2 ++ src/hashcat.c | 14 ++++++++++---- src/shared.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5ba9697..49ee6a0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -23,6 +23,7 @@ It combines all features of all hashcat projects in one project. - Added makefile native compilation target - Added makefile install and uninstall targets - Added autotuning engine and user-configurable tuning database +- Added current engine clock and current memory clock to the status display - Added execution timer of the running kernel to the status display - Added command prompt to quit at next restore checkpoint - Added human-readable error message for the OpenCL error codes diff --git a/include/shared.h b/include/shared.h index c8d6207..b1ddb29 100644 --- a/include/shared.h +++ b/include/shared.h @@ -1457,6 +1457,8 @@ int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_ 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_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); int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed); diff --git a/src/hashcat.c b/src/hashcat.c index 7d0af78..1141815 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1549,10 +1549,14 @@ void status_display () { char utilization[HM_STR_BUF_SIZE] = { 0 }; char temperature[HM_STR_BUF_SIZE] = { 0 }; - char fanspeed[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 *) 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) { @@ -1563,7 +1567,7 @@ void status_display () 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", device_id + 1, utilization, temperature, fanspeed); + log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan, %s Core, %s Memory", device_id + 1, utilization, temperature, fanspeed, corespeed, memoryspeed); } else { @@ -3841,6 +3845,7 @@ static void *thread_monitor (void *p) if (data.devices_status != STATUS_RUNNING) continue; + #ifdef HAVE_HWMON if (hwmon_check == 1) { @@ -6883,6 +6888,7 @@ int main (int argc, char **argv) potfile_disable = 1; weak_hash_threshold = 0; gpu_temp_disable = 1; + powertune_enable = 1; data.status_timer = status_timer; data.restore_timer = restore_timer; diff --git a/src/shared.c b/src/shared.c index 9c08856..4fb97de 100644 --- a/src/shared.c +++ b/src/shared.c @@ -3231,6 +3231,52 @@ int hm_get_utilization_with_device_id (const uint device_id) return -1; } +int hm_get_memoryspeed_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.iMemoryClock / 100; + } + } + #endif // HAVE_ADL + + return -1; +} + +int hm_get_corespeed_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.iEngineClock / 100; + } + } + #endif // HAVE_ADL + + return -1; +} + #ifdef HAVE_ADL int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed) { -- 2.25.1