diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-03-27 10:02:38 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-03-27 10:02:38 +0200 |
commit | 4eca708d8e693438d4e643dff7283f3cfb79d360 (patch) | |
tree | 4ffc2a6b8632a88e33617a152e657e2e522f5f6a /' | |
parent | fc820c883938e7daa257820c818a5c6b609f755f (diff) | |
download | kit-4eca708d8e693438d4e643dff7283f3cfb79d360.zip |
Benchmark multiple cycles
Diffstat (limited to ''')
-rw-r--r-- | ' | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +#define KIT_TEST_FILE foo +#include "../../kit_test/bench.h" + +struct test_foo_ { + double f; +}; + +BENCHMARK("foo") { + BENCHMARK_REPEAT(800); + + BENCHMARK_BEGIN; + { + int x = 0; + struct test_foo_ f = { 0. }; + + for (int i = 0; i < 100000; i++) { + x += (1 << 1); + x ^= i; + f.f += 0.1; + } + DO_NOT_OPTIMIZE(x); + DO_NOT_OPTIMIZE(f); + } + BENCHMARK_END; +} + +BENCHMARK("bar") { } |