diff options
author | Victor Costan <costan@google.com> | 2020-04-29 22:31:41 +0000 |
---|---|---|
committer | Victor Costan <costan@google.com> | 2020-04-29 22:33:14 +0000 |
commit | a6b3a2012e9c598258a295aef74d88b796c47a2b (patch) | |
tree | 2ce49183e6a860db3e29909409ea884a4bec56d0 /util/histogram.cc | |
parent | 3f934e3705444a3df80b128ddefc4cf440441ffe (diff) | |
download | leveldb-a6b3a2012e9c598258a295aef74d88b796c47a2b.tar.gz |
Add some std:: qualifiers to types and functions.
PiperOrigin-RevId: 309110431
Diffstat (limited to 'util/histogram.cc')
-rw-r--r-- | util/histogram.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/util/histogram.cc b/util/histogram.cc index d110d28..7af4030 100644 --- a/util/histogram.cc +++ b/util/histogram.cc @@ -241,11 +241,11 @@ double Histogram::StandardDeviation() const { std::string Histogram::ToString() const { std::string r; char buf[200]; - snprintf(buf, sizeof(buf), "Count: %.0f Average: %.4f StdDev: %.2f\n", num_, - Average(), StandardDeviation()); + std::snprintf(buf, sizeof(buf), "Count: %.0f Average: %.4f StdDev: %.2f\n", + num_, Average(), StandardDeviation()); r.append(buf); - snprintf(buf, sizeof(buf), "Min: %.4f Median: %.4f Max: %.4f\n", - (num_ == 0.0 ? 0.0 : min_), Median(), max_); + std::snprintf(buf, sizeof(buf), "Min: %.4f Median: %.4f Max: %.4f\n", + (num_ == 0.0 ? 0.0 : min_), Median(), max_); r.append(buf); r.append("------------------------------------------------------\n"); const double mult = 100.0 / num_; @@ -253,12 +253,12 @@ std::string Histogram::ToString() const { for (int b = 0; b < kNumBuckets; b++) { if (buckets_[b] <= 0.0) continue; sum += buckets_[b]; - snprintf(buf, sizeof(buf), "[ %7.0f, %7.0f ) %7.0f %7.3f%% %7.3f%% ", - ((b == 0) ? 0.0 : kBucketLimit[b - 1]), // left - kBucketLimit[b], // right - buckets_[b], // count - mult * buckets_[b], // percentage - mult * sum); // cumulative percentage + std::snprintf(buf, sizeof(buf), "[ %7.0f, %7.0f ) %7.0f %7.3f%% %7.3f%% ", + ((b == 0) ? 0.0 : kBucketLimit[b - 1]), // left + kBucketLimit[b], // right + buckets_[b], // count + mult * buckets_[b], // percentage + mult * sum); // cumulative percentage r.append(buf); // Add hash marks based on percentage; 20 marks for 100%. |