| Index: components/metrics/histogram_encoder.cc
|
| diff --git a/components/metrics/histogram_encoder.cc b/components/metrics/histogram_encoder.cc
|
| index f816807db92eeda67c55a862fc7d101e12ae8e4f..595fb5398674c9321a543a0d3b83c9836357365f 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,9 @@ 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);
|
| + // Note: The default for count is 1 in the proto, so omit it in that case.
|
| + if (count != 1)
|
| + bucket->set_count(count);
|
| }
|
|
|
| // Omit fields to save space (see rules in histogram_event.proto comments).
|
|
|