From f17876986388fda326e1e4525e28b7a8095acda5 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 13 Nov 2016 00:03:37 +0100 Subject: [PATCH] Do not wait for the progress mutex to read and store speed timer --- src/opencl.c | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/opencl.c b/src/opencl.c index 509448ea9..c08e8bf2a 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1925,45 +1925,20 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (rc == -1) return -1; - /** - * result - */ - - if (user_options->speed_only == false) - { - check_cracked (hashcat_ctx, device_param, salt_pos); - } - - /** - * progress - */ - - u64 perf_sum_all = (u64) pws_cnt * (u64) innerloop_left; - - hc_thread_mutex_lock (status_ctx->mux_counter); - - status_ctx->words_progress_done[salt_pos] += perf_sum_all; - - hc_thread_mutex_unlock (status_ctx->mux_counter); - /** * speed */ - double speed_msec = hc_timer_get (device_param->timer_speed); + const u64 perf_sum_all = (u64) pws_cnt * (u64) innerloop_left; + + const double speed_msec = hc_timer_get (device_param->timer_speed); hc_timer_set (&device_param->timer_speed); - // current speed - - //hc_thread_mutex_lock (status_ctx->mux_display); - device_param->speed_cnt[speed_pos] = perf_sum_all; device_param->speed_msec[speed_pos] = speed_msec; - //hc_thread_mutex_unlock (status_ctx->mux_display); - speed_pos++; if (speed_pos == SPEED_CACHE) @@ -1971,12 +1946,31 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co speed_pos = 0; } + /** + * progress + */ + + hc_thread_mutex_lock (status_ctx->mux_counter); + + status_ctx->words_progress_done[salt_pos] += perf_sum_all; + + hc_thread_mutex_unlock (status_ctx->mux_counter); + /** * benchmark */ if (user_options->speed_only == true) break; + /** + * result + */ + + if (user_options->speed_only == false) + { + check_cracked (hashcat_ctx, device_param, salt_pos); + } + if (status_ctx->run_thread_level2 == false) break; }