t/bench.cc | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 2 | 15 | 13.3 |
branch | 3 | 24 | 12.5 |
condition | n/a | ||
subroutine | n/a | ||
pod | n/a | ||
total | 5 | 39 | 12.8 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | #include |
||||||
2 | #include |
||||||
3 | |||||||
4 | 1 | 50 | TEST_CASE("bench", "[.]") { | ||||
5 | 0 | 0 | BENCHMARK("hello1") { | ||||
0 | |||||||
0 | |||||||
6 | 0 | uint64_t r = 0; | |||||
7 | 0 | 0 | for (int i = 0; i < 1000; ++i) { | ||||
8 | 0 | auto p = malloc(30000000); | |||||
9 | 0 | free(p); | |||||
10 | 0 | r += (uint64_t)p; | |||||
11 | } | ||||||
12 | 0 | return r; | |||||
13 | 0 | 0 | }; | ||||
14 | 0 | 0 | BENCHMARK("hello2") { | ||||
0 | |||||||
0 | |||||||
15 | 0 | auto p = malloc(30000000); | |||||
16 | 0 | free(p); | |||||
17 | 0 | return p; | |||||
18 | 0 | 0 | }; | ||||
19 | 4 | 50 | } | ||||
50 |