Chromium Code Reviews| Index: components/metrics/histogram_encoder.cc |
| diff --git a/components/metrics/histogram_encoder.cc b/components/metrics/histogram_encoder.cc |
| index f816807db92eeda67c55a862fc7d101e12ae8e4f..58cd01c83b469d6db0bec12af419ff7eec540389 100644 |
| --- a/components/metrics/histogram_encoder.cc |
| +++ b/components/metrics/histogram_encoder.cc |
| @@ -25,7 +25,8 @@ void EncodeHistogramDelta(const std::string& histogram_name, |
| HistogramEventProto* histogram_proto = uma_proto->add_histogram_event(); |
| histogram_proto->set_name_hash(base::HashMetricName(histogram_name)); |
| - histogram_proto->set_sum(snapshot.sum()); |
| + if (snapshot.sum() != 0) |
| + histogram_proto->set_sum(snapshot.sum()); |
| for (scoped_ptr<SampleCountIterator> it = snapshot.Iterator(); !it->Done(); |
| it->Next()) { |
| @@ -36,7 +37,8 @@ void EncodeHistogramDelta(const std::string& histogram_name, |
| HistogramEventProto::Bucket* bucket = histogram_proto->add_bucket(); |
| bucket->set_min(min); |
| bucket->set_max(max); |
| - bucket->set_count(count); |
| + if (count != 1) |
|
rkaplow
2016/02/29 22:46:44
Might just add a comment that 1 is the default in
Alexei Svitkine (slow)
2016/02/29 22:55:53
Done.
|
| + bucket->set_count(count); |
| } |
| // Omit fields to save space (see rules in histogram_event.proto comments). |