Skip to content

Commit

Permalink
fix: Updates fifo benchmark so it works on 4GB Raspberry Pi
Browse files Browse the repository at this point in the history
(cherry picked from commit 242e53f)
  • Loading branch information
cvilas committed Jun 28, 2024
1 parent a7d6ca0 commit 1720c9f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/common/realtime/examples/fifo_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ void bmFifoWrite(benchmark::State& state) {
const auto writer = [&data](std::span<std::byte> buffer) {
std::memcpy(buffer.data(), data.data(), data.size());
};
bool succeeded = false;
for (auto s : state) {
(void)s;
bool succeeded = false;
benchmark::DoNotOptimize(succeeded = fifo.visitToWrite(writer));
if (not succeeded) {
throw std::runtime_error("write failed");
Expand Down Expand Up @@ -55,9 +55,9 @@ void bmFifoRead(benchmark::State& state) {
std::memcpy(data.data(), buffer.data(), buffer.size_bytes());
};

bool succeeded = false;
for (auto s : state) {
(void)s;
bool succeeded = false;
benchmark::DoNotOptimize(succeeded = fifo.visitToRead(reader));
if (not succeeded) {
throw std::runtime_error("read failed");
Expand All @@ -70,7 +70,7 @@ void bmFifoRead(benchmark::State& state) {
static constexpr auto MAX_ITERATIONS = 1000000U;
static constexpr auto DATA_SIZE_MULT = 2U;
static constexpr auto DATA_SIZE_MIN = 8;
static constexpr auto DATA_SIZE_MAX = 4096;
static constexpr auto DATA_SIZE_MAX = 2048;

// NOLINTNEXTLINE(cppcoreguidelines-owning-memory,cert-err58-cpp,cppcoreguidelines-avoid-non-const-global-variables)
BENCHMARK(bmFifoWrite)
Expand Down

0 comments on commit 1720c9f

Please sign in to comment.