add eviction stat
MODIFY
include/afl-fuzz.h
include/afl-fuzz.h
@@ -704,6 +704,9 @@ typedef struct afl_state {
/* How many queue entries currently have cached testcases */
u32 q_testcase_cache_count;
+ /* How often did we evict from the cache */
+ u32 q_testcase_evictions;
+
/* Refs to each queue entry with cached testcase (for eviction, if cache_count
* is too large) */
struct queue_entry *q_testcase_cache[TESTCASE_ENTRIES];

MODIFY
src/afl-fuzz-queue.c
src/afl-fuzz-queue.c
@@ -996,6 +996,7 @@ inline u8 *queue_testcase_get(afl_state_t *afl, struct queue_entry *q) {
afl->q_testcase_cache_size -= old_cached->len;
afl->q_testcase_cache[tid] = NULL;
--afl->q_testcase_cache_count;
+ ++afl->q_testcase_evictions;
}

MODIFY
src/afl-fuzz-stats.c
src/afl-fuzz-stats.c
@@ -167,6 +167,7 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
"havoc_expansion : %u\n"
"testcache_size : %llu\n"
"testcache_count : %u\n"
+ "testcache_evict : %u\n"
"afl_banner : %s\n"
"afl_version : " VERSION
"\n"
@@ -202,7 +203,8 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
#endif
t_bytes, afl->var_byte_count, afl->expand_havoc,
afl->q_testcase_cache_size, afl->q_testcase_cache_count,
- afl->use_banner, afl->unicorn_mode ? "unicorn" : "",
+ afl->q_testcase_evictions, afl->use_banner,
+ afl->unicorn_mode ? "unicorn" : "",
afl->fsrv.qemu_mode ? "qemu " : "",
afl->non_instrumented_mode ? " non_instrumented " : "",
afl->no_forkserver ? "no_fsrv " : "", afl->crash_mode ? "crash " : "",

add eviction stat