Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent updates.

This implementation will be replaced by a faster one and sparse will be removed.

BUG=webrtc:5283

Review URL: https://codereview.webrtc.org/1530913002

Cr-Commit-Position: refs/heads/master@{#11099}
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index 9e56b37..f861139 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -253,12 +253,12 @@
       estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_;
   int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_;
   if (send_bitrate_kbps > 0) {
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
-                                send_bitrate_kbps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
+                                       send_bitrate_kbps);
   }
   if (pacer_bitrate_kbps > 0) {
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps",
-                                pacer_bitrate_kbps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.PacerBitrateInKbps",
+                                       pacer_bitrate_kbps);
   }
 }
 
@@ -273,18 +273,18 @@
   int video_bitrate_kbps = received_video_bytes_ * 8 / elapsed_sec / 1000;
   int rtcp_bitrate_bps = received_rtcp_bytes_ * 8 / elapsed_sec;
   if (video_bitrate_kbps > 0) {
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
-                                video_bitrate_kbps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
+                                       video_bitrate_kbps);
   }
   if (audio_bitrate_kbps > 0) {
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
-                                audio_bitrate_kbps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
+                                       audio_bitrate_kbps);
   }
   if (rtcp_bitrate_bps > 0) {
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
-                                rtcp_bitrate_bps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
+                                       rtcp_bitrate_bps);
   }
-  RTC_HISTOGRAM_COUNTS_100000(
+  RTC_HISTOGRAM_COUNTS_SPARSE_100000(
       "WebRTC.Call.BitrateReceivedInKbps",
       audio_bitrate_kbps + video_bitrate_kbps + rtcp_bitrate_bps / 1000);
 }
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
index 0572b26..b434da2 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
@@ -97,7 +97,7 @@
   if (value != last_value_ || first_time_) {
     first_time_ = false;
     last_value_ = value;
-    RTC_HISTOGRAM_COUNTS_100(histogram_name_, value);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100(histogram_name_, value);
   }
 }
 
diff --git a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
index e6a6fbf..8f87376 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
@@ -50,7 +50,7 @@
 }
 
 void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const {
-  RTC_HISTOGRAM_COUNTS(uma_name_, value, 1, max_value_, 50);
+  RTC_HISTOGRAM_COUNTS_SPARSE(uma_name_, value, 1, max_value_, 50);
 }
 
 StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount(
@@ -187,9 +187,9 @@
 }
 
 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) {
-  RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs",
-                       outage_duration_ms, 1 /* min */, 2000 /* max */,
-                       100 /* bucket count */);
+  RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.DelayedPacketOutageEventMs",
+                              outage_duration_ms, 1 /* min */, 2000 /* max */,
+                              100 /* bucket count */);
   delayed_packet_outage_counter_.RegisterSample();
 }
 
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index a332945..c0c5e8a 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -1346,8 +1346,9 @@
         capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms;
     if (diff_stream_delay_ms > kMinDiffDelayMs &&
         capture_.last_stream_delay_ms != 0) {
-      RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump",
-                           diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100);
+      RTC_HISTOGRAM_COUNTS_SPARSE(
+          "WebRTC.Audio.PlatformReportedStreamDelayJump", diff_stream_delay_ms,
+          kMinDiffDelayMs, 1000, 100);
       if (capture_.stream_delay_jumps == -1) {
         capture_.stream_delay_jumps = 0;  // Activate counter if needed.
       }
@@ -1364,9 +1365,9 @@
         aec_system_delay_ms - capture_.last_aec_system_delay_ms;
     if (diff_aec_system_delay_ms > kMinDiffDelayMs &&
         capture_.last_aec_system_delay_ms != 0) {
-      RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump",
-                           diff_aec_system_delay_ms, kMinDiffDelayMs, 1000,
-                           100);
+      RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.AecSystemDelayJump",
+                                  diff_aec_system_delay_ms, kMinDiffDelayMs,
+                                  1000, 100);
       if (capture_.aec_system_delay_jumps == -1) {
         capture_.aec_system_delay_jumps = 0;  // Activate counter if needed.
       }
