@@ -321,8 +321,9 @@ void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
321
321
#ifndef __HAIKU__
322
322
if (getrusage (RUSAGE_CHILDREN , & rus )) { rus .ru_maxrss = 0 ; }
323
323
#endif
324
- u64 runtime = afl -> prev_run_time + cur_time - afl -> start_time ;
325
- if (!runtime ) { runtime = 1 ; }
324
+ u64 runtime_ms = afl -> prev_run_time + cur_time - afl -> start_time ;
325
+ u64 overhead_ms = (afl -> calibration_time_us + afl -> sync_time_us + afl -> trim_time_us ) / 1000 ;
326
+ if (!runtime_ms ) { runtime_ms = 1 ; }
326
327
327
328
fprintf (
328
329
f ,
@@ -375,20 +376,17 @@ void write_stats_file(afl_state_t *afl, u32 t_bytes, double bitmap_cvg,
375
376
"target_mode : %s%s%s%s%s%s%s%s%s%s\n"
376
377
"command_line : %s\n" ,
377
378
(afl -> start_time /*- afl->prev_run_time*/ ) / 1000 , cur_time / 1000 ,
378
- runtime / 1000 , (u32 )getpid (),
379
+ runtime_ms / 1000 , (u32 )getpid (),
379
380
afl -> queue_cycle ? (afl -> queue_cycle - 1 ) : 0 , afl -> cycles_wo_finds ,
380
381
afl -> longest_find_time > cur_time - afl -> last_find_time
381
382
? afl -> longest_find_time / 1000
382
383
: ((afl -> start_time == 0 || afl -> last_find_time == 0 )
383
384
? 0
384
385
: (cur_time - afl -> last_find_time ) / 1000 ),
385
- (runtime -
386
- ((afl -> calibration_time_us + afl -> sync_time_us + afl -> trim_time_us ) /
387
- 1000 )) /
388
- 1000 ,
386
+ (runtime_ms - MIN (runtime_ms , overhead_ms )) / 1000 ,
389
387
afl -> calibration_time_us / 1000000 , afl -> sync_time_us / 1000000 ,
390
388
afl -> trim_time_us / 1000000 , afl -> fsrv .total_execs ,
391
- afl -> fsrv .total_execs / ((double )(runtime ) / 1000 ),
389
+ afl -> fsrv .total_execs / ((double )(runtime_ms ) / 1000 ),
392
390
afl -> last_avg_execs_saved , afl -> queued_items , afl -> queued_favored ,
393
391
afl -> queued_discovered , afl -> queued_imported , afl -> queued_variable ,
394
392
afl -> max_depth , afl -> current_entry , afl -> pending_favored ,
@@ -632,9 +630,9 @@ void show_stats_normal(afl_state_t *afl) {
632
630
633
631
cur_ms = get_cur_time ();
634
632
635
- if (afl -> most_time_key ) {
633
+ if (afl -> most_time_key && afl -> queue_cycle ) {
636
634
637
- if (afl -> most_time * 1000 < cur_ms - afl -> start_time ) {
635
+ if (afl -> most_time * 1000 + afl -> sync_time_us / 1000 < cur_ms - afl -> start_time ) {
638
636
639
637
afl -> most_time_key = 2 ;
640
638
afl -> stop_soon = 2 ;
@@ -643,7 +641,7 @@ void show_stats_normal(afl_state_t *afl) {
643
641
644
642
}
645
643
646
- if (afl -> most_execs_key == 1 ) {
644
+ if (afl -> most_execs_key == 1 && afl -> queue_cycle ) {
647
645
648
646
if (afl -> most_execs <= afl -> fsrv .total_execs ) {
649
647
@@ -1462,9 +1460,9 @@ void show_stats_pizza(afl_state_t *afl) {
1462
1460
1463
1461
cur_ms = get_cur_time ();
1464
1462
1465
- if (afl -> most_time_key ) {
1463
+ if (afl -> most_time_key && afl -> queue_cycle ) {
1466
1464
1467
- if (afl -> most_time * 1000 < cur_ms - afl -> start_time ) {
1465
+ if (afl -> most_time * 1000 + afl -> sync_time_us / 1000 < cur_ms - afl -> start_time ) {
1468
1466
1469
1467
afl -> most_time_key = 2 ;
1470
1468
afl -> stop_soon = 2 ;
@@ -1473,7 +1471,7 @@ void show_stats_pizza(afl_state_t *afl) {
1473
1471
1474
1472
}
1475
1473
1476
- if (afl -> most_execs_key == 1 ) {
1474
+ if (afl -> most_execs_key == 1 && afl -> queue_cycle ) {
1477
1475
1478
1476
if (afl -> most_execs <= afl -> fsrv .total_execs ) {
1479
1477
@@ -2505,4 +2503,3 @@ void update_sync_time(afl_state_t *afl, u64 *time) {
2505
2503
* time = cur ;
2506
2504
2507
2505
}
2508
-
0 commit comments