In quic, record the max consecutive retransmission timeout before making forward progress. stats only change, not protected.
This number will be recorded in TCS on server side, and will be used to populate histogram on client side.
PiperOrigin-RevId: 312123618
Change-Id: I5cd34b2d1559305b2825f6997bc4d7a5c4e2faf8
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h
index f4b747d..0aee970 100644
--- a/quic/core/quic_connection_stats.h
+++ b/quic/core/quic_connection_stats.h
@@ -139,6 +139,9 @@
// Packet number of first decrypted packet.
QuicPacketNumber first_decrypted_packet;
+
+ // Max consecutive retransmission timeout before making forward progress.
+ size_t max_consecutive_rto_with_forward_progress = 0;
};
} // namespace quic
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 7ccd82d..7d32176 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -403,6 +403,17 @@
}
}
}
+ // Records the max consecutive RTO or PTO before forward progress has been
+ // made.
+ if (consecutive_rto_count_ >
+ stats_->max_consecutive_rto_with_forward_progress) {
+ stats_->max_consecutive_rto_with_forward_progress =
+ consecutive_rto_count_;
+ } else if (consecutive_pto_count_ >
+ stats_->max_consecutive_rto_with_forward_progress) {
+ stats_->max_consecutive_rto_with_forward_progress =
+ consecutive_pto_count_;
+ }
// Reset all retransmit counters any time a new packet is acked.
consecutive_rto_count_ = 0;
consecutive_tlp_count_ = 0;
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index 7692c49..d479c68 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -942,6 +942,7 @@
manager_.OnRetransmissionTimeout();
EXPECT_EQ(2u, stats_.tlp_count);
EXPECT_EQ(1u, stats_.rto_count);
+ EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress);
// There are 2 RTO retransmissions.
EXPECT_EQ(104 * kDefaultLength, manager_.GetBytesInFlight());
QuicPacketNumber largest_acked = QuicPacketNumber(103);
@@ -965,6 +966,7 @@
// All packets before 103 should be lost.
// Packet 104 is still in flight.
EXPECT_EQ(1000u, manager_.GetBytesInFlight());
+ EXPECT_EQ(1u, stats_.max_consecutive_rto_with_forward_progress);
}
TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeout) {
@@ -2732,6 +2734,7 @@
manager_.OnRetransmissionTimeout();
EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
EXPECT_EQ(1u, stats_.pto_count);
+ EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress);
// Verify two probe packets get sent.
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
@@ -2765,6 +2768,7 @@
// Verify PTO is correctly re-armed based on sent time of packet 4.
EXPECT_EQ(sent_time + expected_pto_delay, manager_.GetRetransmissionTime());
+ EXPECT_EQ(1u, stats_.max_consecutive_rto_with_forward_progress);
}
TEST_F(QuicSentPacketManagerTest, SendOneProbePacket) {