Split get_default() into two for deferred default construction
[folly.git] / folly / Benchmark.h
index cf11ca75b20b02ca67da3dfbaa4fdf198d3b14de..dbe12145ef79bd4c5dde046c6efa2bf4fcf1e1fe 100644 (file)
@@ -55,6 +55,19 @@ namespace detail {
 
 using TimeIterPair =
     std::pair<std::chrono::high_resolution_clock::duration, unsigned int>;
+using BenchmarkFun = std::function<detail::TimeIterPair(unsigned int)>;
+
+struct BenchmarkRegistration {
+  std::string file;
+  std::string name;
+  BenchmarkFun func;
+};
+
+struct BenchmarkResult {
+  std::string file;
+  std::string name;
+  double timeInNs;
+};
 
 /**
  * Adds a benchmark wrapped in a std::function. Only used
@@ -237,7 +250,7 @@ struct DoNotOptimizeAwayNeedsIndirect {
   constexpr static bool value = !folly::IsTriviallyCopyable<Decayed>::value ||
       sizeof(Decayed) > sizeof(long) || std::is_pointer<Decayed>::value;
 };
-} // detail namespace
+} // namespace detail
 
 template <typename T>
 auto doNotOptimizeAway(const T& datum) -> typename std::enable_if<
@@ -280,6 +293,20 @@ auto makeUnpredictable(T& datum) -> typename std::enable_if<
 
 #endif
 
+struct dynamic;
+
+void benchmarkResultsToDynamic(
+    const std::vector<detail::BenchmarkResult>& data,
+    dynamic&);
+
+void benchmarkResultsFromDynamic(
+    const dynamic&,
+    std::vector<detail::BenchmarkResult>&);
+
+void printResultComparison(
+    const std::vector<detail::BenchmarkResult>& base,
+    const std::vector<detail::BenchmarkResult>& test);
+
 } // namespace folly
 
 /**