Histogram function to write tab-separated values.
[folly.git] / folly / Histogram.h
index 302739944487baf43c288e4200ccae1dd879e6c2..fb72145047558f86f0e0b694d79b4ee3ee3208a6 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <cstddef>
 #include <limits>
+#include <ostream>
 #include <string>
 #include <vector>
 #include <stdexcept>
@@ -367,6 +368,12 @@ class Histogram {
    */
   std::string debugString() const;
 
+  /*
+   * Write the histogram contents in tab-separated values (TSV) format.
+   * Format is "min max count sum".
+   */
+  void toTSV(std::ostream& out, bool skipEmptyBuckets = true) const;
+
  private:
   struct CountFromBucket {
     uint64_t operator()(const Bucket& bucket) const {