Introduce histogram in statistics.h

Summary:
* Introduce is histogram in statistics.h
* stop watch to measure time.
* introduce two timers as a poc.
Replaced NULL with nullptr to fight some lint errors
Should be useful for google.

Test Plan:
ran db_bench and check stats.
make all check

Reviewers: dhruba, heyongqiang

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D8637
This commit is contained in:
Abhishek Kona
2013-02-15 11:53:17 -08:00
parent 61a3e6755d
commit fe10200ddc
9 changed files with 322 additions and 146 deletions

View File

@@ -8,7 +8,7 @@ class HistogramTest { };
TEST(HistogramTest, BasicOperation) {
Histogram histogram;
HistogramImpl histogram;
for (uint64_t i = 1; i <= 100; i++) {
histogram.Add(i);
}
@@ -33,14 +33,14 @@ TEST(HistogramTest, BasicOperation) {
}
TEST(HistogramTest, EmptyHistogram) {
Histogram histogram;
HistogramImpl histogram;
ASSERT_EQ(histogram.Median(), 0.0);
ASSERT_EQ(histogram.Percentile(85.0), 0.0);
ASSERT_EQ(histogram.Average(), 0.0);
}
TEST(HistogramTest, ClearHistogram) {
Histogram histogram;
HistogramImpl histogram;
for (uint64_t i = 1; i <= 100; i++) {
histogram.Add(i);
}