| 1 |
|
| #include <catch2/catch_test_macros.hpp> |
| 2 |
|
| #include <catch2/benchmark/catch_benchmark.hpp> |
| 3 |
|
| |
| 4 |
0 |
| TEST_CASE("bench", "[.]") { |
| 5 |
0 |
▶ | BENCHMARK("hello1") { |
Branch: 3 branches
| Branch | True | False | Total |
| BENCHMARK("hello1") { |
0 |
0 |
0 |
| BENCHMARK("hello1") { |
0 |
0 |
0 |
| BENCHMARK("hello1") { |
0 |
0 |
0 |
|
| 6 |
0 |
| uint64_t r = 0; |
| 7 |
0 |
▶ | for (int i = 0; i < 1000; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < 1000; ++i) { |
0 |
0 |
0 |
|
| 8 |
0 |
| auto p = malloc(30000000); |
| 9 |
0 |
| r += (uint64_t)p; |
| 10 |
0 |
| free(p); |
| 11 |
|
| } |
| 12 |
0 |
| return r; |
| 13 |
0 |
▶ | }; |
Branch: 1 branch
| Branch | True | False | Total |
| }; |
0 |
0 |
0 |
|
| 14 |
0 |
▶ | BENCHMARK("hello2") { |
Branch: 3 branches
| Branch | True | False | Total |
| BENCHMARK("hello2") { |
0 |
0 |
0 |
| BENCHMARK("hello2") { |
0 |
0 |
0 |
| BENCHMARK("hello2") { |
0 |
0 |
0 |
|
| 15 |
|
| uint64_t ret; |
| 16 |
0 |
| auto p = malloc(30000000); |
| 17 |
0 |
| ret = (uint64_t)p; |
| 18 |
0 |
| free(p); |
| 19 |
0 |
| return ret; |
| 20 |
0 |
▶ | }; |
Branch: 1 branch
| Branch | True | False | Total |
| }; |
0 |
0 |
0 |
|
| 21 |
0 |
| } |