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_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);
   }
 }