#include <array>
const int chunk_size_from = 32;
const int chunk_size_to = 4096;
const auto settings =
CppBenchmark::Settings().
ParamRange(chunk_size_from, chunk_size_to, [](
int from,
int to,
int& result) {
int r = result; result *= 2;
return r; });
class FileFixture
{
protected:
FILE* file;
std::array<uint8_t, chunk_size_to> buffer;
FileFixture() : file(nullptr), buffer()
{
file = fopen("fwrite.out", "wb");
}
~FileFixture()
{
fclose(file);
remove("fwrite.out");
}
};
{
fwrite(buffer.data(), sizeof(uint8_t), context.x(), file);
context.metrics().AddBytes(context.x());
}
{
fwrite(buffer.data(), sizeof(uint8_t), context.x(), file);
fflush(file);
context.metrics().AddBytes(context.x());
}
Settings & ParamRange(int from, int to)
Add new single parameter range to the benchmark running plan.
CppBenchmark definitions.
#define BENCHMARK_FIXTURE(fixture,...)
Benchmark with fixture register macro.
#define BENCHMARK_MAIN()
Benchmark main entry point macro.