folly icon indicating copy to clipboard operation
folly copied to clipboard

Support invoking a benchmark by name.

Open shiyu-bytedance opened this issue 2 years ago • 1 comments

Say I have:

BENCHMARK(Q1) {
 // blah
}

BENCHMARK(Q2) {
  // blah
}

BENCHMARK(Q3) {
  // blah
}

int main() {
   // In my main, I'd like pass arguments to control which benchmark to run
  
  for (auto name: FLAG_benchmark_to_run) {
     FOLLY_INVOKE_BENCHMARK_BY_NAME(name);
  }
}

For example, how do I support:

# This skips Q2
./my_benchmark --benchmark_to_run=Q1,Q3

Is there anything like FOLLY_INVOKE_BENCHMARK_BY_NAME available?

shiyu-bytedance avatar Oct 01 '22 03:10 shiyu-bytedance

Hi @shiyu-bytedance, folly has a --bm_regex flag built-in by default that lets you filter the benchmarks you want to run in a given a binary. More details here:

https://github.com/facebook/folly/blob/main/folly/Benchmark.cpp#L65

pedroerp avatar Oct 04 '22 02:10 pedroerp