BENCHMARK_MULTI

Like BENCHMARK above, but allows the user to return the actual number of iterations executed in the function body. This can be useful if the benchmark function doesn't know upfront how many iterations it's going to run or if it runs through a certain number of test cases, e.g.:

Synopsis

Declared in <folly/Benchmark.h>

#define BENCHMARK_MULTI(name, ...)

Description

BENCHMARK_MULTI(benchmarkSomething) { std::vector<int> testCases { 0, 1, 1, 2, 3, 5 }; for (int c : testCases) { doSomething(c); } return testCases.size(); }

Parameters

NameDescription
nameThe benchmark's name, also used as its function identifier.