作者: 韩晨旭 10225101440 李畅 10225102463
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

41 líneas
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_