Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
histogram.h
Go to the documentation of this file.
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.
4 
5 #ifndef STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
6 #define STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
7 
8 #include <string>
9 
10 namespace leveldb {
11 
12 class Histogram {
13  public:
14  Histogram() { }
15  ~Histogram() { }
16 
17  void Clear();
18  void Add(double value);
19  void Merge(const Histogram& other);
20 
21  std::string ToString() const;
22 
23  private:
24  double min_;
25  double max_;
26  double num_;
27  double sum_;
28  double sum_squares_;
29 
30  enum { kNumBuckets = 154 };
31  static const double kBucketLimit[kNumBuckets];
33 
34  double Median() const;
35  double Percentile(double p) const;
36  double Average() const;
37  double StandardDeviation() const;
38 };
39 
40 } // namespace leveldb
41 
42 #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
double sum_squares_
Definition: histogram.h:28
void Merge(const Histogram &other)
Definition: histogram.cc:58
std::string * value
Definition: version_set.cc:270
double Percentile(double p) const
Definition: histogram.cc:73
static const double kBucketLimit[kNumBuckets]
Definition: histogram.h:31
std::string ToString() const
Definition: histogram.cc:105
double StandardDeviation() const
Definition: histogram.cc:99
double Median() const
Definition: histogram.cc:69
void Add(double value)
Definition: histogram.cc:44
double Average() const
Definition: histogram.cc:94
double buckets_[kNumBuckets]
Definition: histogram.h:32