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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 /*connection_id=*/GetPeerInMemoryConnectionId(43)), | 90 /*connection_id=*/GetPeerInMemoryConnectionId(43)), |
91 receiver_multiplexer_("Receiver multiplexer", | 91 receiver_multiplexer_("Receiver multiplexer", |
92 {&receiver_, &competing_receiver_}) { | 92 {&receiver_, &competing_receiver_}) { |
93 // These will be changed by the appropriate tests as necessary. | 93 // These will be changed by the appropriate tests as necessary. |
94 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = false; | 94 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = false; |
95 FLAGS_quic_reloadable_flag_quic_bbr_slow_recent_delivery = false; | 95 FLAGS_quic_reloadable_flag_quic_bbr_slow_recent_delivery = false; |
96 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; | 96 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; |
97 // TODO(ianswett): Determine why tests become flaky with CWND based on SRTT. | 97 // TODO(ianswett): Determine why tests become flaky with CWND based on SRTT. |
98 FLAGS_quic_reloadable_flag_quic_bbr_base_cwnd_on_srtt = false; | 98 FLAGS_quic_reloadable_flag_quic_bbr_base_cwnd_on_srtt = false; |
99 FLAGS_quic_reloadable_flag_quic_bbr_extra_conservation = true; | 99 FLAGS_quic_reloadable_flag_quic_bbr_extra_conservation = true; |
100 FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation = true; | 100 FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation2 = true; |
101 rtt_stats_ = bbr_sender_.connection()->sent_packet_manager().GetRttStats(); | 101 rtt_stats_ = bbr_sender_.connection()->sent_packet_manager().GetRttStats(); |
102 sender_ = SetupBbrSender(&bbr_sender_); | 102 sender_ = SetupBbrSender(&bbr_sender_); |
103 | 103 |
104 clock_ = simulator_.GetClock(); | 104 clock_ = simulator_.GetClock(); |
105 simulator_.set_random_generator(&random_); | 105 simulator_.set_random_generator(&random_); |
106 | 106 |
107 uint64_t seed = QuicRandom::GetInstance()->RandUint64(); | 107 uint64_t seed = QuicRandom::GetInstance()->RandUint64(); |
108 random_.set_seed(seed); | 108 random_.set_seed(seed); |
109 QUIC_LOG(INFO) << "BbrSenderTest simulator set up. Seed: " << seed; | 109 QUIC_LOG(INFO) << "BbrSenderTest simulator set up. Seed: " << seed; |
110 } | 110 } |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 simulator_result = simulator_.RunUntilOrTimeout( | 487 simulator_result = simulator_.RunUntilOrTimeout( |
488 [this]() { | 488 [this]() { |
489 return sender_->ExportDebugState().recovery_state != | 489 return sender_->ExportDebugState().recovery_state != |
490 BbrSender::NOT_IN_RECOVERY; | 490 BbrSender::NOT_IN_RECOVERY; |
491 }, | 491 }, |
492 timeout); | 492 timeout); |
493 ASSERT_TRUE(simulator_result); | 493 ASSERT_TRUE(simulator_result); |
494 ASSERT_EQ(BbrSender::CONSERVATION, | 494 ASSERT_EQ(BbrSender::CONSERVATION, |
495 sender_->ExportDebugState().recovery_state); | 495 sender_->ExportDebugState().recovery_state); |
496 | 496 |
497 const QuicByteCount cwnd_at_recovery_start = sender_->GetCongestionWindow(); | |
498 simulator_result = simulator_.RunUntilOrTimeout( | 497 simulator_result = simulator_.RunUntilOrTimeout( |
499 [this, cwnd_at_recovery_start]() { | 498 [this]() { |
500 // Ensure that the CWND never drops due to conservation. | |
501 if (sender_->GetCongestionWindow() < cwnd_at_recovery_start) { | |
502 return true; | |
503 } | |
504 return sender_->ExportDebugState().recovery_state != | 499 return sender_->ExportDebugState().recovery_state != |
505 BbrSender::CONSERVATION; | 500 BbrSender::CONSERVATION; |
506 }, | 501 }, |
507 timeout); | 502 timeout); |
508 ASSERT_GE(sender_->GetCongestionWindow(), cwnd_at_recovery_start); | |
509 ASSERT_TRUE(simulator_result); | 503 ASSERT_TRUE(simulator_result); |
510 ASSERT_EQ(BbrSender::GROWTH, sender_->ExportDebugState().recovery_state); | 504 ASSERT_EQ(BbrSender::GROWTH, sender_->ExportDebugState().recovery_state); |
511 | 505 |
512 simulator_result = simulator_.RunUntilOrTimeout( | 506 simulator_result = simulator_.RunUntilOrTimeout( |
513 [this]() { | 507 [this]() { |
514 return sender_->ExportDebugState().recovery_state != BbrSender::GROWTH; | 508 return sender_->ExportDebugState().recovery_state != BbrSender::GROWTH; |
515 }, | 509 }, |
516 timeout); | 510 timeout); |
517 | 511 |
518 ASSERT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); | 512 ASSERT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 sender_->ResumeConnectionState(params, false); | 812 sender_->ResumeConnectionState(params, false); |
819 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); | 813 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); |
820 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); | 814 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); |
821 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); | 815 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); |
822 | 816 |
823 DriveOutOfStartup(); | 817 DriveOutOfStartup(); |
824 } | 818 } |
825 | 819 |
826 } // namespace test | 820 } // namespace test |
827 } // namespace net | 821 } // namespace net |
OLD | NEW |