Skip to content

Commit 3c8cc1f

Browse files
authored
Merge pull request hashcat#3942 from PenguinKeeper7/low-performance-warning
Performance warning adjustments
2 parents d87ea67 + f2f2456 commit 3c8cc1f

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/monitor.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
5656
bool restore_check = false;
5757
bool hwmon_check = false;
5858
bool performance_check = false;
59+
bool performance_warned = false;
5960

6061
const int sleep_time = 1;
61-
const double exec_low = 50.0; // in ms
62+
const double exec_low = 25.0; // in ms
6263
const double util_low = 90.0; // in percent
6364

6465
if (user_options->runtime)
@@ -249,7 +250,7 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
249250
}
250251
}
251252

252-
if (performance_check == true)
253+
if (performance_check == true && status_ctx->devices_status == STATUS_RUNNING && performance_warned == false)
253254
{
254255
int exec_cnt = 0;
255256
int util_cnt = 0;
@@ -289,18 +290,22 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
289290
if (exec_cnt > 0) exec_avg = exec_total / exec_cnt;
290291
if (util_cnt > 0) util_avg = util_total / util_cnt;
291292

292-
if ((exec_avg > 0) && (exec_avg < exec_low))
293+
if (((exec_avg > 0) && (exec_avg < exec_low)) || ((util_avg > 0) && (util_avg < util_low)))
293294
{
294295
performance_warnings++;
295-
296-
if (performance_warnings == 10) EVENT_DATA (EVENT_MONITOR_PERFORMANCE_HINT, NULL, 0);
297296
}
298-
299-
if ((util_avg > 0) && (util_avg < util_low))
297+
else
300298
{
301-
performance_warnings++;
299+
if (performance_warnings > 0)
300+
{
301+
performance_warnings--;
302+
}
303+
}
302304

303-
if (performance_warnings == 10) EVENT_DATA (EVENT_MONITOR_PERFORMANCE_HINT, NULL, 0);
305+
if (performance_warnings == 10)
306+
{
307+
performance_warned = true;
308+
EVENT_DATA (EVENT_MONITOR_PERFORMANCE_HINT, NULL, 0);
304309
}
305310
}
306311

0 commit comments

Comments
 (0)