Commit 37f21767 authored by Jatin Kumar's avatar Jatin Kumar Committed by Facebook Github Bot

Warn when running benchmark in DEBUG mode

Summary:
Cognitive overhead of remembering to use mode/opt while running
benchmarks is just too much and easy to forget.

Adding a warning message at the bottom of the benchmark result output so
that the user gets a signal.

Reviewed By: yfeldblum

Differential Revision: D10274914

fbshipit-source-id: a84932fa16744da9bd025ed5b01df14f95550145
parent 4d657866
......@@ -445,9 +445,19 @@ void printResultComparison(
separator('=');
}
void checkRunMode() {
if (folly::kIsDebug || folly::kIsSanitize) {
std::cerr << "WARNING: Benchmark running "
<< (folly::kIsDebug ? "in DEBUG mode" : "with SANITIZERS")
<< std::endl;
}
}
void runBenchmarks() {
CHECK(!benchmarks().empty());
checkRunMode();
vector<detail::BenchmarkResult> results;
results.reserve(benchmarks().size() - 1);
......@@ -490,6 +500,8 @@ void runBenchmarks() {
} else {
printer.separator('=');
}
checkRunMode();
}
} // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment