Fix copyright lines
[folly.git] / folly / stats / TimeseriesHistogram.h
index dd286b924e86943cbdbd82fefab1f62f495f378f..8443157591b6c6d0b05f273ab440378da62f8de0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2013-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@
 
 #pragma once
 
-#include <string>
 #include <folly/stats/Histogram.h>
 #include <folly/stats/MultiLevelTimeSeries.h>
+#include <string>
 
 namespace folly {
 
@@ -53,8 +53,8 @@ template <
     class C = folly::MultiLevelTimeSeries<T, CT>>
 class TimeseriesHistogram {
  private:
-   // NOTE: T must be equivalent to _signed_ numeric type for our math.
-   static_assert(std::numeric_limits<T>::is_signed, "");
+  // NOTE: T must be equivalent to _signed_ numeric type for our math.
+  static_assert(std::numeric_limits<T>::is_signed, "");
 
  public:
   // Values to be inserted into container
@@ -80,17 +80,26 @@ class TimeseriesHistogram {
    * @param defaultContainer a pre-initialized timeseries with the desired
    *                         number of levels and their durations.
    */
-  TimeseriesHistogram(ValueType bucketSize, ValueType min, ValueType max,
-                      const ContainerType& defaultContainer);
+  TimeseriesHistogram(
+      ValueType bucketSize,
+      ValueType min,
+      ValueType max,
+      const ContainerType& defaultContainer);
 
   /* Return the bucket size of each bucket in the histogram. */
-  ValueType getBucketSize() const { return buckets_.getBucketSize(); }
+  ValueType getBucketSize() const {
+    return buckets_.getBucketSize();
+  }
 
   /* Return the min value at which bucketing begins. */
-  ValueType getMin() const { return buckets_.getMin(); }
+  ValueType getMin() const {
+    return buckets_.getMin();
+  }
 
   /* Return the max value at which bucketing ends. */
-  ValueType getMax() const { return buckets_.getMax(); }
+  ValueType getMax() const {
+    return buckets_.getMax();
+  }
 
   /* Return the number of levels of the Timeseries object in each bucket */
   size_t getNumLevels() const {
@@ -135,7 +144,7 @@ class TimeseriesHistogram {
   }
 
   /* Total sum of values at the given timeseries level (all buckets). */
-  ValueType sum(int level) const {
+  ValueType sum(size_t level) const {
     ValueType total = ValueType();
     for (size_t b = 0; b < buckets_.getNumBuckets(); ++b) {
       total += buckets_.getByIndex(b).sum(level);
@@ -154,7 +163,7 @@ class TimeseriesHistogram {
 
   /* Average of values at the given timeseries level (all buckets). */
   template <typename ReturnType = double>
-  ReturnType avg(int level) const {
+  ReturnType avg(size_t level) const {
     auto total = ValueType();
     uint64_t nsamples = 0;
     computeAvgData(&total, &nsamples, level);
@@ -386,4 +395,4 @@ class TimeseriesHistogram {
   bool singleUniqueValue_;
   ValueType firstValue_;
 };
-}  // folly
+} // namespace folly