diff options
author | van Hauser <vh@thc.org> | 2020-05-07 14:09:58 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-05-07 14:09:58 +0200 |
commit | 02887dc1645f3d4114905d22240a062098314e7b (patch) | |
tree | b5230bb88efc5afa2bcf91722e6678371c31ffd1 /src/afl-fuzz-run.c | |
parent | d048af11cd43caf9fc9a8dc2e39a41b33600448f (diff) | |
download | afl++-02887dc1645f3d4114905d22240a062098314e7b.tar.gz |
fix static and profiling compilation and add profiling calculation
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r-- | src/afl-fuzz-run.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index 692026d4..b7f7f29c 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -30,13 +30,37 @@ #include "cmplog.h" +#ifdef PROFILING +u64 time_spent_working = 0; +#endif + /* Execute target application, monitoring for timeouts. Return status information. The called program will update afl->fsrv->trace_bits. */ fsrv_run_result_t fuzz_run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) { +#ifdef PROFILING + static u64 time_spent_start = 0; + struct timespec spec; + if (time_spent_start) { + + u64 current; + clock_gettime(CLOCK_REALTIME, &spec); + current = (spec.tv_sec * 1000000000) + spec.tv_nsec; + time_spent_working += (current - time_spent_start); + + } + +#endif + fsrv_run_result_t res = afl_fsrv_run_target(fsrv, timeout, &afl->stop_soon); + +#ifdef PROFILING + clock_gettime(CLOCK_REALTIME, &spec); + time_spent_start = (spec.tv_sec * 1000000000) + spec.tv_nsec; +#endif + // TODO: Don't classify for faults? classify_counts(fsrv); return res; |