aboutsummaryrefslogtreecommitdiff
path: root/MicroBenchmarks
diff options
context:
space:
mode:
authorEizan Miyamoto <eizan.miyamoto@gmail.com>2017-11-17 01:54:46 +0000
committerEizan Miyamoto <eizan.miyamoto@gmail.com>2017-11-17 01:54:46 +0000
commit71d128e0636f4f5bc35e137aa02ad170a7d9e599 (patch)
tree8f799cafc96c4e24c0ffd5983a56557f9a1a1e36 /MicroBenchmarks
parent003943543d529728bcb3cbb64381856a015e3916 (diff)
[XRay][test-suite] Update XRay microbenchmarks to use ranged for loops
Summary: This is slightly more efficient and is now supported by benchmark 1.3.0 Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40162 git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@318499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'MicroBenchmarks')
-rw-r--r--MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc2
-rw-r--r--MicroBenchmarks/XRay/ReturnReference/retref-bench.cc12
2 files changed, 7 insertions, 7 deletions
diff --git a/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc b/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
index 0042ee52..a9a844a8 100644
--- a/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
+++ b/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
@@ -71,7 +71,7 @@ volatile bool log_initialized = false;
if (state.thread_index == 0) {
SetUpXRayFDRMultiThreaded(state);
}
- while (state.KeepRunning()) {
+ for (auto _ : state) {
val = EmptyFunction();
benchmark::DoNotOptimize(val);
}
diff --git a/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc b/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
index 8c7a59b3..84a8a4e5 100644
--- a/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
+++ b/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
@@ -25,7 +25,7 @@ neverInstrumented() {
[[clang::xray_never_instrument]] static void BM_ReturnNeverInstrumented(
benchmark::State& state) {
- while (state.KeepRunning()) {
+ for (auto _ : state) {
benchmark::DoNotOptimize(neverInstrumented());
}
}
@@ -41,7 +41,7 @@ alwaysInstrumented() {
[[clang::xray_never_instrument]] static void BM_ReturnInstrumentedUnPatched(
benchmark::State& state) {
__xray_unpatch();
- while (state.KeepRunning()) {
+ for (auto _ : state) {
int x;
benchmark::DoNotOptimize(x = alwaysInstrumented());
benchmark::ClobberMemory();
@@ -55,7 +55,7 @@ BENCHMARK(BM_ReturnInstrumentedUnPatched);
benchmark::State& state) {
__xray_patch();
__xray_unpatch();
- while (state.KeepRunning()) {
+ for (auto _ : state) {
int x;
benchmark::DoNotOptimize(x = alwaysInstrumented());
benchmark::ClobberMemory();
@@ -68,7 +68,7 @@ BENCHMARK(BM_ReturnInstrumentedPatchedThenUnpatched);
[[clang::xray_never_instrument]] static void BM_ReturnInstrumentedPatched(
benchmark::State& state) {
__xray_patch();
- while (state.KeepRunning()) {
+ for (auto _ : state) {
int x;
benchmark::DoNotOptimize(alwaysInstrumented());
benchmark::ClobberMemory();
@@ -79,7 +79,7 @@ BENCHMARK(BM_ReturnInstrumentedPatched);
[[clang::xray_never_instrument]] static void BM_RDTSCP_Cost(
benchmark::State& state) {
- while (state.KeepRunning()) {
+ for (auto _ : state) {
unsigned cpu;
unsigned tsc;
benchmark::DoNotOptimize(tsc = __rdtscp(&cpu));
@@ -104,7 +104,7 @@ BM_ReturnInstrumentedPatchedWithLogHandler(benchmark::State& state) {
__xray_set_handler(benchmark_handler);
__xray_patch();
benchmark::ClobberMemory();
- while (state.KeepRunning()) {
+ for (auto _ : state) {
int x;
benchmark::DoNotOptimize(x = alwaysInstrumented());
benchmark::ClobberMemory();