gfe-relnote: (n/a) Record total loss detection time in QuicConnectionStats. Stats only, not protected. PiperOrigin-RevId: 297595275 Change-Id: Ie049bd1dbaa28aebb5d43e2d4ab6c79a655f6136
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h index a99c055..9f4deca 100644 --- a/quic/core/quic_connection_stats.h +++ b/quic/core/quic_connection_stats.h
@@ -45,6 +45,9 @@ QuicPacketCount packets_spuriously_retransmitted = 0; // Number of packets abandoned as lost by the loss detection algorithm. QuicPacketCount packets_lost = 0; + // The sum of the detection time of all lost packets. The detection time of a + // lost packet is defined as: T(detection) - T(send). + QuicTime::Delta total_loss_detection_time = QuicTime::Delta::Zero(); // Number of times this connection went through the slow start phase. uint32_t slowstart_count = 0;
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index a055299..d92883b 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -891,12 +891,19 @@ largest_newly_acked_, packets_acked_, &packets_lost_); for (const LostPacket& packet : packets_lost_) { + QuicTransmissionInfo* info = + unacked_packets_.GetMutableTransmissionInfo(packet.packet_number); ++stats_->packets_lost; + if (time > info->sent_time) { + stats_->total_loss_detection_time = + stats_->total_loss_detection_time + (time - info->sent_time); + } if (debug_delegate_ != nullptr) { debug_delegate_->OnPacketLoss(packet.packet_number, LOSS_RETRANSMISSION, time); } - unacked_packets_.RemoveFromInFlight(packet.packet_number); + unacked_packets_.RemoveFromInFlight(info); + MarkForRetransmission(packet.packet_number, LOSS_RETRANSMISSION); } }
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc index 60c84a7..99ddfcd 100644 --- a/quic/core/quic_sent_packet_manager_test.cc +++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -619,6 +619,8 @@ // Spurious retransmission is detected when packet 3 gets acked. We cannot // know packet 2 is a spurious until it gets acked. EXPECT_EQ(1u, stats_.packets_spuriously_retransmitted); + EXPECT_EQ(1u, stats_.packets_lost); + EXPECT_LT(QuicTime::Delta::Zero(), stats_.total_loss_detection_time); } TEST_F(QuicSentPacketManagerTest, AckOriginalTransmission) {