1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Better naming for benchmarks

This commit is contained in:
Carles Fernandez 2020-06-24 13:59:50 +02:00
parent 3fcc7b7f85
commit 300279bc30
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,6 @@
void bm_forloop(benchmark::State& state)
{
int32_t corr_value = 0;
std::vector<float> d_symbol_history(GPS_CA_PREAMBLE_LENGTH_SYMBOLS, 0.0);
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
@ -44,6 +43,7 @@ void bm_forloop(benchmark::State& state)
while (state.KeepRunning())
{
int32_t corr_value = 0;
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
if (d_symbol_history[i] < 0.0)
@ -59,9 +59,8 @@ void bm_forloop(benchmark::State& state)
}
void bm_lambda(benchmark::State& state)
void bm_accumulate(benchmark::State& state)
{
int32_t corr_value = 0;
std::vector<float> d_symbol_history(GPS_CA_PREAMBLE_LENGTH_SYMBOLS, 0.0);
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
@ -75,6 +74,7 @@ void bm_lambda(benchmark::State& state)
while (state.KeepRunning())
{
int32_t corr_value = 0;
corr_value += std::accumulate(d_symbol_history.begin(),
d_symbol_history.begin() + GPS_CA_PREAMBLE_LENGTH_BITS,
0,
@ -82,6 +82,7 @@ void bm_lambda(benchmark::State& state)
}
}
BENCHMARK(bm_forloop);
BENCHMARK(bm_lambda);
BENCHMARK(bm_accumulate);
BENCHMARK_MAIN();

View File

@ -26,10 +26,9 @@
void bm_forloop(benchmark::State& state)
{
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
int32_t n = 0;
while (state.KeepRunning())
{
n = 0;
int32_t n = 0;
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
if (GPS_CA_PREAMBLE[i] == '1')
@ -47,7 +46,7 @@ void bm_forloop(benchmark::State& state)
}
void bm_lambda(benchmark::State& state)
void bm_generate(benchmark::State& state)
{
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
while (state.KeepRunning())
@ -58,5 +57,5 @@ void bm_lambda(benchmark::State& state)
BENCHMARK(bm_forloop);
BENCHMARK(bm_lambda);
BENCHMARK(bm_generate);
BENCHMARK_MAIN();