diff options
author | hexcoder- <heiko@hexco.de> | 2020-05-07 18:33:38 +0200 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2020-05-07 18:33:38 +0200 |
commit | d217c7df055b9ca44e5398d8c7d50d43e0b2e56d (patch) | |
tree | 39b381389f65c029a6bdb6dae9bba9c9ec4160e6 /src/afl-fuzz-run.c | |
parent | 9484da57ed3f421ac274ac51282dba779994da9a (diff) | |
parent | ef2ccc8117bb899616472e2d95525ae0ca1a2098 (diff) | |
download | afl++-d217c7df055b9ca44e5398d8c7d50d43e0b2e56d.tar.gz |
Merge branch 'dev' of https://github.com/AFLplusplus/AFLplusplus into dev
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; |