| OLD | NEW |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); | 159 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); |
| 160 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; | 160 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; |
| 161 const int kMinRequiredPeriodicSamples = 6; | 161 const int kMinRequiredPeriodicSamples = 6; |
| 162 int in_width = input_width_counter_.Avg(kMinRequiredMetricsSamples); | 162 int in_width = input_width_counter_.Avg(kMinRequiredMetricsSamples); |
| 163 int in_height = input_height_counter_.Avg(kMinRequiredMetricsSamples); | 163 int in_height = input_height_counter_.Avg(kMinRequiredMetricsSamples); |
| 164 if (in_width != -1) { | 164 if (in_width != -1) { |
| 165 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputWidthInPixels", | 165 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputWidthInPixels", |
| 166 in_width); | 166 in_width); |
| 167 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputHeightInPixels", | 167 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputHeightInPixels", |
| 168 in_height); | 168 in_height); |
| 169 LOG(LS_INFO) << uma_prefix_ << "InputWidthInPixels " << in_width; |
| 170 LOG(LS_INFO) << uma_prefix_ << "InputHeightInPixels " << in_height; |
| 169 } | 171 } |
| 170 AggregatedStats in_fps = input_fps_counter_.GetStats(); | 172 AggregatedStats in_fps = input_fps_counter_.GetStats(); |
| 171 if (in_fps.num_samples >= kMinRequiredPeriodicSamples) { | 173 if (in_fps.num_samples >= kMinRequiredPeriodicSamples) { |
| 172 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "InputFramesPerSecond", | 174 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "InputFramesPerSecond", |
| 173 in_fps.average); | 175 in_fps.average); |
| 174 LOG(LS_INFO) << uma_prefix_ + "InputFramesPerSecond, " << in_fps.ToString(); | 176 LOG(LS_INFO) << uma_prefix_ + "InputFramesPerSecond, " << in_fps.ToString(); |
| 175 } | 177 } |
| 176 | 178 |
| 177 int sent_width = sent_width_counter_.Avg(kMinRequiredMetricsSamples); | 179 int sent_width = sent_width_counter_.Avg(kMinRequiredMetricsSamples); |
| 178 int sent_height = sent_height_counter_.Avg(kMinRequiredMetricsSamples); | 180 int sent_height = sent_height_counter_.Avg(kMinRequiredMetricsSamples); |
| 179 if (sent_width != -1) { | 181 if (sent_width != -1) { |
| 180 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentWidthInPixels", | 182 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentWidthInPixels", |
| 181 sent_width); | 183 sent_width); |
| 182 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentHeightInPixels", | 184 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentHeightInPixels", |
| 183 sent_height); | 185 sent_height); |
| 186 LOG(LS_INFO) << uma_prefix_ << "SentWidthInPixels " << sent_width; |
| 187 LOG(LS_INFO) << uma_prefix_ << "SentHeightInPixels " << sent_height; |
| 184 } | 188 } |
| 185 AggregatedStats sent_fps = sent_fps_counter_.GetStats(); | 189 AggregatedStats sent_fps = sent_fps_counter_.GetStats(); |
| 186 if (sent_fps.num_samples >= kMinRequiredPeriodicSamples) { | 190 if (sent_fps.num_samples >= kMinRequiredPeriodicSamples) { |
| 187 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "SentFramesPerSecond", | 191 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "SentFramesPerSecond", |
| 188 sent_fps.average); | 192 sent_fps.average); |
| 189 LOG(LS_INFO) << uma_prefix_ + "SentFramesPerSecond, " | 193 LOG(LS_INFO) << uma_prefix_ + "SentFramesPerSecond, " |
| 190 << sent_fps.ToString(); | 194 << sent_fps.ToString(); |
| 191 } | 195 } |
| 192 | 196 |
| 193 int encode_ms = encode_time_counter_.Avg(kMinRequiredMetricsSamples); | 197 int encode_ms = encode_time_counter_.Avg(kMinRequiredMetricsSamples); |
| 194 if (encode_ms != -1) { | 198 if (encode_ms != -1) { |
| 195 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", | 199 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", |
| 196 encode_ms); | 200 encode_ms); |
| 201 LOG(LS_INFO) << uma_prefix_ << "EncodeTimeInMs " << encode_ms; |
| 197 } | 202 } |
| 198 int key_frames_permille = | 203 int key_frames_permille = |
| 199 key_frame_counter_.Permille(kMinRequiredMetricsSamples); | 204 key_frame_counter_.Permille(kMinRequiredMetricsSamples); |
| 200 if (key_frames_permille != -1) { | 205 if (key_frames_permille != -1) { |
| 201 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", | 206 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", |
| 202 key_frames_permille); | 207 key_frames_permille); |
| 208 LOG(LS_INFO) << uma_prefix_ << "KeyFramesSentInPermille " |
| 209 << key_frames_permille; |
| 203 } | 210 } |
| 204 int quality_limited = | 211 int quality_limited = |
| 205 quality_limited_frame_counter_.Percent(kMinRequiredMetricsSamples); | 212 quality_limited_frame_counter_.Percent(kMinRequiredMetricsSamples); |
| 206 if (quality_limited != -1) { | 213 if (quality_limited != -1) { |
| 207 RTC_HISTOGRAMS_PERCENTAGE(kIndex, | 214 RTC_HISTOGRAMS_PERCENTAGE(kIndex, |
| 208 uma_prefix_ + "QualityLimitedResolutionInPercent", | 215 uma_prefix_ + "QualityLimitedResolutionInPercent", |
| 209 quality_limited); | 216 quality_limited); |
| 217 LOG(LS_INFO) << uma_prefix_ << "QualityLimitedResolutionInPercent " |
| 218 << quality_limited; |
| 210 } | 219 } |
| 211 int downscales = quality_downscales_counter_.Avg(kMinRequiredMetricsSamples); | 220 int downscales = quality_downscales_counter_.Avg(kMinRequiredMetricsSamples); |
| 212 if (downscales != -1) { | 221 if (downscales != -1) { |
| 213 RTC_HISTOGRAMS_ENUMERATION( | 222 RTC_HISTOGRAMS_ENUMERATION( |
| 214 kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, | 223 kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, |
| 215 20); | 224 20); |
| 216 } | 225 } |
| 217 int cpu_limited = | 226 int cpu_limited = |
| 218 cpu_limited_frame_counter_.Percent(kMinRequiredMetricsSamples); | 227 cpu_limited_frame_counter_.Percent(kMinRequiredMetricsSamples); |
| 219 if (cpu_limited != -1) { | 228 if (cpu_limited != -1) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 326 } |
| 318 | 327 |
| 319 if (first_rtcp_stats_time_ms_ != -1) { | 328 if (first_rtcp_stats_time_ms_ != -1) { |
| 320 int64_t elapsed_sec = | 329 int64_t elapsed_sec = |
| 321 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; | 330 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; |
| 322 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 331 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
| 323 int fraction_lost = report_block_stats_.FractionLostInPercent(); | 332 int fraction_lost = report_block_stats_.FractionLostInPercent(); |
| 324 if (fraction_lost != -1) { | 333 if (fraction_lost != -1) { |
| 325 RTC_HISTOGRAMS_PERCENTAGE( | 334 RTC_HISTOGRAMS_PERCENTAGE( |
| 326 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); | 335 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); |
| 336 LOG(LS_INFO) << uma_prefix_ << "SentPacketsLostInPercent " |
| 337 << fraction_lost; |
| 327 } | 338 } |
| 328 | 339 |
| 329 // The RTCP packet type counters, delivered via the | 340 // The RTCP packet type counters, delivered via the |
| 330 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire | 341 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire |
| 331 // life of the send stream and are not reset when switching content type. | 342 // life of the send stream and are not reset when switching content type. |
| 332 // For the purpose of these statistics though, we want new counts when | 343 // For the purpose of these statistics though, we want new counts when |
| 333 // switching since we switch histogram name. On every reset of the | 344 // switching since we switch histogram name. On every reset of the |
| 334 // UmaSamplesContainer, we save the initial state of the counters, so that | 345 // UmaSamplesContainer, we save the initial state of the counters, so that |
| 335 // we can calculate the delta here and aggregate over all ssrcs. | 346 // we can calculate the delta here and aggregate over all ssrcs. |
| 336 RtcpPacketTypeCounter counters; | 347 RtcpPacketTypeCounter counters; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 363 } | 374 } |
| 364 } | 375 } |
| 365 } | 376 } |
| 366 | 377 |
| 367 if (first_rtp_stats_time_ms_ != -1) { | 378 if (first_rtp_stats_time_ms_ != -1) { |
| 368 int64_t elapsed_sec = | 379 int64_t elapsed_sec = |
| 369 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; | 380 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; |
| 370 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 381 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
| 371 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "NumberOfPauseEvents", | 382 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "NumberOfPauseEvents", |
| 372 target_rate_updates_.pause_resume_events); | 383 target_rate_updates_.pause_resume_events); |
| 384 LOG(LS_INFO) << uma_prefix_ << "NumberOfPauseEvents " |
| 385 << target_rate_updates_.pause_resume_events; |
| 373 | 386 |
| 374 int paused_time_percent = | 387 int paused_time_percent = |
| 375 paused_time_counter_.Percent(metrics::kMinRunTimeInSeconds * 1000); | 388 paused_time_counter_.Percent(metrics::kMinRunTimeInSeconds * 1000); |
| 376 if (paused_time_percent != -1) { | 389 if (paused_time_percent != -1) { |
| 377 RTC_HISTOGRAMS_PERCENTAGE(kIndex, uma_prefix_ + "PausedTimeInPercent", | 390 RTC_HISTOGRAMS_PERCENTAGE(kIndex, uma_prefix_ + "PausedTimeInPercent", |
| 378 paused_time_percent); | 391 paused_time_percent); |
| 392 LOG(LS_INFO) << uma_prefix_ << "PausedTimeInPercent " |
| 393 << paused_time_percent; |
| 379 } | 394 } |
| 380 } | 395 } |
| 381 } | 396 } |
| 382 | 397 |
| 383 AggregatedStats total_bytes_per_sec = total_byte_counter_.GetStats(); | 398 AggregatedStats total_bytes_per_sec = total_byte_counter_.GetStats(); |
| 384 if (total_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) { | 399 if (total_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) { |
| 385 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "BitrateSentInKbps", | 400 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "BitrateSentInKbps", |
| 386 total_bytes_per_sec.average * 8 / 1000); | 401 total_bytes_per_sec.average * 8 / 1000); |
| 387 LOG(LS_INFO) << uma_prefix_ << "BitrateSentInBps, " | 402 LOG(LS_INFO) << uma_prefix_ << "BitrateSentInBps, " |
| 388 << total_bytes_per_sec.ToStringWithMultiplier(8); | 403 << total_bytes_per_sec.ToStringWithMultiplier(8); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 943 } |
| 929 | 944 |
| 930 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 945 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 931 int64_t min_required_samples, | 946 int64_t min_required_samples, |
| 932 float multiplier) const { | 947 float multiplier) const { |
| 933 if (num_samples < min_required_samples || num_samples == 0) | 948 if (num_samples < min_required_samples || num_samples == 0) |
| 934 return -1; | 949 return -1; |
| 935 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 950 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 936 } | 951 } |
| 937 } // namespace webrtc | 952 } // namespace webrtc |
| OLD | NEW |