Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Fix deprecated range_x() calls.
Browse files Browse the repository at this point in the history
Test: builds with new libbenchmark.
Change-Id: I91c0e5c1b5cf75b8e551f3c59d83ac9352817c4a
  • Loading branch information
Martijn Coenen committed Nov 15, 2016
1 parent b3321c9 commit be763d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
28 changes: 14 additions & 14 deletions benchmarks/math_benchmark.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/property_benchmark.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/stdio_benchmark.cpp
Expand Up @@ -28,7 +28,7 @@ constexpr auto KB = 1024;

template <typename Fn>
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);
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/string_benchmark.cpp
Expand Up @@ -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);
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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()) {
Expand All @@ -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;
Expand Down

0 comments on commit be763d8

Please sign in to comment.