小组成员: 曹可心-10223903406 朴祉燕-10224602413
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

44 rindas
925 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. void Merge(const Histogram& other);
  15. std::string ToString() const;
  16. private:
  17. enum { kNumBuckets = 154 };
  18. double Median() const;
  19. double Percentile(double p) const;
  20. double Average() const;
  21. double StandardDeviation() const;
  22. static const double kBucketLimit[kNumBuckets];
  23. double min_;
  24. double max_;
  25. double num_;
  26. double sum_;
  27. double sum_squares_;
  28. double buckets_[kNumBuckets];
  29. };
  30. } // namespace leveldb
  31. #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_