From 1edc129f8a1f4ec7f17068aa0c53fa492e6d557a Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 10 Nov 2016 17:50:29 +0100 Subject: [PATCH] Added core-clock and memory-clock to output in benchmark mode with --machine-readable enabled --- docs/changes.txt | 1 + include/status.h | 2 ++ include/types.h | 2 ++ src/hashcat.c | 2 ++ src/status.c | 38 ++++++++++++++++++++++++++++++++++++++ src/terminal.c | 2 +- src/user_options.c | 35 +++++++++++++++++++++-------------- 7 files changed, 67 insertions(+), 15 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 196ecc659..e457064c7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -20,6 +20,7 @@ - Added support for --powertune-enable for AMD-GPU-PRO driver - Added option --keep-guessing to continue cracking hashes even after they have been cracked (to find collisions) - Fixed a bug when cracking a large salted hashlist: If a word is rejected this produces so high CPU load that cracking process doesn't start +- Added core-clock and memory-clock to output in benchmark mode with --machine-readable enabled ## ## Algorithms diff --git a/include/status.h b/include/status.h index 2f012bc95..6c8d34710 100644 --- a/include/status.h +++ b/include/status.h @@ -73,6 +73,8 @@ double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx) double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx); char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx); char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); +int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); +int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); int status_progress_init (hashcat_ctx_t *hashcat_ctx); void status_progress_destroy (hashcat_ctx_t *hashcat_ctx); diff --git a/include/types.h b/include/types.h index 39abd68b5..32e4b8e90 100644 --- a/include/types.h +++ b/include/types.h @@ -1565,6 +1565,8 @@ typedef struct char *speed_sec_dev; char *input_candidates_dev; char *hwmon_dev; + int corespeed_dev; + int memoryspeed_dev; } device_info_t; diff --git a/src/hashcat.c b/src/hashcat.c index 4d11620d8..59b6f3b92 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1244,6 +1244,8 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st device_info->speed_sec_dev = status_get_speed_sec_dev (hashcat_ctx, device_id); device_info->input_candidates_dev = status_get_input_candidates_dev (hashcat_ctx, device_id); device_info->hwmon_dev = status_get_hwmon_dev (hashcat_ctx, device_id); + device_info->corespeed_dev = status_get_corespeed_dev (hashcat_ctx, device_id); + device_info->memoryspeed_dev = status_get_memoryspeed_dev (hashcat_ctx, device_id); } hashcat_status->hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx); diff --git a/src/status.c b/src/status.c index 6ed694bee..b2457dd20 100644 --- a/src/status.c +++ b/src/status.c @@ -1503,6 +1503,44 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i return output_buf; } +int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id) +{ + const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; + + hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; + + if (device_param->skipped == true) return -1; + + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + + hc_thread_mutex_lock (status_ctx->mux_hwmon); + + const int num_corespeed = hm_get_corespeed_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id); + + hc_thread_mutex_unlock (status_ctx->mux_hwmon); + + return num_corespeed; +} + +int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id) +{ + const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; + + hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; + + if (device_param->skipped == true) return -1; + + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + + hc_thread_mutex_lock (status_ctx->mux_hwmon); + + const int num_memoryspeed = hm_get_memoryspeed_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id); + + hc_thread_mutex_unlock (status_ctx->mux_hwmon); + + return num_memoryspeed; +} + int status_progress_init (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; diff --git a/src/terminal.c b/src/terminal.c index a7eb555b1..f90d950aa 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1008,7 +1008,7 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx) if (device_info->skipped_dev == true) continue; - event_log_info (hashcat_ctx, "%u:%u:%" PRIu64, device_id + 1, hash_mode, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); + event_log_info (hashcat_ctx, "%u:%u:%d:%d:%" PRIu64, device_id + 1, hash_mode, device_info->corespeed_dev, device_info->memoryspeed_dev, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); } hcfree (hashcat_status); diff --git a/src/user_options.c b/src/user_options.c index 80a60544d..b3b2e455a 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -922,42 +922,49 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) if (user_options->opencl_info == true || user_options->keyspace == true - || user_options->benchmark == true || user_options->stdout_flag == true || user_options->speed_only == true) { - user_options->show = false; - user_options->left = false; user_options->gpu_temp_disable = true; + user_options->left = false; + user_options->logfile_disable = true; + user_options->nvidia_spin_damp = 0; + user_options->outfile_check_timer = 0; user_options->potfile_disable = true; user_options->powertune_enable = false; - user_options->restore = false; user_options->restore_disable = true; + user_options->restore = false; user_options->restore_timer = 0; - user_options->logfile_disable = true; - user_options->weak_hash_threshold = 0; - user_options->nvidia_spin_damp = 0; + user_options->show = false; user_options->status = false; user_options->status_timer = 0; - user_options->outfile_check_timer = 0; + user_options->weak_hash_threshold = 0; } if (user_options->benchmark == true) { - user_options->session = "benchmark"; user_options->attack_mode = ATTACK_MODE_BF; + user_options->gpu_temp_disable = false; user_options->increment = false; + user_options->left = false; + user_options->logfile_disable = true; + user_options->nvidia_spin_damp = 0; + user_options->potfile_disable = true; + user_options->powertune_enable = true; + user_options->restore_disable = true; + user_options->restore = false; + user_options->restore_timer = 0; + user_options->session = "benchmark"; + user_options->show = false; + user_options->status = false; + user_options->status_timer = 0; user_options->speed_only = true; + user_options->weak_hash_threshold = 0; if (user_options->workload_profile_chgd == false) { user_options->workload_profile = 3; } - - if (user_options->powertune_enable == true) - { - user_options->gpu_temp_disable = false; - } } if (user_options->keyspace == true)