aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstefan@webrtc.org <stefan@webrtc.org>2015-01-19 15:44:47 +0000
committerstefan@webrtc.org <stefan@webrtc.org>2015-01-19 15:44:47 +0000
commit474e36e6232a6d85238023acdd5067953f9348d2 (patch)
tree6cd2463462f88ed2112577ebfd41ce39dffb97f4
parentf9d3555ec384a4ed428a114f5fd33abaefce30c6 (diff)
downloadwebrtc-474e36e6232a6d85238023acdd5067953f9348d2.tar.gz
Add UMA stats for tracking the time it takes to reach a BWE of 500, 1000 and 2000 kbps.
The previous CL was reverted for two reasons: - Added a static initializer because std::string. - Landed before the corresponding chromium CL, which has now been landed. BUG=crbug:425925 R=asapersson@webrtc.org Review URL: https://webrtc-codereview.appspot.com/39549004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8094 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc31
-rw-r--r--webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h1
2 files changed, 27 insertions, 5 deletions
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
index a08e12300d..4999df1720 100644
--- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
+++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
@@ -25,6 +25,18 @@ enum { kAvgPacketSizeBytes = 1000 };
enum { kStartPhaseMs = 2000 };
enum { kBweConverganceTimeMs = 20000 };
+struct UmaRampUpMetric {
+ const char* metric_name;
+ int bitrate_kbps;
+};
+
+const UmaRampUpMetric kUmaRampupMetrics[] = {
+ {"WebRTC.BWE.RampUpTimeTo500kbpsInMs", 500},
+ {"WebRTC.BWE.RampUpTimeTo1000kbpsInMs", 1000},
+ {"WebRTC.BWE.RampUpTimeTo2000kbpsInMs", 2000}};
+const size_t kNumUmaRampupMetrics =
+ sizeof(kUmaRampupMetrics) / sizeof(kUmaRampupMetrics[0]);
+
// Calculate the rate that TCP-Friendly Rate Control (TFRC) would apply.
// The formula in RFC 3448, Section 3.1, is used.
uint32_t CalcTfrcBps(int64_t rtt, uint8_t loss) {
@@ -64,7 +76,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
first_report_time_ms_(-1),
initially_lost_packets_(0),
bitrate_at_2_seconds_kbps_(0),
- uma_update_state_(kNoUpdate) {
+ uma_update_state_(kNoUpdate),
+ rampup_uma_stats_updated_(kNumUmaRampupMetrics, false) {
}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@@ -139,11 +152,20 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
int64_t rtt,
int lost_packets) {
+ int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000);
+ for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) {
+ if (!rampup_uma_stats_updated_[i] &&
+ bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) {
+ RTC_HISTOGRAM_COUNTS_100000(kUmaRampupMetrics[i].metric_name,
+ now_ms - first_report_time_ms_);
+ rampup_uma_stats_updated_[i] = true;
+ }
+ }
if (IsInStartPhase(now_ms)) {
initially_lost_packets_ += lost_packets;
} else if (uma_update_state_ == kNoUpdate) {
uma_update_state_ = kFirstDone;
- bitrate_at_2_seconds_kbps_ = (bitrate_ + 500) / 1000;
+ bitrate_at_2_seconds_kbps_ = bitrate_kbps;
RTC_HISTOGRAM_COUNTS(
"WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50);
RTC_HISTOGRAM_COUNTS(
@@ -156,9 +178,8 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
} 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_ - static_cast<int>((bitrate_ + 500) / 1000),
- 0);
+ 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);
}
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h
index 20ce5ee3af..427909b3ee 100644
--- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h
+++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h
@@ -81,6 +81,7 @@ class SendSideBandwidthEstimation {
int initially_lost_packets_;
int bitrate_at_2_seconds_kbps_;
UmaState uma_update_state_;
+ std::vector<bool> rampup_uma_stats_updated_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_