1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-23 06:01:06 +00:00

Improve automatic calculation of hook threads value

This commit is contained in:
Jens Steube 2019-11-16 11:48:25 +01:00
parent fe8c17f4c7
commit 53e96a12a0
2 changed files with 13 additions and 6 deletions

View File

@ -6252,6 +6252,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
return -1;
}
// now we can calculate the number of parallel running hook threads based on
// the number cpu cores and the number of active compute devices
// unless overwritten by the user
if (user_options->hook_threads == HOOK_THREADS)
{
const u32 processor_count = hc_get_processor_count ();
const u32 processor_count_cu = CEILDIV (processor_count, backend_ctx->backend_devices_active); // should never reach 0
user_options->hook_threads = processor_count_cu;
}
// additional check to see if the user has chosen a device that is not within the range of available devices (i.e. larger than devices_cnt)
if (backend_ctx->backend_devices_filter != (u64) -1)

View File

@ -1043,12 +1043,6 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
setup_umask ();
/**
* Find number of physical CPU cores
*/
user_options->hook_threads = hc_get_processor_count ();
/**
* tuning db
*/