Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: net/quic/core/congestion_control/cubic_bytes_test.cc

Issue 2571643002: relnote: Use event_time instead of ApproximateNow() in QUIC cubic code. Protected by --quic_use_eve… (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes.cc ('k') | net/quic/core/congestion_control/cubic_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/congestion_control/cubic_bytes_test.cc
diff --git a/net/quic/core/congestion_control/cubic_bytes_test.cc b/net/quic/core/congestion_control/cubic_bytes_test.cc
index 529af4f9b0d9fce4a9c5f5abd6685eb828bab4bd..4112a5f74ce51068214d863fa4241816a4313e3b 100644
--- a/net/quic/core/congestion_control/cubic_bytes_test.cc
+++ b/net/quic/core/congestion_control/cubic_bytes_test.cc
@@ -83,8 +83,8 @@ TEST_F(CubicBytesTest, AboveOriginWithTighterBounds) {
clock_.AdvanceTime(one_ms_);
const QuicTime initial_time = clock_.ApproximateNow();
const QuicByteCount expected_first_cwnd = RenoCwndInBytes(current_cwnd);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd,
+ rtt_min, initial_time);
ASSERT_EQ(expected_first_cwnd, current_cwnd);
// Normal TCP phase.
@@ -109,8 +109,8 @@ TEST_F(CubicBytesTest, AboveOriginWithTighterBounds) {
for (QuicPacketCount n = 0; n < num_acks_this_epoch; ++n) {
// Call once per ACK.
const QuicByteCount expected_next_cwnd = RenoCwndInBytes(current_cwnd);
- current_cwnd = cubic_.CongestionWindowAfterAck(kDefaultTCPMSS,
- current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
ASSERT_EQ(expected_next_cwnd, current_cwnd);
}
// Our byte-wise Reno implementation is an estimate. We expect
@@ -130,8 +130,8 @@ TEST_F(CubicBytesTest, AboveOriginWithTighterBounds) {
for (int i = 0; i < 3; ++i) {
const QuicByteCount next_expected_cwnd =
ConservativeCwndInBytes(current_cwnd);
- current_cwnd = cubic_.CongestionWindowAfterAck(kDefaultTCPMSS,
- current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
ASSERT_EQ(next_expected_cwnd, current_cwnd);
}
}
@@ -140,21 +140,23 @@ TEST_F(CubicBytesTest, AboveOriginWithTighterBounds) {
const uint64_t max_acks_this_epoch = current_cwnd / kDefaultTCPMSS;
const QuicByteCount expected_cwnd = CubicConvexCwndInBytes(
initial_cwnd, rtt_min, (clock_.ApproximateNow() - initial_time));
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
ASSERT_EQ(expected_cwnd, current_cwnd);
for (QuicPacketCount n = 1; n < max_acks_this_epoch; ++n) {
// Call once per ACK.
- ASSERT_EQ(current_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
+ ASSERT_EQ(
+ current_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min,
+ clock_.ApproximateNow()));
}
clock_.AdvanceTime(hundred_ms_);
}
const QuicByteCount expected_cwnd = CubicConvexCwndInBytes(
initial_cwnd, rtt_min, (clock_.ApproximateNow() - initial_time));
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
ASSERT_EQ(expected_cwnd, current_cwnd);
}
@@ -179,8 +181,9 @@ TEST_F(CubicBytesTest, AboveOrigin) {
: ConservativeCwndInBytes(current_cwnd);
// Initialize the state.
clock_.AdvanceTime(one_ms_);
- ASSERT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
+ ASSERT_EQ(expected_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd,
+ rtt_min, clock_.ApproximateNow()));
current_cwnd = expected_cwnd;
const QuicPacketCount initial_cwnd = expected_cwnd;
// Normal TCP phase.
@@ -188,13 +191,15 @@ TEST_F(CubicBytesTest, AboveOrigin) {
for (QuicPacketCount n = 1;
n < current_cwnd / kDefaultTCPMSS / kNConnectionAlpha; ++n) {
// Call once per ACK.
- ASSERT_NEAR(current_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min),
- kDefaultTCPMSS);
+ ASSERT_NEAR(
+ current_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min,
+ clock_.ApproximateNow()),
+ kDefaultTCPMSS);
}
clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
if (FLAGS_quic_fix_cubic_convex_mode) {
// When we fix convex mode and the uint64 arithmetic, we
// increase the expected_cwnd only after after the first 100ms,
@@ -210,13 +215,15 @@ TEST_F(CubicBytesTest, AboveOrigin) {
for (int i = 0; i < 52; ++i) {
for (QuicPacketCount n = 1; n < current_cwnd / kDefaultTCPMSS; ++n) {
// Call once per ACK.
- ASSERT_NEAR(current_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min),
- kDefaultTCPMSS);
+ ASSERT_NEAR(
+ current_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min,
+ clock_.ApproximateNow()),
+ kDefaultTCPMSS);
}
clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
}
// Total time elapsed so far; add min_rtt (0.1s) here as well.
float elapsed_time_s = 10.0f + 0.1f;
@@ -256,11 +263,11 @@ TEST_F(CubicBytesTest, AboveOriginFineGrainedCubing) {
QuicTime initial_time = clock_.ApproximateNow();
// Start the epoch and then artificially advance the time.
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(600));
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
// We expect the algorithm to perform only non-zero, fine-grained cubic
// increases on every ack in this case.
@@ -268,8 +275,8 @@ TEST_F(CubicBytesTest, AboveOriginFineGrainedCubing) {
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
const QuicByteCount expected_cwnd = CubicConvexCwndInBytes(
initial_cwnd, rtt_min, (clock_.ApproximateNow() - initial_time));
- const QuicByteCount next_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ const QuicByteCount next_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
// Make sure we are performing cubic increases.
ASSERT_EQ(expected_cwnd, next_cwnd);
// Make sure that these are non-zero, less-than-packet sized
@@ -293,8 +300,9 @@ TEST_F(CubicBytesTest, LossEvents) {
: current_cwnd + kDefaultTCPMSS / 2;
// Initialize the state.
clock_.AdvanceTime(one_ms_);
- EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
+ EXPECT_EQ(expected_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd,
+ rtt_min, clock_.ApproximateNow()));
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
@@ -315,20 +323,21 @@ TEST_F(CubicBytesTest, BelowOrigin) {
: current_cwnd + kDefaultTCPMSS / 2;
// Initialize the state.
clock_.AdvanceTime(one_ms_);
- EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
+ EXPECT_EQ(expected_cwnd,
+ cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd,
+ rtt_min, clock_.ApproximateNow()));
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
current_cwnd = expected_cwnd;
// First update after loss to initialize the epoch.
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
// Cubic phase.
for (int i = 0; i < 40; ++i) {
clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
}
expected_cwnd = 553632;
EXPECT_EQ(expected_cwnd, current_cwnd);
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes.cc ('k') | net/quic/core/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698