Commit c046205c authored by Lucian Grijincu's avatar Lucian Grijincu Committed by facebook-github-bot-4

folly: ubsan: Benchmark: avoid division by zero (fsanitize=float-divide-by-zero)

Reviewed By: philippv

Differential Revision: D2886132

fb-gh-sync-id: a845d657fb920847df52fe5ec077e91554544f5b
parent cdadb047
......@@ -397,7 +397,9 @@ static void printBenchmarkResultsAsTable(
s.resize(columns - 29, ' ');
auto nsPerIter = get<2>(datum);
auto secPerIter = nsPerIter / 1E9;
auto itersPerSec = 1 / secPerIter;
auto itersPerSec = (secPerIter == 0)
? std::numeric_limits<double>::infinity()
: (1 / secPerIter);
if (!useBaseline) {
// Print without baseline
printf("%*s %9s %7s\n",
......
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