1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-29 22:26:22 +00:00

Fix warnings when building benchmarks

This commit is contained in:
Carles Fernandez 2024-10-06 08:14:46 +02:00
parent 5108f0aa60
commit 0a0154e1af
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 26 additions and 6 deletions

View File

@ -112,7 +112,7 @@ endif()
add_benchmark(benchmark_atan2 Gnuradio::runtime) add_benchmark(benchmark_atan2 Gnuradio::runtime)
add_benchmark(benchmark_copy) add_benchmark(benchmark_copy)
add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES})
add_benchmark(benchmark_osnma core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) # add_benchmark(benchmark_osnma core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES})
add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES})
add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES})
add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES})

View File

@ -42,9 +42,9 @@ void bm_forloop(benchmark::State& state)
std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); });
int32_t corr_value = 0;
while (state.KeepRunning()) while (state.KeepRunning())
{ {
int32_t corr_value = 0;
for (size_t i = 0; i < d_preamble_samples.size(); i++) for (size_t i = 0; i < d_preamble_samples.size(); i++)
{ {
if (d_symbol_history[i] < 0.0) if (d_symbol_history[i] < 0.0)
@ -57,6 +57,10 @@ void bm_forloop(benchmark::State& state)
} }
} }
} }
if (corr_value)
{
// avoidl warning
};
} }
@ -73,14 +77,18 @@ void bm_accumulate(benchmark::State& state)
std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); });
int32_t corr_value = 0;
while (state.KeepRunning()) while (state.KeepRunning())
{ {
int32_t corr_value = 0;
corr_value += std::accumulate(d_symbol_history.begin(), corr_value += std::accumulate(d_symbol_history.begin(),
d_symbol_history.end(), d_symbol_history.end(),
0, 0,
[&d_preamble_samples, n = 0](float a, float b) mutable { return (b > 0.0 ? a + d_preamble_samples[n++] : a - d_preamble_samples[n++]); }); [&d_preamble_samples, n = 0](float a, float b) mutable { return (b > 0.0 ? a + d_preamble_samples[n++] : a - d_preamble_samples[n++]); });
} }
if (corr_value)
{
// avoidl warning
};
} }
@ -97,9 +105,9 @@ void bm_inner_product(benchmark::State& state)
std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); });
int32_t corr_value = 0;
while (state.KeepRunning()) while (state.KeepRunning())
{ {
int32_t corr_value = 0;
corr_value += std::inner_product(d_symbol_history.begin(), corr_value += std::inner_product(d_symbol_history.begin(),
d_symbol_history.end(), d_symbol_history.end(),
d_preamble_samples.begin(), d_preamble_samples.begin(),
@ -111,6 +119,10 @@ void bm_inner_product(benchmark::State& state)
#endif #endif
[](float a, int32_t b) { return (std::signbit(a) ? -b : b); }); [](float a, int32_t b) { return (std::signbit(a) ? -b : b); });
} }
if (corr_value)
{
// avoidl warning
};
} }
@ -128,9 +140,9 @@ void bm_transform_reduce(benchmark::State& state)
std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); });
int32_t corr_value = 0;
while (state.KeepRunning()) while (state.KeepRunning())
{ {
int32_t corr_value = 0;
corr_value += std::transform_reduce(d_symbol_history.begin(), corr_value += std::transform_reduce(d_symbol_history.begin(),
d_symbol_history.end(), d_symbol_history.end(),
d_preamble_samples.begin(), d_preamble_samples.begin(),
@ -138,6 +150,10 @@ void bm_transform_reduce(benchmark::State& state)
std::plus<>(), std::plus<>(),
[](auto a, auto b) { return (std::signbit(a) ? -b : b); }); [](auto a, auto b) { return (std::signbit(a) ? -b : b); });
} }
if (corr_value)
{
// avoidl warning
};
} }
#endif #endif
@ -156,9 +172,9 @@ void bm_transform_reduce_policy(benchmark::State& state)
std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); });
int32_t corr_value = 0;
while (state.KeepRunning()) while (state.KeepRunning())
{ {
int32_t corr_value = 0;
corr_value += std::transform_reduce( corr_value += std::transform_reduce(
std::execution::par, std::execution::par,
d_symbol_history.begin(), d_symbol_history.begin(),
@ -168,6 +184,10 @@ void bm_transform_reduce_policy(benchmark::State& state)
std::plus<>(), std::plus<>(),
[](auto a, auto b) { return (std::signbit(a) ? -b : b); }); [](auto a, auto b) { return (std::signbit(a) ? -b : b); });
} }
if (corr_value)
{
// avoidl warning
};
} }
#endif #endif