diff options
author | Sergey Bronnikov <estetus@gmail.com> | 2024-03-30 11:26:38 +0300 |
---|---|---|
committer | Sergey Bronnikov <sergeyb@tarantool.org> | 2024-03-31 11:11:29 +0300 |
commit | 5ffc8c70761f97fbaffa3a98a6c472d35930c7b2 (patch) | |
tree | d2aaa36211067c66fbf0530d68cb4db6738890c8 /src/afl-fuzz-init.c | |
parent | 775861ea94d00672c9e868db329073afd699b994 (diff) | |
download | afl++-5ffc8c70761f97fbaffa3a98a6c472d35930c7b2.tar.gz |
src: fix calculation of fuzzing time in statistics
When the computer is suspended during a fuzzing session, the time spent in suspended state is counted as a "run time" on a statistics screen. The time returned by `gettimeofday(2)` is affected by discontinuous jumps in the system time. It is better using `clock_gettime(2)`. The patch replace `gettimeofday` with `clock_gettime` [1]. `clock_gettime` uses a CLOCK_MONOTONIC_COARSE clock type, it is faster than CLOCK_MONOTONIC, but still has resolution (~1ms) that is adequate for our purposes. However, CLOCK_MONOTONIC_COARSE is a Linux-specific clock variant, so on macOS it is replaced with CLOCK_MONOTONIC, and with CLOCK_MONOTONIC_FAST on FreeBSD [2]. Closes #1241 1. https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html 2. https://man.freebsd.org/cgi/man.cgi?query=clock_gettime
Diffstat (limited to 'src/afl-fuzz-init.c')
0 files changed, 0 insertions, 0 deletions