Move more status display calculate logic into separate functions

This commit is contained in:
jsteube
2016-10-17 13:44:07 +02:00
parent bb98a8c8e1
commit b044271b01
12 changed files with 797 additions and 513 deletions
+2
View File
@@ -6,6 +6,8 @@
#ifndef _MONITOR_H
#define _MONITOR_H
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx);
void *thread_monitor (void *p);
#endif // _MONITOR_H
+2 -2
View File
@@ -24,8 +24,8 @@ char *filename_from_filepath (char *filepath);
void naive_replace (char *s, const char key_char, const char replace_char);
void naive_escape (char *s, size_t s_max, const char key_char, const char escape_char);
void hc_sleep_ms (const u32 msec);
void hc_sleep (const u32 sec);
void hc_sleep_msec (const u32 msec);
void hc_sleep (const u32 sec);
void setup_environment_variables ();
void setup_umask ();
+48 -15
View File
@@ -12,23 +12,56 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
// should be static after refactoring
void format_timer_display (struct tm *tm, char *buf, size_t len);
void format_speed_display (double val, char *buf, size_t len);
int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_masks_pos (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_masks_cnt (const hashcat_ctx_t *hashcat_ctx);
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx);
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx);
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx);
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx);
int status_get_salts_cnt (const hashcat_ctx_t *hashcat_ctx);
double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx);
double status_get_msec_running (const hashcat_ctx_t *hashcat_ctx);
double status_get_msec_paused (const hashcat_ctx_t *hashcat_ctx);
char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx);
char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx);
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx);
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx);
int status_progress_init (hashcat_ctx_t *hashcat_ctx);
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);
void status_progress_reset (hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_ignore (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_skip (const hashcat_ctx_t *hashcat_ctx);
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);
int status_ctx_init (hashcat_ctx_t *hashcat_ctx);
void status_ctx_destroy (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 u32 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 u32 device_id);
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx);
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id);
int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx);
int status_progress_init (hashcat_ctx_t *hashcat_ctx);
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);
void status_progress_reset (hashcat_ctx_t *hashcat_ctx);
int status_ctx_init (hashcat_ctx_t *hashcat_ctx);
void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
#endif // _STATUS_H
+12 -6
View File
@@ -679,7 +679,7 @@ typedef struct hc_device_param
u32 innerloop_left;
u32 exec_pos;
double exec_ms[EXEC_CACHE];
double exec_msec[EXEC_CACHE];
// workaround cpu spinning
@@ -691,7 +691,7 @@ typedef struct hc_device_param
u32 speed_pos;
u64 speed_cnt[SPEED_CACHE];
double speed_ms[SPEED_CACHE];
double speed_msec[SPEED_CACHE];
hc_timer_t timer_speed;
@@ -818,7 +818,7 @@ typedef struct opencl_ctx
u32 devices_filter;
cl_device_type device_types_filter;
double target_ms;
double target_msec;
bool need_adl;
bool need_nvml;
@@ -1394,7 +1394,7 @@ typedef struct status_ctx
hc_timer_t timer_running; // timer on current dict
hc_timer_t timer_paused; // timer on current dict
double ms_paused; // timer on current dict
double msec_paused; // timer on current dict
} status_ctx_t;
@@ -1483,12 +1483,18 @@ typedef struct
{
char *status;
char *session;
char *time_started_absolute;
char *time_started_relative;
char *time_estimated_absolute;
char *time_estimated_relative;
char *hash_type;
char *hash_target;
int input_mode;
char *input_base;
char *input_mod;
char *input_charset;
char *hash_type;
char *hash_target;
device_info_t device_info_buf[DEVICES_MAX];
int device_info_cnt;