Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: third_party/google_benchmark/test/donotoptimize_test.cc

Issue 2865663003: Adding Google benchmarking library. (Closed)
Patch Set: Sketch. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include "benchmark/benchmark.h"
2
3 #include <cstdint>
4
5 namespace {
6 #if defined(__GNUC__)
7 std::uint64_t double_up(const std::uint64_t x) __attribute__((const));
8 #endif
9 std::uint64_t double_up(const std::uint64_t x) { return x * 2; }
10 }
11
12 int main(int, char*[]) {
13 // this test verifies compilation of DoNotOptimize() for some types
14
15 char buffer8[8];
16 benchmark::DoNotOptimize(buffer8);
17
18 char buffer20[20];
19 benchmark::DoNotOptimize(buffer20);
20
21 char buffer1024[1024];
22 benchmark::DoNotOptimize(buffer1024);
23 benchmark::DoNotOptimize(&buffer1024[0]);
24
25 int x = 123;
26 benchmark::DoNotOptimize(x);
27 benchmark::DoNotOptimize(&x);
28 benchmark::DoNotOptimize(x += 42);
29
30 benchmark::DoNotOptimize(double_up(x));
31
32 return 0;
33 }
OLDNEW
« no previous file with comments | « third_party/google_benchmark/test/diagnostics_test.cc ('k') | third_party/google_benchmark/test/filter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698