prev_run_time loaded used only for ui and when writing the stats file

This commit is contained in:
vj-27
2021-02-07 03:33:47 +05:30
parent f54c4dbfdb
commit 96cdc97c98
3 changed files with 13 additions and 21 deletions

View File

@ -425,7 +425,8 @@ typedef struct afl_state {
really makes no sense to haul them around as function parameters. */
u64 orig_hit_cnt_puppet, last_limit_time_start, tmp_pilot_time,
total_pacemaker_time, total_puppet_find, temp_puppet_find, most_time_key,
most_time, most_execs_key, most_execs, old_hit_count, force_ui_update;
most_time, most_execs_key, most_execs, old_hit_count, force_ui_update,
prev_run_time;
MOpt_globals_t mopt_globals_core, mopt_globals_pilot;
@ -569,7 +570,6 @@ typedef struct afl_state {
blocks_eff_total, /* Blocks subject to effector maps */
blocks_eff_select, /* Blocks selected as fuzzable */
start_time, /* Unix start time (ms) */
prev_run_time, /* Runtime read from prev stats file*/
last_path_time, /* Time for most recent path (ms) */
last_crash_time, /* Time for most recent crash (ms) */
last_hang_time; /* Time for most recent hang (ms) */

View File

@ -97,7 +97,6 @@ void load_stats_file(afl_state_t *afl) {
u8 * lptr;
u8 fn[PATH_MAX];
u32 lineno = 0;
afl->prev_run_time = 0;
snprintf(fn, PATH_MAX, "%s/fuzzer_stats", afl->out_dir);
f = fopen(fn, "r");
if (!f) {
@ -135,13 +134,8 @@ void load_stats_file(afl_state_t *afl) {
switch (lineno) {
case 3:
if (!strcmp(keystring, "run_time ")) {
if (!strcmp(keystring, "run_time "))
afl->prev_run_time = 1000 * strtoull(lptr, &nptr, 10);
afl->start_time -= afl->prev_run_time;
}
break;
case 5:
if (!strcmp(keystring, "cycles_done "))
@ -279,12 +273,13 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
"\n"
"target_mode : %s%s%s%s%s%s%s%s%s\n"
"command_line : %s\n",
afl->start_time / 1000, cur_time / 1000,
(cur_time - afl->start_time) / 1000, (u32)getpid(),
afl->queue_cycle ? (afl->queue_cycle - 1) : 0, afl->cycles_wo_finds,
afl->fsrv.total_execs,
(afl->start_time - afl->prev_run_time) / 1000, cur_time / 1000,
(afl->prev_run_time + cur_time - afl->start_time) / 1000,
(u32)getpid(), afl->queue_cycle ? (afl->queue_cycle - 1) : 0,
afl->cycles_wo_finds, afl->fsrv.total_execs,
afl->fsrv.total_execs /
((double)(get_cur_time() - afl->start_time) / 1000),
((double)(afl->prev_run_time + get_cur_time() - afl->start_time) /
1000),
afl->last_avg_execs_saved, afl->queued_paths, afl->queued_favored,
afl->queued_discovered, afl->queued_imported, afl->max_depth,
afl->current_entry, afl->pending_favored, afl->pending_not_fuzzed,
@ -479,8 +474,8 @@ void show_stats(afl_state_t *afl) {
if (likely(cur_ms != afl->start_time)) {
afl->stats_avg_exec =
((double)afl->fsrv.total_execs) * 1000 / (cur_ms - afl->start_time);
afl->stats_avg_exec = ((double)afl->fsrv.total_execs) * 1000 /
(afl->prev_run_time + cur_ms - afl->start_time);
}
@ -692,7 +687,7 @@ void show_stats(afl_state_t *afl) {
}
u_stringify_time_diff(time_tmp, cur_ms, afl->start_time);
u_stringify_time_diff(time_tmp, afl->prev_run_time + cur_ms, afl->start_time);
SAYF(bV bSTOP " run time : " cRST "%-33s " bSTG bV bSTOP
" cycles done : %s%-5s " bSTG bV "\n",
time_tmp, tmp, u_stringify_int(IB(0), afl->queue_cycle - 1));

View File

@ -1682,8 +1682,7 @@ int main(int argc, char **argv_orig, char **envp) {
if (unlikely(afl->old_seed_selection)) seek_to = find_start_position(afl);
afl->start_time = get_cur_time(); // without this, time taken for
// perform_dry_run gets added to run time.
afl->start_time = get_cur_time();
if (afl->in_place_resume || afl->afl_env.afl_autoresume) load_stats_file(afl);
write_stats_file(afl, 0, 0, 0);
maybe_update_plot_file(afl, 0, 0);
@ -1703,8 +1702,6 @@ int main(int argc, char **argv_orig, char **envp) {
// (void)nice(-20); // does not improve the speed
// real start time, we reset, so this works correctly with -V
afl->start_time = get_cur_time();
if (afl->in_place_resume || afl->afl_env.afl_autoresume)
afl->start_time -= afl->prev_run_time;
u32 runs_in_current_cycle = (u32)-1;
u32 prev_queued_paths = 0;