@@ -1382,7 +1383,7 @@
   rtc::CritScope cs_capture(&crit_capture_);
 
   if (capture_.stream_delay_jumps > -1) {
-    RTC_HISTOGRAM_ENUMERATION(
+    RTC_HISTOGRAM_ENUMERATION_SPARSE(
         "WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps",
         capture_.stream_delay_jumps, 51);
   }
@@ -1390,8 +1391,8 @@
   capture_.last_stream_delay_ms = 0;
 
   if (capture_.aec_system_delay_jumps > -1) {
-    RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps",
-                              capture_.aec_system_delay_jumps, 51);
+    RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Audio.NumOfAecSystemDelayJumps",
+                                     capture_.aec_system_delay_jumps, 51);
   }
   capture_.aec_system_delay_jumps = -1;
   capture_.last_aec_system_delay_ms = 0;
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
index 96a3b47..258c4d9 100644
--- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
+++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
@@ -146,8 +146,8 @@
   for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) {
     if (!rampup_uma_stats_updated_[i] &&
         bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) {
-      RTC_HISTOGRAM_COUNTS_100000(kUmaRampupMetrics[i].metric_name,
-                                  now_ms - first_report_time_ms_);
+      RTC_HISTOGRAM_COUNTS_SPARSE_100000(kUmaRampupMetrics[i].metric_name,
+                                         now_ms - first_report_time_ms_);
       rampup_uma_stats_updated_[i] = true;
     }
   }
@@ -156,22 +156,19 @@
   } else if (uma_update_state_ == kNoUpdate) {
     uma_update_state_ = kFirstDone;
     bitrate_at_2_seconds_kbps_ = bitrate_kbps;
-    RTC_HISTOGRAM_COUNTS(
-        "WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50);
-    RTC_HISTOGRAM_COUNTS(
-        "WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, 2000, 50);
-    RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate",
-                         bitrate_at_2_seconds_kbps_,
-                         0,
-                         2000,
-                         50);
+    RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitiallyLostPackets",
+                                initially_lost_packets_, 0, 100, 50);
+    RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialRtt", static_cast<int>(rtt),
+                                0, 2000, 50);
+    RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialBandwidthEstimate",
+                                bitrate_at_2_seconds_kbps_, 0, 2000, 50);
   } else if (uma_update_state_ == kFirstDone &&
              now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) {
     uma_update_state_ = kDone;
     int bitrate_diff_kbps =
         std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0);
-    RTC_HISTOGRAM_COUNTS(
-        "WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 0, 2000, 50);
+    RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff",
+                                bitrate_diff_kbps, 0, 2000, 50);
   }
 }
 
diff --git a/webrtc/modules/video_coding/jitter_buffer.cc b/webrtc/modules/video_coding/jitter_buffer.cc
index a1142bb..a381880 100644
--- a/webrtc/modules/video_coding/jitter_buffer.cc
+++ b/webrtc/modules/video_coding/jitter_buffer.cc
@@ -281,17 +281,18 @@
     return;
   }
 
-  RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DiscardedPacketsInPercent",
-      num_discarded_packets_ * 100 / num_packets_);
-  RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DuplicatedPacketsInPercent",
-      num_duplicated_packets_ * 100 / num_packets_);
+  RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.DiscardedPacketsInPercent",
+                                  num_discarded_packets_ * 100 / num_packets_);
+  RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.DuplicatedPacketsInPercent",
+                                  num_duplicated_packets_ * 100 / num_packets_);
 
   int total_frames =
       receive_statistics_.key_frames + receive_statistics_.delta_frames;
   if (total_frames > 0) {
-    RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.CompleteFramesReceivedPerSecond",
+    RTC_HISTOGRAM_COUNTS_SPARSE_100(
+        "WebRTC.Video.CompleteFramesReceivedPerSecond",
         static_cast<int>((total_frames / elapsed_sec) + 0.5f));
-    RTC_HISTOGRAM_COUNTS_1000(
+    RTC_HISTOGRAM_COUNTS_SPARSE_1000(
         "WebRTC.Video.KeyFramesReceivedInPermille",
         static_cast<int>(
             (receive_statistics_.key_frames * 1000.0f / total_frames) + 0.5f));
diff --git a/webrtc/modules/video_coding/timing.cc b/webrtc/modules/video_coding/timing.cc
index f1a127a..d2563a4 100644
--- a/webrtc/modules/video_coding/timing.cc
+++ b/webrtc/modules/video_coding/timing.cc
@@ -62,14 +62,16 @@
   if (elapsed_sec < metrics::kMinRunTimeInSeconds) {
     return;
   }
-  RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.DecodedFramesPerSecond",
+  RTC_HISTOGRAM_COUNTS_SPARSE_100(
+      "WebRTC.Video.DecodedFramesPerSecond",
       static_cast<int>((num_decoded_frames_ / elapsed_sec) + 0.5f));
-  RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.DelayedFramesToRenderer",
+  RTC_HISTOGRAM_PERCENTAGE_SPARSE(
+      "WebRTC.Video.DelayedFramesToRenderer",
       num_delayed_decoded_frames_ * 100 / num_decoded_frames_);
   if (num_delayed_decoded_frames_ > 0) {
-    RTC_HISTOGRAM_COUNTS_1000(
+    RTC_HISTOGRAM_COUNTS_SPARSE_1000(
         "WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs",
-            sum_missed_render_deadline_ms_ / num_delayed_decoded_frames_);
+        sum_missed_render_deadline_ms_ / num_delayed_decoded_frames_);
   }
 }
 
diff --git a/webrtc/system_wrappers/include/metrics.h b/webrtc/system_wrappers/include/metrics.h
index 2e6e7b7..5e8ca11 100644
--- a/webrtc/system_wrappers/include/metrics.h
+++ b/webrtc/system_wrappers/include/metrics.h
@@ -69,44 +69,43 @@
 // Also consider changing string to const char* when switching to atomics.
 
 // Histogram for counters.
-#define RTC_HISTOGRAM_COUNTS_100(name, sample) RTC_HISTOGRAM_COUNTS( \
-    name, sample, 1, 100, 50)
+#define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \
+  RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50)
 
