Added status_get_hwmon_dev() to status.c

pull/544/head
jsteube 8 years ago
parent 2b28010aae
commit 1d0810a759

@ -69,6 +69,7 @@ double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx)
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_progress_init (hashcat_ctx_t *hashcat_ctx);
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);

@ -1487,6 +1487,7 @@ typedef struct
double exec_msec_dev;
char *speed_sec_dev;
char *input_candidates_dev;
char *hwmon_dev;
} device_info_t;

@ -1191,6 +1191,7 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
device_info->exec_msec_dev = status_get_exec_msec_dev (hashcat_ctx, device_id);
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);
}
hashcat_status->hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);

@ -1332,6 +1332,91 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx)
return cpt;
}
char *status_get_hwmon_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];
char *output_buf = (char *) malloc (HCBUFSIZ_TINY);
snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A");
if (device_param->skipped == true) return output_buf;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
hc_thread_mutex_lock (status_ctx->mux_hwmon);
const int num_temperature = hm_get_temperature_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_fanspeed = hm_get_fanspeed_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_utilization = hm_get_utilization_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_corespeed = hm_get_corespeed_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_memoryspeed = hm_get_memoryspeed_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_buslanes = hm_get_buslanes_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
const int num_throttle = hm_get_throttle_with_device_id ((hashcat_ctx_t *) hashcat_ctx, device_id);
int output_len = 0;
if (num_temperature >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Temp:%3uc ", num_temperature);
output_len = strlen (output_buf);
}
if (num_fanspeed >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Fan:%3u%% ", num_fanspeed);
output_len = strlen (output_buf);
}
if (num_utilization >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Util:%3u%% ", num_utilization);
output_len = strlen (output_buf);
}
if (num_corespeed >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Core:%4uMhz ", num_corespeed);
output_len = strlen (output_buf);
}
if (num_memoryspeed >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Mem:%4uMhz ", num_memoryspeed);
output_len = strlen (output_buf);
}
if (num_buslanes >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Lanes:%u ", num_buslanes);
output_len = strlen (output_buf);
}
if (num_throttle >= 0)
{
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "*Throttled* ");
output_len = strlen (output_buf);
}
if (output_len > 0)
{
output_buf[output_len - 1] = 0;
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
return output_buf;
}
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
{
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;

@ -611,7 +611,6 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
void status_display (hashcat_ctx_t *hashcat_ctx)
{
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
@ -767,90 +766,19 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
status_get_exec_msec_dev (hashcat_ctx, device_id));
}
if (status_get_device_info_active (hashcat_ctx) > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx));
if (status_get_device_info_active (hashcat_ctx) > 1)
{
event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx));
}
if (user_options->gpu_temp_disable == false)
{
hc_thread_mutex_lock (status_ctx->mux_hwmon);
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
for (int device_id = 0; device_id < status_get_device_info_cnt (hashcat_ctx); device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped) continue;
const int num_temperature = hm_get_temperature_with_device_id (hashcat_ctx, device_id);
const int num_fanspeed = hm_get_fanspeed_with_device_id (hashcat_ctx, device_id);
const int num_utilization = hm_get_utilization_with_device_id (hashcat_ctx, device_id);
const int num_corespeed = hm_get_corespeed_with_device_id (hashcat_ctx, device_id);
const int num_memoryspeed = hm_get_memoryspeed_with_device_id (hashcat_ctx, device_id);
const int num_buslanes = hm_get_buslanes_with_device_id (hashcat_ctx, device_id);
const int num_throttle = hm_get_throttle_with_device_id (hashcat_ctx, device_id);
char output_buf[256] = { 0 };
int output_len = 0;
if (num_temperature >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Temp:%3uc", num_temperature);
output_len = strlen (output_buf);
}
if (num_fanspeed >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Fan:%3u%%", num_fanspeed);
if (status_get_skipped_dev (hashcat_ctx, device_id) == true) continue;
output_len = strlen (output_buf);
}
if (num_utilization >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Util:%3u%%", num_utilization);
output_len = strlen (output_buf);
}
if (num_corespeed >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Core:%4uMhz", num_corespeed);
output_len = strlen (output_buf);
}
if (num_memoryspeed >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Mem:%4uMhz", num_memoryspeed);
output_len = strlen (output_buf);
}
if (num_buslanes >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " Lanes:%u", num_buslanes);
output_len = strlen (output_buf);
}
if (num_throttle >= 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " *Throttled*");
output_len = strlen (output_buf);
}
if (output_len == 0)
{
snprintf (output_buf + output_len, sizeof (output_buf) - output_len, " N/A");
output_len = strlen (output_buf);
}
event_log_info (hashcat_ctx, "HWMon.Dev.#%d...:%s", device_id + 1, output_buf);
event_log_info (hashcat_ctx, "HWMon.Dev.#%d...: %s", device_id + 1, status_get_hwmon_dev (hashcat_ctx, device_id));
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
}
}

Loading…
Cancel
Save