diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc index 001937a217..872579bac3 100644 --- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc +++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc @@ -155,8 +155,8 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { if (!rampup_uma_stats_updated_[i] && bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { - RTC_HISTOGRAM_COUNTS_SPARSE_100000(kUmaRampupMetrics[i].metric_name, - now_ms - first_report_time_ms_); + RTC_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, + now_ms - first_report_time_ms_); rampup_uma_stats_updated_[i] = true; } } diff --git a/webrtc/system_wrappers/include/metrics.h b/webrtc/system_wrappers/include/metrics.h index ce193bdc39..a7184a5ae3 100644 --- a/webrtc/system_wrappers/include/metrics.h +++ b/webrtc/system_wrappers/include/metrics.h @@ -187,8 +187,6 @@ #define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \ do { \ - RTC_DCHECK(index >= 0); \ - RTC_DCHECK(index <= 2); \ switch (index) { \ case 0: \ macro_invocation; \ diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 83399a9013..7371111066 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -31,12 +31,15 @@ enum HistogramCodecType { kVideoMax = 64, }; +const char* kRealtimePrefix = "WebRTC.Video."; +const char* kScreenPrefix = "WebRTC.Video.Screenshare."; + const char* GetUmaPrefix(VideoEncoderConfig::ContentType content_type) { switch (content_type) { case VideoEncoderConfig::ContentType::kRealtimeVideo: - return "WebRTC.Video."; + return kRealtimePrefix; case VideoEncoderConfig::ContentType::kScreen: - return "WebRTC.Video.Screenshare."; + return kScreenPrefix; } RTC_NOTREACHED(); return nullptr; @@ -93,68 +96,75 @@ SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { } void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { + RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); + const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; const int kMinRequiredSamples = 200; int in_width = input_width_counter_.Avg(kMinRequiredSamples); int in_height = input_height_counter_.Avg(kMinRequiredSamples); int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); if (in_width != -1) { - 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); + RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputWidthInPixels", + in_width); + RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputHeightInPixels", + in_height); + RTC_HISTOGRAMS_COUNTS_100(kIndex, 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_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); + RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentWidthInPixels", + sent_width); + RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentHeightInPixels", + sent_height); + RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "SentFramesPerSecond", + sent_fps); } int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); - if (encode_ms != -1) - RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); - + if (encode_ms != -1) { + RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", + encode_ms); + } int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); if (key_frames_permille != -1) { - RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "KeyFramesSentInPermille", - key_frames_permille); + RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", + key_frames_permille); } int quality_limited = quality_limited_frame_counter_.Percent(kMinRequiredSamples); if (quality_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE_SPARSE( - uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited); + RTC_HISTOGRAMS_PERCENTAGE(kIndex, + uma_prefix_ + "QualityLimitedResolutionInPercent", + quality_limited); } int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); if (downscales != -1) { - RTC_HISTOGRAM_ENUMERATION_SPARSE( - uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); + RTC_HISTOGRAMS_ENUMERATION( + kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, + 20); } int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); if (bw_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE_SPARSE( - uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); + RTC_HISTOGRAMS_PERCENTAGE( + kIndex, uma_prefix_ + "BandwidthLimitedResolutionInPercent", + bw_limited); } int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); if (num_disabled != -1) { - RTC_HISTOGRAM_ENUMERATION_SPARSE( - uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); + RTC_HISTOGRAMS_ENUMERATION( + kIndex, uma_prefix_ + "BandwidthLimitedResolutionsDisabled", + num_disabled, 10); } int delay_ms = delay_counter_.Avg(kMinRequiredSamples); if (delay_ms != -1) - RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs", - delay_ms); + RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", + delay_ms); int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); if (max_delay_ms != -1) { - RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs", - max_delay_ms); + RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", + max_delay_ms); } }