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
This commit is contained in:
parent
f9d3555ec3
commit
474e36e623
@ -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);
|
||||
}
|
||||
|
@ -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_
|
||||
|
Loading…
x
Reference in New Issue
Block a user