Add MockTimeoutManager
[folly.git] / folly / Benchmark.cpp
index aef1250b434af1dfc08e6922db9c00bd0c808b23..b1296aa74def106383af5d40c4de7892593e8c08 100644 (file)
@@ -226,7 +226,7 @@ static double runBenchmarkGetNSPerIteration(const BenchmarkFun& fun,
   // They key here is accuracy; too low numbers means the accuracy was
   // coarse. We up the ante until we get to at least minNanoseconds
   // timings.
-  static uint64_t resolutionInNs = 0, coarseResolutionInNs = 0;
+  static uint64_t resolutionInNs = 0;
   if (!resolutionInNs) {
     timespec ts;
     CHECK_EQ(0, clock_getres(detail::DEFAULT_CLOCK_ID, &ts));
@@ -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",