gfe-relnote: Change quic::SendTimeState.bytes_in_flight to include the bytes from the packet just sent. Protected by v2 flag --gfe2_reloadable_flag_quic_bw_sampler_remove_packets_once_per_congestion_event2. PiperOrigin-RevId: 286619274 Change-Id: Ic9659f61ce5b8f786e5619eb48ddfde9978d95d9
diff --git a/quic/core/congestion_control/bandwidth_sampler.cc b/quic/core/congestion_control/bandwidth_sampler.cc index a4cdc33..8ad5459 100644 --- a/quic/core/congestion_control/bandwidth_sampler.cc +++ b/quic/core/congestion_control/bandwidth_sampler.cc
@@ -67,7 +67,7 @@ total_bytes_acked_after_last_ack_event_(0) { if (remove_packets_once_per_congestion_event_) { QUIC_RELOADABLE_FLAG_COUNT( - quic_bw_sampler_remove_packets_once_per_congestion_event); + quic_bw_sampler_remove_packets_once_per_congestion_event2); } } @@ -121,7 +121,7 @@ } bool success = connection_state_map_.Emplace(packet_number, sent_time, bytes, - bytes_in_flight, *this); + bytes_in_flight + bytes, *this); QUIC_BUG_IF(!success) << "BandwidthSampler failed to insert the packet " "into the map, most likely because it's already " "in it.";
diff --git a/quic/core/congestion_control/bandwidth_sampler.h b/quic/core/congestion_control/bandwidth_sampler.h index c7c9862..d2e0c7b 100644 --- a/quic/core/congestion_control/bandwidth_sampler.h +++ b/quic/core/congestion_control/bandwidth_sampler.h
@@ -64,7 +64,8 @@ // Total number of lost bytes at the time the packet was sent. QuicByteCount total_bytes_lost; - // Total number of inflight bytes right before the time the packet was sent. + // Total number of inflight bytes at the time the packet was sent. + // Includes the packet itself. // It should be equal to |total_bytes_sent| minus the sum of // |total_bytes_acked|, |total_bytes_lost| and total neutered bytes. QuicByteCount bytes_in_flight; @@ -339,10 +340,10 @@ // Snapshot constructor. Records the current state of the bandwidth // sampler. - // |prior_bytes_in_flight| is the bytes in flight before the packet is sent. + // |bytes_in_flight| is the bytes in flight right after the packet is sent. ConnectionStateOnSentPacket(QuicTime sent_time, QuicByteCount size, - QuicByteCount prior_bytes_in_flight, + QuicByteCount bytes_in_flight, const BandwidthSampler& sampler) : sent_time(sent_time), size(size), @@ -355,7 +356,7 @@ sampler.total_bytes_acked_, sampler.total_bytes_lost_, sampler.remove_packets_once_per_congestion_event() - ? prior_bytes_in_flight + ? bytes_in_flight : 0) {} // Default constructor. Required to put this structure into @@ -426,9 +427,9 @@ MaxAckHeightTracker max_ack_height_tracker_; QuicByteCount total_bytes_acked_after_last_ack_event_; - // Latched value of quic_bw_sampler_remove_packets_once_per_congestion_event. + // Latched value of quic_bw_sampler_remove_packets_once_per_congestion_event2. const bool remove_packets_once_per_congestion_event_ = GetQuicReloadableFlag( - quic_bw_sampler_remove_packets_once_per_congestion_event); + quic_bw_sampler_remove_packets_once_per_congestion_event2); }; } // namespace quic
diff --git a/quic/core/congestion_control/bandwidth_sampler_test.cc b/quic/core/congestion_control/bandwidth_sampler_test.cc index a2b858f..fc51db2 100644 --- a/quic/core/congestion_control/bandwidth_sampler_test.cc +++ b/quic/core/congestion_control/bandwidth_sampler_test.cc
@@ -193,6 +193,15 @@ EXPECT_EQ(PacketsToBytes(1), send_time_state.total_bytes_acked); EXPECT_EQ(PacketsToBytes(2), send_time_state.total_bytes_lost); } + if (sampler_.remove_packets_once_per_congestion_event()) { + // This equation works because there is no neutered bytes. + EXPECT_EQ(send_time_state.total_bytes_sent - + send_time_state.total_bytes_acked - + send_time_state.total_bytes_lost, + send_time_state.bytes_in_flight); + } else { + EXPECT_EQ(0u, send_time_state.bytes_in_flight); + } clock_.AdvanceTime(time_between_packets); } }