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

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

Issue 1530913002: Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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/receive_statistics_proxy.cc ('k') | webrtc/video/vie_channel.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } else if (payload_name == "VP9") { 50 } else if (payload_name == "VP9") {
51 return kVideoVp9; 51 return kVideoVp9;
52 } else if (payload_name == "H264") { 52 } else if (payload_name == "H264") {
53 return kVideoH264; 53 return kVideoH264;
54 } else { 54 } else {
55 return kVideoUnknown; 55 return kVideoUnknown;
56 } 56 }
57 } 57 }
58 58
59 void UpdateCodecTypeHistogram(const std::string& payload_name) { 59 void UpdateCodecTypeHistogram(const std::string& payload_name) {
60 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType", 60 RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Video.Encoder.CodecType",
61 PayloadNameToHistogramCodecType(payload_name), kVideoMax); 61 PayloadNameToHistogramCodecType(payload_name), kVideoMax);
62 } 62 }
63 } // namespace 63 } // namespace
64 64
65 65
66 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; 66 const int SendStatisticsProxy::kStatsTimeoutMs = 5000;
67 67
68 SendStatisticsProxy::SendStatisticsProxy( 68 SendStatisticsProxy::SendStatisticsProxy(
69 Clock* clock, 69 Clock* clock,
70 const VideoSendStream::Config& config, 70 const VideoSendStream::Config& config,
(...skipping 20 matching lines...) Expand all
91 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { 91 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {
92 UpdateHistograms(); 92 UpdateHistograms();
93 } 93 }
94 94
95 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { 95 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
96 const int kMinRequiredSamples = 200; 96 const int kMinRequiredSamples = 200;
97 int in_width = input_width_counter_.Avg(kMinRequiredSamples); 97 int in_width = input_width_counter_.Avg(kMinRequiredSamples);
98 int in_height = input_height_counter_.Avg(kMinRequiredSamples); 98 int in_height = input_height_counter_.Avg(kMinRequiredSamples);
99 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); 99 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate());
100 if (in_width != -1) { 100 if (in_width != -1) {
101 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width); 101 RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputWidthInPixels",
102 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height); 102 in_width);
103 RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps); 103 RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputHeightInPixels",
104 in_height);
105 RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "InputFramesPerSecond",
106 in_fps);
104 } 107 }
105 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); 108 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples);
106 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); 109 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples);
107 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); 110 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate());
108 if (sent_width != -1) { 111 if (sent_width != -1) {
109 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width); 112 RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentWidthInPixels",
110 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height); 113 sent_width);
111 RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps); 114 RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentHeightInPixels",
115 sent_height);
116 RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "SentFramesPerSecond",
117 sent_fps);
112 } 118 }
113 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); 119 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
114 if (encode_ms != -1) 120 if (encode_ms != -1)
115 RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); 121 RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms);
116 122
117 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); 123 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
118 if (key_frames_permille != -1) { 124 if (key_frames_permille != -1) {
119 RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille", 125 RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "KeyFramesSentInPermille",
120 key_frames_permille); 126 key_frames_permille);
121 } 127 }
122 int quality_limited = 128 int quality_limited =
123 quality_limited_frame_counter_.Percent(kMinRequiredSamples); 129 quality_limited_frame_counter_.Percent(kMinRequiredSamples);
124 if (quality_limited != -1) { 130 if (quality_limited != -1) {
125 RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent", 131 RTC_HISTOGRAM_PERCENTAGE_SPARSE(
126 quality_limited); 132 uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited);
127 } 133 }
128 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); 134 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples);
129 if (downscales != -1) { 135 if (downscales != -1) {
130 RTC_HISTOGRAM_ENUMERATION( 136 RTC_HISTOGRAM_ENUMERATION_SPARSE(
131 uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); 137 uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20);
132 } 138 }
133 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); 139 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples);
134 if (bw_limited != -1) { 140 if (bw_limited != -1) {
135 RTC_HISTOGRAM_PERCENTAGE( 141 RTC_HISTOGRAM_PERCENTAGE_SPARSE(
136 uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); 142 uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited);
137 } 143 }
138 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); 144 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples);
139 if (num_disabled != -1) { 145 if (num_disabled != -1) {
140 RTC_HISTOGRAM_ENUMERATION( 146 RTC_HISTOGRAM_ENUMERATION_SPARSE(
141 uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); 147 uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10);
142 } 148 }
143 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); 149 int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
144 if (delay_ms != -1) 150 if (delay_ms != -1)
145 RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms); 151 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs",
152 delay_ms);
146 153
147 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); 154 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
148 if (max_delay_ms != -1) { 155 if (max_delay_ms != -1) {
149 RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs", 156 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs",
150 max_delay_ms); 157 max_delay_ms);
151 } 158 }
152 } 159 }
153 160
154 void SendStatisticsProxy::SetContentType( 161 void SendStatisticsProxy::SetContentType(
155 VideoEncoderConfig::ContentType content_type) { 162 VideoEncoderConfig::ContentType content_type) {
156 rtc::CritScope lock(&crit_); 163 rtc::CritScope lock(&crit_);
157 if (content_type_ != content_type) { 164 if (content_type_ != content_type) {
158 uma_container_->UpdateHistograms(); 165 uma_container_->UpdateHistograms();
159 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); 166 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type)));
160 content_type_ = content_type; 167 content_type_ = content_type;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return Fraction(min_required_samples, 1000.0f); 421 return Fraction(min_required_samples, 1000.0f);
415 } 422 }
416 423
417 int SendStatisticsProxy::BoolSampleCounter::Fraction( 424 int SendStatisticsProxy::BoolSampleCounter::Fraction(
418 int min_required_samples, float multiplier) const { 425 int min_required_samples, float multiplier) const {
419 if (num_samples < min_required_samples || num_samples == 0) 426 if (num_samples < min_required_samples || num_samples == 0)
420 return -1; 427 return -1;
421 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 428 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
422 } 429 }
423 } // namespace webrtc 430 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/vie_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698