1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Converted status_benchmark_automate()

This commit is contained in:
jsteube 2016-10-17 17:20:19 +02:00
parent 1d0810a759
commit 65b3910dc0
3 changed files with 33 additions and 50 deletions

View File

@ -58,6 +58,7 @@ u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx)
u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx);
double status_get_hashes_msec_all (const hashcat_ctx_t *hashcat_ctx);
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_hashes_msec_dev_benchmark (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx);
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx);

View File

@ -1127,6 +1127,33 @@ double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int d
return hashes_dev_msec;
}
double status_get_hashes_msec_dev_benchmark (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
// this function increases accuracy for benchmark modes
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
u64 speed_cnt = 0;
double speed_msec = 0;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped == false)
{
speed_cnt += device_param->speed_cnt[0];
speed_msec += device_param->speed_msec[0];
}
double hashes_dev_msec = 0;
if (speed_msec > 0)
{
hashes_dev_msec = (double) speed_cnt / speed_msec;
}
return hashes_dev_msec;
}
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;

View File

@ -785,59 +785,14 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
if (status_ctx->devices_status == STATUS_INIT)
const u32 hash_mode = hashconfig->hash_mode;
for (int device_id = 0; device_id < status_get_device_info_cnt (hashcat_ctx); device_id++)
{
event_log_error (hashcat_ctx, "status view is not available during initialization phase");
if (status_get_skipped_dev (hashcat_ctx, device_id) == true) continue;
return;
}
if (status_ctx->devices_status == STATUS_AUTOTUNE)
{
event_log_error (hashcat_ctx, "status view is not available during autotune phase");
return;
}
u64 speed_cnt[DEVICES_MAX] = { 0 };
double speed_msec[DEVICES_MAX] = { 0 };
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
speed_cnt[device_id] = device_param->speed_cnt[0];
speed_msec[device_id] = device_param->speed_msec[0];
}
u64 hashes_dev_msec[DEVICES_MAX] = { 0 };
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
hashes_dev_msec[device_id] = 0;
if (speed_msec[device_id] > 0)
{
hashes_dev_msec[device_id] = (double) speed_cnt[device_id] / speed_msec[device_id];
}
}
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
event_log_info (hashcat_ctx, "%u:%u:%" PRIu64 "", device_id + 1, hashconfig->hash_mode, (hashes_dev_msec[device_id] * 1000));
event_log_info (hashcat_ctx, "%u:%u:%" PRIu64, device_id + 1, hash_mode, (u64) (status_get_hashes_msec_dev_benchmark (hashcat_ctx, device_id) * 1000));
}
}