-#define RTC_HISTOGRAM_COUNTS_200(name, sample) RTC_HISTOGRAM_COUNTS( \
-    name, sample, 1, 200, 50)
+#define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) \
+  RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 200, 50)
 
-#define RTC_HISTOGRAM_COUNTS_1000(name, sample) RTC_HISTOGRAM_COUNTS( \
-    name, sample, 1, 1000, 50)
+#define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) \
+  RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 1000, 50)
 
-#define RTC_HISTOGRAM_COUNTS_10000(name, sample) RTC_HISTOGRAM_COUNTS( \
-    name, sample, 1, 10000, 50)
+#define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) \
+  RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 10000, 50)
 
-#define RTC_HISTOGRAM_COUNTS_100000(name, sample) RTC_HISTOGRAM_COUNTS( \
-    name, sample, 1, 100000, 50)
+#define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) \
+  RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100000, 50)
 
-#define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \
-    RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
-        webrtc::metrics::HistogramFactoryGetCounts( \
-            name, min, max, bucket_count))
+#define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \
+  RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
+      webrtc::metrics::HistogramFactoryGetCounts( \
+          name, min, max, bucket_count))
 
 // Histogram for percentage.
-#define RTC_HISTOGRAM_PERCENTAGE(name, sample) \
-    RTC_HISTOGRAM_ENUMERATION(name, sample, 101)
+#define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) \
+  RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, 101)
 
 // Histogram for enumerators.
 // |boundary| should be above the max enumerator sample.
-#define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \
-    RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
-        webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
+#define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) \
+  RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
+      webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
 
-#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \
-                                   factory_get_invocation) \
+#define RTC_HISTOGRAM_COMMON_BLOCK_SLOW(constant_name, sample, \
+                                        factory_get_invocation) \
   do { \
     webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \
     webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \
   } while (0)
 
-
 namespace webrtc {
 namespace metrics {
 
diff --git a/webrtc/video/receive_statistics_proxy.cc b/webrtc/video/receive_statistics_proxy.cc
index c13c807..d6ab4ff 100644
--- a/webrtc/video/receive_statistics_proxy.cc
+++ b/webrtc/video/receive_statistics_proxy.cc
@@ -37,37 +37,39 @@
 void ReceiveStatisticsProxy::UpdateHistograms() {
   int fraction_lost = report_block_stats_.FractionLostInPercent();
   if (fraction_lost != -1) {
-    RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
-        fraction_lost);
+    RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.ReceivedPacketsLostInPercent",
+                                    fraction_lost);
   }
   const int kMinRequiredSamples = 200;
   int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
   if (samples > kMinRequiredSamples) {
-    RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond",
+    RTC_HISTOGRAM_COUNTS_SPARSE_100("WebRTC.Video.RenderFramesPerSecond",
         round(render_fps_tracker_.ComputeTotalRate()));
-    RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.RenderSqrtPixelsPerSecond",
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000("WebRTC.Video.RenderSqrtPixelsPerSecond",
         round(render_pixel_tracker_.ComputeTotalRate()));
   }
   int width = render_width_counter_.Avg(kMinRequiredSamples);
   int height = render_height_counter_.Avg(kMinRequiredSamples);
   if (width != -1) {
-    RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width);
-    RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.ReceivedWidthInPixels",
+                                      width);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.ReceivedHeightInPixels",
+                                      height);
   }
   int qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
   if (qp != -1)
-    RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp);
+    RTC_HISTOGRAM_COUNTS_SPARSE_200("WebRTC.Video.Decoded.Vp8.Qp", qp);
 
   // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and
   // not per frame. Change decode time to include every frame.
   const int kMinRequiredDecodeSamples = 5;
   int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples);
   if (decode_ms != -1)
