From be763d85c881b58754e650192204e8a2309660cb Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Mon, 14 Nov 2016 14:16:08 +0100 Subject: [PATCH] Fix deprecated range_x() calls. Test: builds with new libbenchmark. Change-Id: I91c0e5c1b5cf75b8e551f3c59d83ac9352817c4a --- benchmarks/math_benchmark.cpp | 28 ++++++++++++++-------------- benchmarks/property_benchmark.cpp | 8 ++++---- benchmarks/stdio_benchmark.cpp | 2 +- benchmarks/string_benchmark.cpp | 10 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp index 36ac301c6d7..a411c9ca1bb 100644 --- a/benchmarks/math_benchmark.cpp +++ b/benchmarks/math_benchmark.cpp @@ -25,7 +25,7 @@ static const char* names[] = { "1234.0", "nan", "HUGE_VAL", "0.0" }; #define BENCHMARK_COMMON_VALS(name) BENCHMARK(name)->Arg(0)->Arg(1)->Arg(2)->Arg(3) static void SetLabel(benchmark::State& state) { - state.SetLabel(names[state.range_x()]); + state.SetLabel(names[state.range(0)]); } // Avoid optimization. @@ -61,7 +61,7 @@ BENCHMARK(BM_math_logb); static void BM_math_isfinite_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isfinite(v); } @@ -76,7 +76,7 @@ BENCHMARK_COMMON_VALS(BM_math_isfinite_macro); #endif static void BM_math_isfinite(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += test_isfinite(v); } @@ -86,7 +86,7 @@ BENCHMARK_COMMON_VALS(BM_math_isfinite); static void BM_math_isinf_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isinf(v); } @@ -96,7 +96,7 @@ BENCHMARK_COMMON_VALS(BM_math_isinf_macro); static void BM_math_isinf(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (isinf)(v); } @@ -106,7 +106,7 @@ BENCHMARK_COMMON_VALS(BM_math_isinf); static void BM_math_isnan_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isnan(v); } @@ -116,7 +116,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnan_macro); static void BM_math_isnan(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (isnan)(v); } @@ -126,7 +126,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnan); static void BM_math_isnormal_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isnormal(v); } @@ -137,7 +137,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnormal_macro); #if defined(__BIONIC__) static void BM_math_isnormal(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (__isnormal)(v); } @@ -180,7 +180,7 @@ BENCHMARK(BM_math_sin_fesetenv); static void BM_math_fpclassify(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += fpclassify(v); } @@ -190,7 +190,7 @@ BENCHMARK_COMMON_VALS(BM_math_fpclassify); static void BM_math_signbit_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += signbit(v); } @@ -200,7 +200,7 @@ BENCHMARK_COMMON_VALS(BM_math_signbit_macro); static void BM_math_signbit(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (__signbit)(v); } @@ -210,7 +210,7 @@ BENCHMARK_COMMON_VALS(BM_math_signbit); static void BM_math_fabs_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += fabs(v); } @@ -220,7 +220,7 @@ BENCHMARK_COMMON_VALS(BM_math_fabs_macro); static void BM_math_fabs(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (fabs)(v); } diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp index 4e821176bcc..ef5f225fe23 100644 --- a/benchmarks/property_benchmark.cpp +++ b/benchmarks/property_benchmark.cpp @@ -142,7 +142,7 @@ struct LocalPropertyTestState { }; static void BM_property_get(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -155,7 +155,7 @@ static void BM_property_get(benchmark::State& state) { BENCHMARK(BM_property_get)->TEST_NUM_PROPS; static void BM_property_find(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -167,7 +167,7 @@ static void BM_property_find(benchmark::State& state) { BENCHMARK(BM_property_find)->TEST_NUM_PROPS; static void BM_property_read(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -190,7 +190,7 @@ static void BM_property_read(benchmark::State& state) { BENCHMARK(BM_property_read)->TEST_NUM_PROPS; static void BM_property_serial(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp index a556d172374..f49677956ad 100644 --- a/benchmarks/stdio_benchmark.cpp +++ b/benchmarks/stdio_benchmark.cpp @@ -28,7 +28,7 @@ constexpr auto KB = 1024; template void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { - size_t chunk_size = state.range_x(); + size_t chunk_size = state.range(0); FILE* fp = fopen("/dev/zero", "rw"); __fsetlocking(fp, FSETLOCKING_BYCALLER); diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp index 0a385126573..41306db1cda 100644 --- a/benchmarks/string_benchmark.cpp +++ b/benchmarks/string_benchmark.cpp @@ -27,7 +27,7 @@ constexpr auto KB = 1024; // TODO: test unaligned operation too? (currently everything will be 8-byte aligned by malloc.) static void BM_string_memcmp(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* src = new char[nbytes]; char* dst = new char[nbytes]; memset(src, 'x', nbytes); memset(dst, 'x', nbytes); @@ -44,7 +44,7 @@ static void BM_string_memcmp(benchmark::State& state) { BENCHMARK(BM_string_memcmp)->AT_COMMON_SIZES; static void BM_string_memcpy(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* src = new char[nbytes]; char* dst = new char[nbytes]; memset(src, 'x', nbytes); @@ -59,7 +59,7 @@ static void BM_string_memcpy(benchmark::State& state) { BENCHMARK(BM_string_memcpy)->AT_COMMON_SIZES; static void BM_string_memmove(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* buf = new char[nbytes + 64]; memset(buf, 'x', nbytes + 64); @@ -73,7 +73,7 @@ static void BM_string_memmove(benchmark::State& state) { BENCHMARK(BM_string_memmove)->AT_COMMON_SIZES; static void BM_string_memset(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* dst = new char[nbytes]; while (state.KeepRunning()) { @@ -86,7 +86,7 @@ static void BM_string_memset(benchmark::State& state) { BENCHMARK(BM_string_memset)->AT_COMMON_SIZES; static void BM_string_strlen(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* s = new char[nbytes]; memset(s, 'x', nbytes); s[nbytes - 1] = 0;