10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 line
865 B

  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. #ifndef STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
  5. #define STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
  6. #include <string>
  7. namespace leveldb {
  8. class Histogram {
  9. public:
  10. Histogram() { }
  11. ~Histogram() { }
  12. void Clear();
  13. void Add(double value);
  14. std::string ToString() const;
  15. private:
  16. double min_;
  17. double max_;
  18. double num_;
  19. double sum_;
  20. double sum_squares_;
  21. enum { kNumBuckets = 154 };
  22. static const double kBucketLimit[kNumBuckets];
  23. double buckets_[kNumBuckets];
  24. double Median() const;
  25. double Percentile(double p) const;
  26. double Average() const;
  27. double StandardDeviation() const;
  28. };
  29. }
  30. #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_