test: Add multidict to support dictionary with duplicate key (laanwj)
[bitcoinplatinum.git] / src / leveldb / util / histogram.h
blob1ef9f3c8abdfc50858be433110611086bb3c0da6
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
5 #ifndef STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
6 #define STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
8 #include <string>
10 namespace leveldb {
12 class Histogram {
13 public:
14 Histogram() { }
15 ~Histogram() { }
17 void Clear();
18 void Add(double value);
19 void Merge(const Histogram& other);
21 std::string ToString() const;
23 private:
24 double min_;
25 double max_;
26 double num_;
27 double sum_;
28 double sum_squares_;
30 enum { kNumBuckets = 154 };
31 static const double kBucketLimit[kNumBuckets];
32 double buckets_[kNumBuckets];
34 double Median() const;
35 double Percentile(double p) const;
36 double Average() const;
37 double StandardDeviation() const;
40 } // namespace leveldb
42 #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_