diff options
author | van Hauser <vh@thc.org> | 2024-04-13 11:50:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-13 11:50:49 +0200 |
commit | 1d17210d9fb0eb37ba866a3697643a9e4f37acd5 (patch) | |
tree | 2471cccc76e4396de369f3bfe4b8f4bb00ef6403 /utils/bench | |
parent | 775861ea94d00672c9e868db329073afd699b994 (diff) | |
parent | 1582aa9da2d7593e5b577aa3fc963ea7eb2ccbb3 (diff) | |
download | afl++-1d17210d9fb0eb37ba866a3697643a9e4f37acd5.tar.gz |
Merge pull request #2052 from AFLplusplus/dev v4.20c
4.20 release pre-PR
Diffstat (limited to 'utils/bench')
-rw-r--r-- | utils/bench/Makefile | 8 | ||||
-rw-r--r-- | utils/bench/README.md | 2 | ||||
-rw-r--r-- | utils/bench/hash.c | 53 |
3 files changed, 63 insertions, 0 deletions
diff --git a/utils/bench/Makefile b/utils/bench/Makefile new file mode 100644 index 00000000..e7d2f3a1 --- /dev/null +++ b/utils/bench/Makefile @@ -0,0 +1,8 @@ +all: hash + +hash: hash.c + gcc -O3 -mavx2 -march=native -I../../include -o hash hash.c + +clean: + rm -f hash + diff --git a/utils/bench/README.md b/utils/bench/README.md new file mode 100644 index 00000000..772c117b --- /dev/null +++ b/utils/bench/README.md @@ -0,0 +1,2 @@ +# Internal AFL++ benchmarking + diff --git a/utils/bench/hash.c b/utils/bench/hash.c new file mode 100644 index 00000000..d4be0ab4 --- /dev/null +++ b/utils/bench/hash.c @@ -0,0 +1,53 @@ +#include <stdio.h> +#include <stdint.h> +#include <time.h> + +#define T1HA0_AESNI_AVAILABLE 1 +#define T1HA_USE_FAST_ONESHOT_READ 1 +#define T1HA_USE_INDIRECT_FUNCTIONS 1 +#define T1HA_IA32AES_NAME t1ha0_ia32aes +#include "t1ha0_ia32aes_b.h" + +#define XXH_INLINE_ALL +#include "xxhash.h" +#undef XXH_INLINE_ALL + +int main() { + + char *data = malloc(4097); + struct timespec start, end; + long long duration; + int i; + uint64_t res; + + clock_gettime(CLOCK_MONOTONIC, &start); + for (i = 0; i < 100000000; ++i) { + + res = XXH3_64bits(data, 4097); + memcpy(data + 16, (char *)&res, 8); + + } + + clock_gettime(CLOCK_MONOTONIC, &end); + duration = (end.tv_sec - start.tv_sec) * 1000000000LL + + (end.tv_nsec - start.tv_nsec); + printf("xxh3 duration: %lld ns\n", duration); + + memset(data, 0, 4097); + clock_gettime(CLOCK_MONOTONIC, &start); + for (i = 0; i < 100000000; ++i) { + + res = t1ha0_ia32aes(data, 4097); + memcpy(data + 16, (char *)&res, 8); + + } + + clock_gettime(CLOCK_MONOTONIC, &end); + duration = (end.tv_sec - start.tv_sec) * 1000000000LL + + (end.tv_nsec - start.tv_nsec); + printf("t1ha0_ia32aes duration: %lld ns\n", duration); + + return 0; + +} + |