OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/core/congestion_control/bbr_sender.h" | 5 #include "net/quic/core/congestion_control/bbr_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 sender_->ExportDebugState().max_bandwidth); | 333 sender_->ExportDebugState().max_bandwidth); |
334 // TODO(ianswett): Tighten this bound once we understand why BBR is | 334 // TODO(ianswett): Tighten this bound once we understand why BBR is |
335 // overestimating bandwidth with aggregation. b/36022633 | 335 // overestimating bandwidth with aggregation. b/36022633 |
336 EXPECT_GE(kTestLinkBandwidth * 1.5f, | 336 EXPECT_GE(kTestLinkBandwidth * 1.5f, |
337 sender_->ExportDebugState().max_bandwidth); | 337 sender_->ExportDebugState().max_bandwidth); |
338 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures | 338 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures |
339 // bandwidth higher than the link rate. | 339 // bandwidth higher than the link rate. |
340 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); | 340 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
341 // The margin here is high, because the aggregation greatly increases | 341 // The margin here is high, because the aggregation greatly increases |
342 // smoothed rtt. | 342 // smoothed rtt. |
343 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt()); | 343 EXPECT_GE(kTestRtt * 4.5, rtt_stats_->smoothed_rtt()); |
344 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); | 344 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
345 } | 345 } |
346 | 346 |
347 // Test a simple long data transfer with 2 rtts of aggregation. | 347 // Test a simple long data transfer with 2 rtts of aggregation. |
348 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) { | 348 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) { |
349 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true; | 349 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true; |
350 // Decrease the CWND gain so extra CWND is required with stretch acks. | 350 // Decrease the CWND gain so extra CWND is required with stretch acks. |
351 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); | 351 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); |
352 sender_ = new BbrSender( | 352 sender_ = new BbrSender( |
353 rtt_stats_, | 353 rtt_stats_, |
(...skipping 21 matching lines...) Expand all Loading... |
375 // bandwidth higher than the link rate. | 375 // bandwidth higher than the link rate. |
376 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); | 376 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
377 // The margin here is high, because the aggregation greatly increases | 377 // The margin here is high, because the aggregation greatly increases |
378 // smoothed rtt. | 378 // smoothed rtt. |
379 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); | 379 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); |
380 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); | 380 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
381 } | 381 } |
382 | 382 |
383 TEST_F(BbrSenderTest, SimpleTransferAckDecimationKeepSending) { | 383 TEST_F(BbrSenderTest, SimpleTransferAckDecimationKeepSending) { |
384 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false; | 384 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false; |
| 385 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = true; |
385 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true; | 386 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true; |
386 // Decrease the CWND gain so extra CWND is required with stretch acks. | 387 // Decrease the CWND gain so extra CWND is required with stretch acks. |
387 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); | 388 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); |
388 sender_ = new BbrSender( | 389 sender_ = new BbrSender( |
389 rtt_stats_, | 390 rtt_stats_, |
390 QuicSentPacketManagerPeer::GetUnackedPacketMap( | 391 QuicSentPacketManagerPeer::GetUnackedPacketMap( |
391 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), | 392 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), |
392 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, | 393 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, |
393 &random_); | 394 &random_); |
394 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); | 395 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 sender_->ResumeConnectionState(params, false); | 761 sender_->ResumeConnectionState(params, false); |
761 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); | 762 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); |
762 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); | 763 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); |
763 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); | 764 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); |
764 | 765 |
765 DriveOutOfStartup(); | 766 DriveOutOfStartup(); |
766 } | 767 } |
767 | 768 |
768 } // namespace test | 769 } // namespace test |
769 } // namespace net | 770 } // namespace net |
OLD | NEW |