Chromium Code Reviews| 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..b3f16129808da7630915cbbf170e92c622556a5b 100644 |
| --- a/net/quic/quic_connection_logger.cc |
| +++ b/net/quic/quic_connection_logger.cc |
| @@ -769,6 +769,18 @@ void QuicConnectionLogger::AddTo21CumulativeHistogram( |
| } |
| } |
| +int QuicConnectionLogger::PacketLossRate() const { |
|
ramant (doing other things)
2015/03/20 22:50:59
Is there a better place to find the packet loss ra
|
| + if (largest_received_packet_sequence_number_ == 0) |
| + return 100; // Never received a packet from server, very lossy connection? |
| + QuicPacketSequenceNumber divisor = largest_received_packet_sequence_number_; |
| + QuicPacketSequenceNumber numerator = divisor - num_packets_received_; |
| + if (divisor < 100000) |
| + numerator *= 1000; |
| + else |
| + divisor /= 1000; |
| + return numerator / divisor; |
| +} |
| + |
| 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 +791,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 { |