Add zlib to our builds and tweak histogram output

Summary:
$SUBJECT -- cosmetic fix for histograms, print P75/P99, and
make sure zlib is enabled for our command line tools.

Test Plan: compile, test db_bench with --compression_type=zlib

Reviewers: heyongqiang

Reviewed By: heyongqiang

CC: adsharma, leveldb

Differential Revision: https://reviews.facebook.net/D8445
This commit is contained in:
Chip Turner
2013-02-06 17:12:43 -08:00
parent b63aafce42
commit f02db1c118
2 changed files with 13 additions and 5 deletions

View File

@@ -150,6 +150,10 @@ std::string Histogram::ToString() const {
"Min: %.4f Median: %.4f Max: %.4f\n",
(num_ == 0.0 ? 0.0 : min_), Median(), max_);
r.append(buf);
snprintf(buf, sizeof(buf),
"Percentiles: P50: %.2f P75: %.2f P99: %.2f P99.9: %.2f\n",
Percentile(50), Percentile(75), Percentile(99), Percentile(99.9));
r.append(buf);
r.append("------------------------------------------------------\n");
const double mult = 100.0 / num_;
double sum = 0;
@@ -157,7 +161,7 @@ std::string Histogram::ToString() const {
if (buckets_[b] <= 0.0) continue;
sum += buckets_[b];
snprintf(buf, sizeof(buf),
"[ %ld, %ld ) %ld %7.3f%% %7.3f%% ",
"[ %7ld, %7ld ) %8ld %7.3f%% %7.3f%% ",
((b == 0) ? 0 : bucketMapper.BucketLimit(b-1)), // left
bucketMapper.BucketLimit(b), // right
buckets_[b], // count