Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: webrtc/video/receive_statistics_proxy.cc

Issue 1788783002: Add macros for ability to log samples that are added to histograms (RTC_LOGGED_*). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/call_stats.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 23 matching lines...) Expand all
34 rtx_stats_[it.second.ssrc] = StreamDataCounters(); 34 rtx_stats_[it.second.ssrc] = StreamDataCounters();
35 } 35 }
36 36
37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { 37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() {
38 UpdateHistograms(); 38 UpdateHistograms();
39 } 39 }
40 40
41 void ReceiveStatisticsProxy::UpdateHistograms() { 41 void ReceiveStatisticsProxy::UpdateHistograms() {
42 int fraction_lost = report_block_stats_.FractionLostInPercent(); 42 int fraction_lost = report_block_stats_.FractionLostInPercent();
43 if (fraction_lost != -1) { 43 if (fraction_lost != -1) {
44 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", 44 RTC_LOGGED_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
45 fraction_lost); 45 fraction_lost);
46 } 46 }
47 const int kMinRequiredSamples = 200; 47 const int kMinRequiredSamples = 200;
48 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount()); 48 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
49 if (samples > kMinRequiredSamples) { 49 if (samples > kMinRequiredSamples) {
50 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", 50 RTC_LOGGED_HISTOGRAM_COUNTS_100(
51 round(render_fps_tracker_.ComputeTotalRate())); 51 "WebRTC.Video.RenderFramesPerSecond",
52 RTC_HISTOGRAM_COUNTS_100000( 52 round(render_fps_tracker_.ComputeTotalRate()));
53 RTC_LOGGED_HISTOGRAM_COUNTS_100000(
53 "WebRTC.Video.RenderSqrtPixelsPerSecond", 54 "WebRTC.Video.RenderSqrtPixelsPerSecond",
54 round(render_pixel_tracker_.ComputeTotalRate())); 55 round(render_pixel_tracker_.ComputeTotalRate()));
55 } 56 }
56 int width = render_width_counter_.Avg(kMinRequiredSamples); 57 int width = render_width_counter_.Avg(kMinRequiredSamples);
57 int height = render_height_counter_.Avg(kMinRequiredSamples); 58 int height = render_height_counter_.Avg(kMinRequiredSamples);
58 if (width != -1) { 59 if (width != -1) {
59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); 60 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels",
60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); 61 width);
62 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels",
63 height);
61 } 64 }
62 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); 65 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
63 if (qp != -1) 66 if (qp != -1)
64 RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); 67 RTC_LOGGED_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp);
65 68
66 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and 69 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and
67 // not per frame. Change decode time to include every frame. 70 // not per frame. Change decode time to include every frame.
68 const int kMinRequiredDecodeSamples = 5; 71 const int kMinRequiredDecodeSamples = 5;
69 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); 72 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples);
70 if (decode_ms != -1) 73 if (decode_ms != -1)
71 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); 74 RTC_LOGGED_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
72 75
73 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); 76 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples);
74 if (delay_ms != -1) 77 if (delay_ms != -1)
75 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); 78 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
76 79
77 StreamDataCounters rtp = stats_.rtp_stats; 80 StreamDataCounters rtp = stats_.rtp_stats;
78 StreamDataCounters rtx; 81 StreamDataCounters rtx;
79 for (auto it : rtx_stats_) 82 for (auto it : rtx_stats_)
80 rtx.Add(it.second); 83 rtx.Add(it.second);
81 StreamDataCounters rtp_rtx = rtp; 84 StreamDataCounters rtp_rtx = rtp;
82 rtp_rtx.Add(rtx); 85 rtp_rtx.Add(rtx);
83 int64_t elapsed_sec = 86 int64_t elapsed_sec =
84 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; 87 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000;
85 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 88 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
86 RTC_HISTOGRAM_COUNTS_10000( 89 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
87 "WebRTC.Video.BitrateReceivedInKbps", 90 "WebRTC.Video.BitrateReceivedInKbps",
88 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 91 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
89 1000)); 92 1000));
90 RTC_HISTOGRAM_COUNTS_10000( 93 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
91 "WebRTC.Video.MediaBitrateReceivedInKbps", 94 "WebRTC.Video.MediaBitrateReceivedInKbps",
92 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); 95 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
93 RTC_HISTOGRAM_COUNTS_10000( 96 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
94 "WebRTC.Video.PaddingBitrateReceivedInKbps", 97 "WebRTC.Video.PaddingBitrateReceivedInKbps",
95 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 98 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
96 1000)); 99 1000));
97 RTC_HISTOGRAM_COUNTS_10000( 100 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
98 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", 101 "WebRTC.Video.RetransmittedBitrateReceivedInKbps",
99 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 102 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec /
100 1000)); 103 1000));
101 if (!rtx_stats_.empty()) { 104 if (!rtx_stats_.empty()) {
102 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateReceivedInKbps", 105 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
103 static_cast<int>(rtx.transmitted.TotalBytes() * 106 "WebRTC.Video.RtxBitrateReceivedInKbps",
104 8 / elapsed_sec / 1000)); 107 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
108 1000));
105 } 109 }
106 if (config_.rtp.fec.ulpfec_payload_type != -1) { 110 if (config_.rtp.fec.ulpfec_payload_type != -1) {
107 RTC_HISTOGRAM_COUNTS_10000( 111 RTC_LOGGED_HISTOGRAM_COUNTS_10000(
108 "WebRTC.Video.FecBitrateReceivedInKbps", 112 "WebRTC.Video.FecBitrateReceivedInKbps",
109 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); 113 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000));
110 } 114 }
111 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; 115 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts;
112 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", 116 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute",
113 counters.nack_packets * 60 / elapsed_sec); 117 counters.nack_packets * 60 / elapsed_sec);
114 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", 118 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute",
115 counters.fir_packets * 60 / elapsed_sec); 119 counters.fir_packets * 60 / elapsed_sec);
116 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", 120 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute",
117 counters.pli_packets * 60 / elapsed_sec); 121 counters.pli_packets * 60 / elapsed_sec);
118 if (counters.nack_requests > 0) { 122 if (counters.nack_requests > 0) {
119 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", 123 RTC_LOGGED_HISTOGRAM_PERCENTAGE(
120 counters.UniqueNackRequestsInPercent()); 124 "WebRTC.Video.UniqueNackRequestsSentInPercent",
125 counters.UniqueNackRequestsInPercent());
121 } 126 }
122 } 127 }
123 } 128 }
124 129
125 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { 130 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
126 rtc::CritScope lock(&crit_); 131 rtc::CritScope lock(&crit_);
127 return stats_; 132 return stats_;
128 } 133 }
129 134
130 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { 135 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ++num_samples; 275 ++num_samples;
271 } 276 }
272 277
273 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 278 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
274 if (num_samples < min_required_samples || num_samples == 0) 279 if (num_samples < min_required_samples || num_samples == 0)
275 return -1; 280 return -1;
276 return sum / num_samples; 281 return sum / num_samples;
277 } 282 }
278 283
279 } // namespace webrtc 284 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/call_stats.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698