-    RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
+    RTC_HISTOGRAM_COUNTS_SPARSE_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
 
   int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples);
   if (delay_ms != -1)
-    RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
 }
 
 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index c198ad2..0a84439 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -57,7 +57,7 @@
 }
 
 void UpdateCodecTypeHistogram(const std::string& payload_name) {
-  RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType",
+  RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Video.Encoder.CodecType",
       PayloadNameToHistogramCodecType(payload_name), kVideoMax);
 }
 }  // namespace
@@ -98,56 +98,63 @@
   int in_height = input_height_counter_.Avg(kMinRequiredSamples);
   int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate());
   if (in_width != -1) {
-    RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width);
-    RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height);
-    RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputWidthInPixels",
+                                      in_width);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputHeightInPixels",
+                                      in_height);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "InputFramesPerSecond",
+                                    in_fps);
   }
   int sent_width = sent_width_counter_.Avg(kMinRequiredSamples);
   int sent_height = sent_height_counter_.Avg(kMinRequiredSamples);
   int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate());
   if (sent_width != -1) {
-    RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width);
-    RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height);
-    RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentWidthInPixels",
+                                      sent_width);
+    RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentHeightInPixels",
+                                      sent_height);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "SentFramesPerSecond",
+                                    sent_fps);
   }
   int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
   if (encode_ms != -1)
-    RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms);
+    RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms);
 
   int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
   if (key_frames_permille != -1) {
-    RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille",
-                              key_frames_permille);
+    RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "KeyFramesSentInPermille",
+                                     key_frames_permille);
   }
   int quality_limited =
       quality_limited_frame_counter_.Percent(kMinRequiredSamples);
   if (quality_limited != -1) {
-    RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent",
-                             quality_limited);
+    RTC_HISTOGRAM_PERCENTAGE_SPARSE(
+        uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited);
   }
   int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples);
   if (downscales != -1) {
-    RTC_HISTOGRAM_ENUMERATION(
+    RTC_HISTOGRAM_ENUMERATION_SPARSE(
         uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20);
   }
   int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples);
   if (bw_limited != -1) {
-    RTC_HISTOGRAM_PERCENTAGE(
+    RTC_HISTOGRAM_PERCENTAGE_SPARSE(
         uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited);
   }
   int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples);
   if (num_disabled != -1) {
-    RTC_HISTOGRAM_ENUMERATION(
+    RTC_HISTOGRAM_ENUMERATION_SPARSE(
         uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10);
   }
   int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
   if (delay_ms != -1)
-    RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs",
+                                       delay_ms);
 
   int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
   if (max_delay_ms != -1) {
-    RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs",
-                                max_delay_ms);
+    RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs",
+                                       max_delay_ms);
   }
 }
 
diff --git a/webrtc/video/vie_channel.cc b/webrtc/video/vie_channel.cc
index e39ffbf..401cba8 100644
--- a/webrtc/video/vie_channel.cc
+++ b/webrtc/video/vie_channel.cc
@@ -202,7 +202,7 @@
     if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 &&
         elapsed_sec > metrics::kMinRunTimeInSeconds) {
       int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_;
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
     }
   }
@@ -212,21 +212,24 @@
     GetSendRtcpPacketTypeCounter(&rtcp_counter);
     int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
     if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute",
-                                 rtcp_counter.nack_packets * 60 / elapsed_sec);
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute",
-                                 rtcp_counter.fir_packets * 60 / elapsed_sec);
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute",
-                                 rtcp_counter.pli_packets * 60 / elapsed_sec);
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.NackPacketsReceivedPerMinute",
+          rtcp_counter.nack_packets * 60 / elapsed_sec);
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.FirPacketsReceivedPerMinute",
+          rtcp_counter.fir_packets * 60 / elapsed_sec);
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.PliPacketsReceivedPerMinute",
+          rtcp_counter.pli_packets * 60 / elapsed_sec);
       if (rtcp_counter.nack_requests > 0) {
-        RTC_HISTOGRAM_PERCENTAGE(
+        RTC_HISTOGRAM_PERCENTAGE_SPARSE(
             "WebRTC.Video.UniqueNackRequestsReceivedInPercent",
             rtcp_counter.UniqueNackRequestsInPercent());
       }
       int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
       if (fraction_lost != -1) {
-        RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
-                                 fraction_lost);
+        RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.SentPacketsLostInPercent",
+                                        fraction_lost);
       }
     }
 
