[test-suite] r318499 - [XRay][test-suite] Update XRay microbenchmarks to use ranged for loops
Eizan Miyamoto via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 17:54:46 PST 2017
Author: eizan
Date: Thu Nov 16 17:54:46 2017
New Revision: 318499
URL: http://llvm.org/viewvc/llvm-project?rev=318499&view=rev
Log:
[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
Modified:
test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
Modified: test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc?rev=318499&r1=318498&r2=318499&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc (original)
+++ test-suite/trunk/MicroBenchmarks/XRay/FDRMode/fdrmode-bench.cc Thu Nov 16 17:54:46 2017
@@ -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);
}
Modified: test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc?rev=318499&r1=318498&r2=318499&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc (original)
+++ test-suite/trunk/MicroBenchmarks/XRay/ReturnReference/retref-bench.cc Thu Nov 16 17:54:46 2017
@@ -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_ReturnInstrumentedPatchedTh
[[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_ReturnInstrumentedPatchedWithLogHandl
__xray_set_handler(benchmark_handler);
__xray_patch();
benchmark::ClobberMemory();
- while (state.KeepRunning()) {
+ for (auto _ : state) {
int x;
benchmark::DoNotOptimize(x = alwaysInstrumented());
benchmark::ClobberMemory();
More information about the llvm-commits
mailing list