mirror of
https://github.com/hashcat/hashcat.git
synced 2025-05-18 14:58:49 +00:00
Simplify status_get_hwmon_dev() a bit
This commit is contained in:
parent
c419bd0441
commit
9e1574a97b
34
src/status.c
34
src/status.c
@ -1596,58 +1596,48 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i
|
|||||||
|
|
||||||
if (num_temperature >= 0)
|
if (num_temperature >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Temp:%3dc ", num_temperature);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Temp:%3dc ", num_temperature);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_fanspeed >= 0)
|
if (num_fanspeed >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Fan:%3d%% ", num_fanspeed);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Fan:%3d%% ", num_fanspeed);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_utilization >= 0)
|
if (num_utilization >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Util:%3d%% ", num_utilization);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Util:%3d%% ", num_utilization);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_corespeed >= 0)
|
if (num_corespeed >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Core:%4dMhz ", num_corespeed);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Core:%4dMhz ", num_corespeed);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_memoryspeed >= 0)
|
if (num_memoryspeed >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Mem:%4dMhz ", num_memoryspeed);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Mem:%4dMhz ", num_memoryspeed);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_buslanes >= 0)
|
if (num_buslanes >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Lanes:%d ", num_buslanes);
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Lanes:%d ", num_buslanes);
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_throttle >= 0)
|
if (num_throttle >= 0)
|
||||||
{
|
{
|
||||||
snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "*Throttled* ");
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "*Throttled* ");
|
||||||
|
|
||||||
output_len = strlen (output_buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output_len > 0)
|
if (output_len > 0)
|
||||||
{
|
{
|
||||||
output_buf[output_len - 1] = 0;
|
// trims the trailing space
|
||||||
|
|
||||||
|
output_len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output_buf[output_len] = 0;
|
||||||
|
|
||||||
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
||||||
|
|
||||||
return output_buf;
|
return output_buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user