* status
*/
-#define STATUS_STARTING 0
-#define STATUS_INIT 1
-#define STATUS_RUNNING 2
-#define STATUS_PAUSED 3
-#define STATUS_EXHAUSTED 4
-#define STATUS_CRACKED 5
-#define STATUS_ABORTED 6
-#define STATUS_QUIT 7
-#define STATUS_BYPASS 8
+#define STATUS_STARTING 0
+#define STATUS_INIT 1
+#define STATUS_RUNNING 2
+#define STATUS_PAUSED 3
+#define STATUS_EXHAUSTED 4
+#define STATUS_CRACKED 5
+#define STATUS_ABORTED 6
+#define STATUS_QUIT 7
+#define STATUS_BYPASS 8
+#define STATUS_STOP_AT_CHECKPOINT 9
#define ST_0000 "Initializing"
#define ST_0001 "Starting"
#define ST_0006 "Aborted"
#define ST_0007 "Quit"
#define ST_0008 "Bypass"
+#define ST_0009 "Running (stop at checkpoint)"
/**
* kernel types
void read_restore (const char *eff_restore_file, restore_data_t *rd);
void write_restore (const char *new_restore_file, restore_data_t *rd);
void cycle_restore ();
+void check_checkpoint ();
#ifdef WIN
hc_global_data_t data;
-const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [q]uit => ";
+const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint stop [q]uit => ";
const char *USAGE_MINI[] =
{
if (data.restore_disable == 0)
{
- log_info ("Restore point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
+ log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
}
}
else
//if (data.restore_disable == 0)
//{
- // log_info ("Restore point..: %llu", (unsigned long long int) restore_point);
+ // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
//}
}
}
{
while (data.devices_status == STATUS_PAUSED) hc_sleep (1);
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
{
while (data.devices_status == STATUS_PAUSED) hc_sleep (1);
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
run_kernel (KERN_RUN_2, device_param, pws_cnt);
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
run_kernel (KERN_RUN_3, device_param, pws_cnt);
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
device_param->pws_cnt = 0;
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
device_param->pw_add (device_param, (uint8_t *) line_buf, line_len);
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
if (data.devices_status == STATUS_BYPASS) break;
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
if (data.devices_status == STATUS_BYPASS) break;
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
device_param->pws_cnt = 0;
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
device_param->pws_cnt = 0;
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
hc_thread_wait (devices_cnt, c_threads);
+
local_free (c_threads);
data.restore = 0;
logfile_sub_var_uint ("status-after-work", data.devices_status);
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
global_free (subid);
}
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) check_checkpoint ();
+
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
if (quiet == 0) log_info_nn ("Started: %s", ctime (&proc_start));
if (quiet == 0) log_info_nn ("Stopped: %s", ctime (&proc_stop));
- if (data.devices_status == STATUS_ABORTED) return 2;
- if (data.devices_status == STATUS_QUIT) return 2;
- if (data.devices_status == STATUS_EXHAUSTED) return 1;
- if (data.devices_status == STATUS_CRACKED) return 0;
+ if (data.devices_status == STATUS_ABORTED) return 2;
+ if (data.devices_status == STATUS_QUIT) return 2;
+ if (data.devices_status == STATUS_STOP_AT_CHECKPOINT) return 2;
+ if (data.devices_status == STATUS_EXHAUSTED) return 1;
+ if (data.devices_status == STATUS_CRACKED) return 0;
return -1;
}
{
switch (devices_status)
{
- case STATUS_INIT: return ((char *) ST_0000); break;
- case STATUS_STARTING: return ((char *) ST_0001); break;
- case STATUS_RUNNING: return ((char *) ST_0002); break;
- case STATUS_PAUSED: return ((char *) ST_0003); break;
- case STATUS_EXHAUSTED: return ((char *) ST_0004); break;
- case STATUS_CRACKED: return ((char *) ST_0005); break;
- case STATUS_ABORTED: return ((char *) ST_0006); break;
- case STATUS_QUIT: return ((char *) ST_0007); break;
+ case STATUS_INIT: return ((char *) ST_0000); break;
+ case STATUS_STARTING: return ((char *) ST_0001); break;
+ case STATUS_RUNNING: return ((char *) ST_0002); break;
+ case STATUS_PAUSED: return ((char *) ST_0003); break;
+ case STATUS_EXHAUSTED: return ((char *) ST_0004); break;
+ case STATUS_CRACKED: return ((char *) ST_0005); break;
+ case STATUS_ABORTED: return ((char *) ST_0006); break;
+ case STATUS_QUIT: return ((char *) ST_0007); break;
+ case STATUS_BYPASS: return ((char *) ST_0008); break;
+ case STATUS_STOP_AT_CHECKPOINT: return ((char *) ST_0009); break;
}
return ((char *) "Unknown");
log_info ("Next dictionary / mask in queue selected, bypassing current one");
}
+void stop_at_checkpoint ()
+{
+ if (data.devices_status != STATUS_RUNNING) return;
+
+ // this feature only makes sense if --restore-disable was not specified
+
+ if (data.restore_disable == 0)
+ {
+ data.devices_status = STATUS_STOP_AT_CHECKPOINT;
+
+ // save the current restore point value
+
+ data.checkpoint_cur_words = get_lowest_words_done ();
+
+ log_info ("Stop at next checkpoint");
+ }
+ else
+ {
+ log_info ("WARNING: this feature is disabled when --restore-disable was specified");
+ }
+}
+
void myabort ()
{
if (data.devices_status == STATUS_INIT) return;
}
}
+void check_checkpoint ()
+{
+ // if (data.restore_disable == 1) break; (this is already implied by previous checks)
+
+ uint64_t words_cur = get_lowest_words_done ();
+
+ if (words_cur != data.checkpoint_cur_words)
+ {
+ myabort ();
+ }
+}
+
/**
* adjustments
*/
break;
+ case 'c':
+
+ log_info ("");
+
+ if (benchmark == 1) break;
+
+ stop_at_checkpoint ();
+
+ log_info ("");
+
+ if (quiet == 0) fprintf (stdout, "%s", PROMPT);
+ if (quiet == 0) fflush (stdout);
+
+ break;
+
case 'q':
log_info ("");