小组成员:10215300402-朱维清 & 10222140408 谷杰
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

41 rader
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_