diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc index 5f9eb3fd93..91c27c80ad 100644 --- a/webrtc/call/call.cc +++ b/webrtc/call/call.cc @@ -272,12 +272,12 @@ void Call::UpdateSendHistograms() { 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_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", + send_bitrate_kbps); } if (pacer_bitrate_kbps > 0) { - RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps", - pacer_bitrate_kbps); + RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps", + pacer_bitrate_kbps); } } @@ -292,18 +292,18 @@ void Call::UpdateReceiveHistograms() { 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_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps", + video_bitrate_kbps); } if (audio_bitrate_kbps > 0) { - RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps", - audio_bitrate_kbps); + RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps", + audio_bitrate_kbps); } if (rtcp_bitrate_bps > 0) { - RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps", - rtcp_bitrate_bps); + RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps", + rtcp_bitrate_bps); } - RTC_HISTOGRAM_COUNTS_100000( + RTC_LOGGED_HISTOGRAM_COUNTS_100000( "WebRTC.Call.BitrateReceivedInKbps", audio_bitrate_kbps + video_bitrate_kbps + rtcp_bitrate_bps / 1000); } diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc index 872579bac3..785267d8c9 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_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, - now_ms - first_report_time_ms_); + RTC_LOGGED_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, + now_ms - first_report_time_ms_); rampup_uma_stats_updated_[i] = true; } } @@ -165,19 +165,19 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, } 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(rtt), 0, - 2000, 50); - RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", - bitrate_at_2_seconds_kbps_, 0, 2000, 50); + RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets", + initially_lost_packets_, 0, 100, 50); + RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast(rtt), + 0, 2000, 50); + RTC_LOGGED_HISTOGRAM_COUNTS("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_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", + bitrate_diff_kbps, 0, 2000, 50); } } diff --git a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc index 869657b972..2b7f7195d5 100644 --- a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc +++ b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc @@ -315,14 +315,14 @@ void ScreenshareLayers::UpdateHistograms() { "WebRTC.Video.Screenshare.Layer1.FrameRate", (stats_.num_tl1_frames_ + (duration_sec / 2)) / duration_sec); int total_frames = stats_.num_tl0_frames_ + stats_.num_tl1_frames_; - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.FramesPerDrop", - stats_.num_dropped_frames_ == 0 - ? 0 - : total_frames / stats_.num_dropped_frames_); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.FramesPerOvershoot", - stats_.num_overshoots_ == 0 - ? 0 - : total_frames / stats_.num_overshoots_); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.Screenshare.FramesPerDrop", + (stats_.num_dropped_frames_ == 0 ? 0 : total_frames / + stats_.num_dropped_frames_)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.Screenshare.FramesPerOvershoot", + (stats_.num_overshoots_ == 0 ? 0 + : total_frames / stats_.num_overshoots_)); if (stats_.num_tl0_frames_ > 0) { RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.Layer0.Qp", stats_.tl0_qp_sum_ / stats_.num_tl0_frames_); diff --git a/webrtc/modules/video_coding/jitter_buffer.cc b/webrtc/modules/video_coding/jitter_buffer.cc index a3e0b2bc07..f048b0a883 100644 --- a/webrtc/modules/video_coding/jitter_buffer.cc +++ b/webrtc/modules/video_coding/jitter_buffer.cc @@ -301,18 +301,18 @@ void VCMJitterBuffer::UpdateHistograms() { 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_LOGGED_HISTOGRAM_PERCENTAGE("WebRTC.Video.DiscardedPacketsInPercent", + num_discarded_packets_ * 100 / num_packets_); + RTC_LOGGED_HISTOGRAM_PERCENTAGE("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( + RTC_LOGGED_HISTOGRAM_COUNTS_100( "WebRTC.Video.CompleteFramesReceivedPerSecond", static_cast((total_frames / elapsed_sec) + 0.5f)); - RTC_HISTOGRAM_COUNTS_1000( + RTC_LOGGED_HISTOGRAM_COUNTS_1000( "WebRTC.Video.KeyFramesReceivedInPermille", static_cast( (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 91f5f8423c..6542ef5b15 100644 --- a/webrtc/modules/video_coding/timing.cc +++ b/webrtc/modules/video_coding/timing.cc @@ -62,14 +62,14 @@ void VCMTiming::UpdateHistograms() const { if (elapsed_sec < metrics::kMinRunTimeInSeconds) { return; } - RTC_HISTOGRAM_COUNTS_100( + RTC_LOGGED_HISTOGRAM_COUNTS_100( "WebRTC.Video.DecodedFramesPerSecond", static_cast((num_decoded_frames_ / elapsed_sec) + 0.5f)); - RTC_HISTOGRAM_PERCENTAGE( + RTC_LOGGED_HISTOGRAM_PERCENTAGE( "WebRTC.Video.DelayedFramesToRenderer", num_delayed_decoded_frames_ * 100 / num_decoded_frames_); if (num_delayed_decoded_frames_ > 0) { - RTC_HISTOGRAM_COUNTS_1000( + RTC_LOGGED_HISTOGRAM_COUNTS_1000( "WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs", 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 b0a77c8711..2c04c11bdf 100644 --- a/webrtc/system_wrappers/include/metrics.h +++ b/webrtc/system_wrappers/include/metrics.h @@ -15,6 +15,7 @@ #include "webrtc/base/atomicops.h" #include "webrtc/base/checks.h" +#include "webrtc/base/logging.h" #include "webrtc/common_types.h" // Macros for allowing WebRTC clients (e.g. Chrome) to gather and aggregate @@ -78,7 +79,27 @@ RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50) #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ + webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) + +// RTC_HISTOGRAM_COUNTS with logging. +#define RTC_LOGGED_HISTOGRAM_COUNTS_100(name, sample) \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100, 50) + +#define RTC_LOGGED_HISTOGRAM_COUNTS_200(name, sample) \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 200, 50) + +#define RTC_LOGGED_HISTOGRAM_COUNTS_1000(name, sample) \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50) + +#define RTC_LOGGED_HISTOGRAM_COUNTS_10000(name, sample) \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50) + +#define RTC_LOGGED_HISTOGRAM_COUNTS_100000(name, sample) \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50) + +#define RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \ webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) // Deprecated. @@ -94,17 +115,29 @@ #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ RTC_HISTOGRAM_ENUMERATION(name, sample, 101) +// RTC_HISTOGRAM_PERCENTAGE with logging. +#define RTC_LOGGED_HISTOGRAM_PERCENTAGE(name, sample) \ + RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, 101) + // Histogram for enumerators (evenly spaced buckets). // |boundary| should be above the max enumerator sample. #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ + webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) + +// RTC_HISTOGRAM_ENUMERATION with logging. +#define RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, boundary) \ + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \ webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) // The name of the histogram should not vary. // TODO(asapersson): Consider changing string to const char*. -#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ +#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, log, \ factory_get_invocation) \ do { \ + if (log) { \ + LOG(LS_INFO) << constant_name << " " << sample; \ + } \ static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \ webrtc::metrics::Histogram* histogram_pointer = \ rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \ @@ -162,6 +195,35 @@ RTC_HISTOGRAMS_COMMON(index, name, sample, \ RTC_HISTOGRAM_PERCENTAGE(name, sample)) +// RTC_HISTOGRAMS_COUNTS with logging. +#define RTC_LOGGED_HISTOGRAMS_COUNTS_100(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100, 50)) + +#define RTC_LOGGED_HISTOGRAMS_COUNTS_200(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 200, 50)) + +#define RTC_LOGGED_HISTOGRAMS_COUNTS_1000(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50)) + +#define RTC_LOGGED_HISTOGRAMS_COUNTS_10000(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50)) + +#define RTC_LOGGED_HISTOGRAMS_COUNTS_100000(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50)) + +#define RTC_LOGGED_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, boundary)) + +#define RTC_LOGGED_HISTOGRAMS_PERCENTAGE(index, name, sample) \ + RTC_HISTOGRAMS_COMMON(index, name, sample, \ + RTC_LOGGED_HISTOGRAM_PERCENTAGE(name, sample)) + #define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \ do { \ switch (index) { \ diff --git a/webrtc/video/call_stats.cc b/webrtc/video/call_stats.cc index 8874c2b631..a1bf221d4e 100644 --- a/webrtc/video/call_stats.cc +++ b/webrtc/video/call_stats.cc @@ -181,7 +181,7 @@ void CallStats::UpdateHistograms() { (clock_->TimeInMilliseconds() - time_of_first_rtt_ms_) / 1000; if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { int64_t avg_rtt_ms = (sum_avg_rtt_ms_ + num_avg_rtt_ / 2) / num_avg_rtt_; - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); } } diff --git a/webrtc/video/receive_statistics_proxy.cc b/webrtc/video/receive_statistics_proxy.cc index b5e9ab0734..1164a0ceed 100644 --- a/webrtc/video/receive_statistics_proxy.cc +++ b/webrtc/video/receive_statistics_proxy.cc @@ -41,23 +41,26 @@ ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { void ReceiveStatisticsProxy::UpdateHistograms() { int fraction_lost = report_block_stats_.FractionLostInPercent(); if (fraction_lost != -1) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", - fraction_lost); + RTC_LOGGED_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", + fraction_lost); } const int kMinRequiredSamples = 200; int samples = static_cast(render_fps_tracker_.TotalSampleCount()); if (samples > kMinRequiredSamples) { - RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", - round(render_fps_tracker_.ComputeTotalRate())); - RTC_HISTOGRAM_COUNTS_100000( + RTC_LOGGED_HISTOGRAM_COUNTS_100( + "WebRTC.Video.RenderFramesPerSecond", + round(render_fps_tracker_.ComputeTotalRate())); + RTC_LOGGED_HISTOGRAM_COUNTS_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_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", + width); + RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", + height); } int sync_offset_ms = sync_offset_counter_.Avg(kMinRequiredSamples); if (sync_offset_ms != -1) @@ -65,18 +68,18 @@ void ReceiveStatisticsProxy::UpdateHistograms() { int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); if (qp != -1) - RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); + RTC_LOGGED_HISTOGRAM_COUNTS_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_LOGGED_HISTOGRAM_COUNTS_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_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); StreamDataCounters rtp = stats_.rtp_stats; StreamDataCounters rtx; @@ -87,41 +90,43 @@ void ReceiveStatisticsProxy::UpdateHistograms() { int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; if (elapsed_sec > metrics::kMinRunTimeInSeconds) { - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.BitrateReceivedInKbps", static_cast(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.MediaBitrateReceivedInKbps", static_cast(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.PaddingBitrateReceivedInKbps", static_cast(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.RetransmittedBitrateReceivedInKbps", static_cast(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 1000)); if (!rtx_stats_.empty()) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateReceivedInKbps", - static_cast(rtx.transmitted.TotalBytes() * - 8 / elapsed_sec / 1000)); + RTC_LOGGED_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.RtxBitrateReceivedInKbps", + static_cast(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / + 1000)); } if (config_.rtp.fec.ulpfec_payload_type != -1) { - RTC_HISTOGRAM_COUNTS_10000( + RTC_LOGGED_HISTOGRAM_COUNTS_10000( "WebRTC.Video.FecBitrateReceivedInKbps", static_cast(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); } const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", - counters.nack_packets * 60 / elapsed_sec); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", - counters.fir_packets * 60 / elapsed_sec); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", - counters.pli_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", + counters.nack_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", + counters.fir_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", + counters.pli_packets * 60 / elapsed_sec); if (counters.nack_requests > 0) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", - counters.UniqueNackRequestsInPercent()); + RTC_LOGGED_HISTOGRAM_PERCENTAGE( + "WebRTC.Video.UniqueNackRequestsSentInPercent", + counters.UniqueNackRequestsInPercent()); } } } diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 6407cdc62e..6c689bfcdb 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include "webrtc/base/checks.h" #include "webrtc/base/logging.h" @@ -128,68 +129,68 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( int in_height = input_height_counter_.Avg(kMinRequiredSamples); int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); if (in_width != -1) { - 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); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "InputWidthInPixels", in_width); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "InputHeightInPixels", in_height); + RTC_LOGGED_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_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); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "SentWidthInPixels", sent_width); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "SentHeightInPixels", sent_height); + RTC_LOGGED_HISTOGRAMS_COUNTS_100( + kIndex, uma_prefix_ + "SentFramesPerSecond", sent_fps); } int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); if (encode_ms != -1) { - RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", - encode_ms); + RTC_LOGGED_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", + encode_ms); } int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); if (key_frames_permille != -1) { - RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", - key_frames_permille); + RTC_LOGGED_HISTOGRAMS_COUNTS_1000( + kIndex, uma_prefix_ + "KeyFramesSentInPermille", key_frames_permille); } int quality_limited = quality_limited_frame_counter_.Percent(kMinRequiredSamples); if (quality_limited != -1) { - RTC_HISTOGRAMS_PERCENTAGE(kIndex, - uma_prefix_ + "QualityLimitedResolutionInPercent", - quality_limited); + RTC_LOGGED_HISTOGRAMS_PERCENTAGE( + kIndex, uma_prefix_ + "QualityLimitedResolutionInPercent", + quality_limited); } int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); if (downscales != -1) { - RTC_HISTOGRAMS_ENUMERATION( + RTC_LOGGED_HISTOGRAMS_ENUMERATION( kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); } int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); if (bw_limited != -1) { - RTC_HISTOGRAMS_PERCENTAGE( + RTC_LOGGED_HISTOGRAMS_PERCENTAGE( kIndex, uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); } int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); if (num_disabled != -1) { - RTC_HISTOGRAMS_ENUMERATION( + RTC_LOGGED_HISTOGRAMS_ENUMERATION( kIndex, uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); } int delay_ms = delay_counter_.Avg(kMinRequiredSamples); if (delay_ms != -1) - RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", - delay_ms); + RTC_LOGGED_HISTOGRAMS_COUNTS_100000( + kIndex, uma_prefix_ + "SendSideDelayInMs", delay_ms); int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); if (max_delay_ms != -1) { - RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", - max_delay_ms); + RTC_LOGGED_HISTOGRAMS_COUNTS_100000( + kIndex, uma_prefix_ + "SendSideDelayMaxInMs", max_delay_ms); } if (first_rtcp_stats_time_ms_ != -1) { @@ -198,7 +199,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { int fraction_lost = report_block_stats_.FractionLostInPercent(); if (fraction_lost != -1) { - RTC_HISTOGRAMS_PERCENTAGE( + RTC_LOGGED_HISTOGRAMS_PERCENTAGE( kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); } @@ -223,17 +224,17 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( counters.Add(stream_counters); } - RTC_HISTOGRAMS_COUNTS_10000(kIndex, - uma_prefix_ + "NackPacketsReceivedPerMinute", - counters.nack_packets * 60 / elapsed_sec); - RTC_HISTOGRAMS_COUNTS_10000(kIndex, - uma_prefix_ + "FirPacketsReceivedPerMinute", - counters.fir_packets * 60 / elapsed_sec); - RTC_HISTOGRAMS_COUNTS_10000(kIndex, - uma_prefix_ + "PliPacketsReceivedPerMinute", - counters.pli_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "NackPacketsReceivedPerMinute", + counters.nack_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "FirPacketsReceivedPerMinute", + counters.fir_packets * 60 / elapsed_sec); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "PliPacketsReceivedPerMinute", + counters.pli_packets * 60 / elapsed_sec); if (counters.nack_requests > 0) { - RTC_HISTOGRAMS_PERCENTAGE( + RTC_LOGGED_HISTOGRAMS_PERCENTAGE( kIndex, uma_prefix_ + "UniqueNackRequestsReceivedInPercent", counters.UniqueNackRequestsInPercent()); } @@ -255,32 +256,32 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( StreamDataCounters rtp_rtx = rtp; rtp_rtx.Add(rtx); - RTC_HISTOGRAMS_COUNTS_10000( + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( kIndex, uma_prefix_ + "BitrateSentInKbps", static_cast(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAMS_COUNTS_10000( + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( kIndex, uma_prefix_ + "MediaBitrateSentInKbps", static_cast(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAMS_COUNTS_10000( + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( kIndex, uma_prefix_ + "PaddingBitrateSentInKbps", static_cast(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 1000)); - RTC_HISTOGRAMS_COUNTS_10000( + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", static_cast(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 1000)); if (!config.rtp.rtx.ssrcs.empty()) { - RTC_HISTOGRAMS_COUNTS_10000( + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( kIndex, uma_prefix_ + "RtxBitrateSentInKbps", static_cast(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000)); } if (config.rtp.fec.red_payload_type != -1) { - RTC_HISTOGRAMS_COUNTS_10000(kIndex, - uma_prefix_ + "FecBitrateSentInKbps", - static_cast(rtp_rtx.fec.TotalBytes() * - 8 / elapsed_sec / 1000)); + RTC_LOGGED_HISTOGRAMS_COUNTS_10000( + kIndex, uma_prefix_ + "FecBitrateSentInKbps", + static_cast(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / + 1000)); } } } diff --git a/webrtc/video/vie_receiver.cc b/webrtc/video/vie_receiver.cc index 7d24a537c8..27a04d93a9 100644 --- a/webrtc/video/vie_receiver.cc +++ b/webrtc/video/vie_receiver.cc @@ -57,14 +57,15 @@ ViEReceiver::~ViEReceiver() { void ViEReceiver::UpdateHistograms() { FecPacketCounter counter = fec_receiver_->GetPacketCounter(); if (counter.num_packets > 0) { - RTC_HISTOGRAM_PERCENTAGE( + RTC_LOGGED_HISTOGRAM_PERCENTAGE( "WebRTC.Video.ReceivedFecPacketsInPercent", static_cast(counter.num_fec_packets * 100 / counter.num_packets)); } if (counter.num_fec_packets > 0) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.RecoveredMediaPacketsInPercentOfFec", - static_cast(counter.num_recovered_packets * - 100 / counter.num_fec_packets)); + RTC_LOGGED_HISTOGRAM_PERCENTAGE( + "WebRTC.Video.RecoveredMediaPacketsInPercentOfFec", + static_cast(counter.num_recovered_packets * 100 / + counter.num_fec_packets)); } }