Chromium Code Reviews| Index: base/metrics/histogram.cc |
| diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc |
| index 09f0bbb67131e84417f8493971f52aa6603b06af..1f6a955f86637ae0942e248dbb791179d305e7e7 100644 |
| --- a/base/metrics/histogram.cc |
| +++ b/base/metrics/histogram.cc |
| @@ -400,6 +400,13 @@ bool Histogram::InspectConstructionArguments(const std::string& name, |
| check_okay = false; |
| *bucket_count = 3; |
| } |
| + // Very high bucket counts are wasteful. Use a sparse histogram instead. |
| + // Value of 10002 equals a user-supplied value of 10k + 2 overflow buckets. |
| + constexpr uint32_t kMaxBucketCount = 10002; |
|
bcwhite
2017/05/25 19:21:41
Even 10k sounds really, really large.
Alexei Svitkine (slow)
2017/05/25 19:24:04
Yeah agreed. There was a unit test that was using
|
| + if (*bucket_count > kMaxBucketCount) { |
| + check_okay = false; |
| + *bucket_count = kMaxBucketCount; |
| + } |
| if (*bucket_count > static_cast<uint32_t>(*maximum - *minimum + 2)) { |
| check_okay = false; |
| *bucket_count = static_cast<uint32_t>(*maximum - *minimum + 2); |