@@ -239,23 +242,23 @@
                       Clock::GetRealTimeClock()->TimeInMilliseconds()) /
                   1000;
     if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
-      RTC_HISTOGRAM_COUNTS_100000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_100000(
           "WebRTC.Video.BitrateSentInKbps",
           static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
                            1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.MediaBitrateSentInKbps",
           static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.PaddingBitrateSentInKbps",
           static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
                            1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.RetransmittedBitrateSentInKbps",
           static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
                            elapsed_sec / 1000));
       if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) {
-        RTC_HISTOGRAM_COUNTS_10000(
+        RTC_HISTOGRAM_COUNTS_SPARSE_10000(
             "WebRTC.Video.RtxBitrateSentInKbps",
             static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
                              1000));
@@ -266,9 +269,10 @@
       rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red,
                                              &pltype_fec);
       if (fec_enabled) {
-        RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps",
-                                   static_cast<int>(rtp_rtx.fec.TotalBytes() *
-                                                    8 / elapsed_sec / 1000));
+        RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+            "WebRTC.Video.FecBitrateSentInKbps",
+            static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
+                             1000));
       }
     }
   } else if (vie_receiver_.GetRemoteSsrc() > 0) {
@@ -278,14 +282,18 @@
     GetReceiveRtcpPacketTypeCounter(&rtcp_counter);
     int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
     if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute",
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.NackPacketsSentPerMinute",
           rtcp_counter.nack_packets * 60 / elapsed_sec);
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute",
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.FirPacketsSentPerMinute",
           rtcp_counter.fir_packets * 60 / elapsed_sec);
-      RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute",
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+          "WebRTC.Video.PliPacketsSentPerMinute",
           rtcp_counter.pli_packets * 60 / elapsed_sec);
       if (rtcp_counter.nack_requests > 0) {
-        RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent",
+        RTC_HISTOGRAM_PERCENTAGE_SPARSE(
+            "WebRTC.Video.UniqueNackRequestsSentInPercent",
             rtcp_counter.UniqueNackRequestsInPercent());
       }
     }
@@ -297,32 +305,33 @@
     rtp_rtx.Add(rtx);
     elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000;
     if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.BitrateReceivedInKbps",
           static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
                            1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.MediaBitrateReceivedInKbps",
           static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.PaddingBitrateReceivedInKbps",
           static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
                            1000));
-      RTC_HISTOGRAM_COUNTS_10000(
+      RTC_HISTOGRAM_COUNTS_SPARSE_10000(
           "WebRTC.Video.RetransmittedBitrateReceivedInKbps",
           static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
                            elapsed_sec / 1000));
       uint32_t ssrc = 0;
       if (vie_receiver_.GetRtxSsrc(&ssrc)) {
-        RTC_HISTOGRAM_COUNTS_10000(
+        RTC_HISTOGRAM_COUNTS_SPARSE_10000(
             "WebRTC.Video.RtxBitrateReceivedInKbps",
             static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
                              1000));
       }
       if (vie_receiver_.IsFecEnabled()) {
-        RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps",
-                                   static_cast<int>(rtp_rtx.fec.TotalBytes() *
-                                                    8 / elapsed_sec / 1000));
+        RTC_HISTOGRAM_COUNTS_SPARSE_10000(
+            "WebRTC.Video.FecBitrateReceivedInKbps",
+            static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
+                             1000));
       }
     }
   }
diff --git a/webrtc/video/vie_receiver.cc b/webrtc/video/vie_receiver.cc
index 98c8c5d..4fb706c 100644
--- a/webrtc/video/vie_receiver.cc
+++ b/webrtc/video/vie_receiver.cc
@@ -68,14 +68,15 @@
 void ViEReceiver::UpdateHistograms() {
   FecPacketCounter counter = fec_receiver_->GetPacketCounter();
   if (counter.num_packets > 0) {
-    RTC_HISTOGRAM_PERCENTAGE(
+    RTC_HISTOGRAM_PERCENTAGE_SPARSE(
         "WebRTC.Video.ReceivedFecPacketsInPercent",
         static_cast<int>(counter.num_fec_packets * 100 / counter.num_packets));
   }
   if (counter.num_fec_packets > 0) {
-    RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.RecoveredMediaPacketsInPercentOfFec",
-                             static_cast<int>(counter.num_recovered_packets *
-                                              100 / counter.num_fec_packets));
+    RTC_HISTOGRAM_PERCENTAGE_SPARSE(
+        "WebRTC.Video.RecoveredMediaPacketsInPercentOfFec",
+        static_cast<int>(counter.num_recovered_packets * 100 /
+                         counter.num_fec_packets));
   }
 }