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

Unified Diff: net/quic/quic_connection_logger.cc

Issue 1025573002: QUIC - disable QUIC if packet loss rate is bad for a connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable quic when there is high packet loss rate Created 5 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_connection_logger.cc
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index 2005b88165a6fe14d01db79edf278204689afa4b..4fb53725cc681dc73b02582bea7fa11755f7440e 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -769,6 +769,19 @@ void QuicConnectionLogger::AddTo21CumulativeHistogram(
}
}
+float QuicConnectionLogger::PacketLossRate() const {
Ryan Hamilton 2015/03/23 02:31:06 This is the received packet loss rate, right? (As
ramant (doing other things) 2015/03/24 03:07:22 Done.
+ // Never received a packet from server, very lossy connection?
+ if (largest_received_packet_sequence_number_ == 0)
+ return 1000.0f;
+ QuicPacketSequenceNumber divisor = largest_received_packet_sequence_number_;
+ QuicPacketSequenceNumber numerator = divisor - num_packets_received_;
+ if (divisor < 100000)
+ numerator *= 1000;
+ else
+ divisor /= 1000;
+ return numerator / divisor;
Ryan Hamilton 2015/03/23 02:31:06 So the reason this code uses * 1000 or / 1000 is b
ramant (doing other things) 2015/03/24 03:07:22 Done.
+}
+
void QuicConnectionLogger::RecordAggregatePacketLossRate() const {
// For short connections under 22 packets in length, we'll rely on the
// Net.QuicSession.21CumulativePacketsReceived_* histogram to indicate packet
@@ -779,17 +792,11 @@ void QuicConnectionLogger::RecordAggregatePacketLossRate() const {
if (largest_received_packet_sequence_number_ <= 21)
return;
- QuicPacketSequenceNumber divisor = largest_received_packet_sequence_number_;
- QuicPacketSequenceNumber numerator = divisor - num_packets_received_;
- if (divisor < 100000)
- numerator *= 1000;
- else
- divisor /= 1000;
string prefix("Net.QuicSession.PacketLossRate_");
base::HistogramBase* histogram = base::Histogram::FactoryGet(
prefix + connection_description_, 1, 1000, 75,
base::HistogramBase::kUmaTargetedHistogramFlag);
- histogram->Add(static_cast<base::HistogramBase::Sample>(numerator / divisor));
+ histogram->Add(static_cast<base::HistogramBase::Sample>(PacketLossRate()));
}
void QuicConnectionLogger::RecordLossHistograms() const {

Powered by Google App Engine
This is Rietveld 408576698