mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-09 10:00:57 +03:00
Add DSR packet count to state and qlog.
Summary: It's useful at the end of a connection to know if we tried DSR. Reviewed By: jbeshay Differential Revision: D30545282 fbshipit-source-id: bbb2f3408f7a2d5666676c9e2583bf8fd9f18911
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9c1b93c27c
commit
40cc0ca93e
@@ -289,7 +289,8 @@ void QuicTransportBase::closeImpl(
|
|||||||
: std::numeric_limits<uint64_t>::max(),
|
: std::numeric_limits<uint64_t>::max(),
|
||||||
getSendConnFlowControlBytesWire(*conn_),
|
getSendConnFlowControlBytesWire(*conn_),
|
||||||
conn_->usedZeroRtt,
|
conn_->usedZeroRtt,
|
||||||
conn_->version.value_or(QuicVersion::MVFST_INVALID)});
|
conn_->version.value_or(QuicVersion::MVFST_INVALID),
|
||||||
|
conn_->dsrPacketCount});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: truncate the error code string to be 1MSS only.
|
// TODO: truncate the error code string to be 1MSS only.
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ uint64_t writePacketizationRequest(
|
|||||||
// used, so setting it to 0
|
// used, so setting it to 0
|
||||||
0,
|
0,
|
||||||
true /* isDSRPacket */);
|
true /* isDSRPacket */);
|
||||||
|
connection.dsrPacketCount++;
|
||||||
|
|
||||||
if (instructionAddError) {
|
if (instructionAddError) {
|
||||||
// TODO: Support empty write loop detection
|
// TODO: Support empty write loop detection
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ void FileQLogger::addTransportSummary(const TransportSummaryArgs& args) {
|
|||||||
args.currentConnFlowControl,
|
args.currentConnFlowControl,
|
||||||
args.usedZeroRtt,
|
args.usedZeroRtt,
|
||||||
args.quicVersion,
|
args.quicVersion,
|
||||||
|
args.dsrPacketCount,
|
||||||
refTime));
|
refTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class QLogger {
|
|||||||
uint64_t currentConnFlowControl{};
|
uint64_t currentConnFlowControl{};
|
||||||
bool usedZeroRtt{};
|
bool usedZeroRtt{};
|
||||||
QuicVersion quicVersion{QuicVersion::MVFST_INVALID};
|
QuicVersion quicVersion{QuicVersion::MVFST_INVALID};
|
||||||
|
uint64_t dsrPacketCount{};
|
||||||
};
|
};
|
||||||
virtual void addTransportSummary(const TransportSummaryArgs& args) = 0;
|
virtual void addTransportSummary(const TransportSummaryArgs& args) = 0;
|
||||||
virtual void addCongestionMetricUpdate(
|
virtual void addCongestionMetricUpdate(
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
|
|||||||
uint64_t currentConnFlowControlIn,
|
uint64_t currentConnFlowControlIn,
|
||||||
bool usedZeroRttIn,
|
bool usedZeroRttIn,
|
||||||
QuicVersion quicVersionIn,
|
QuicVersion quicVersionIn,
|
||||||
|
uint64_t dsrPacketCountIn,
|
||||||
std::chrono::microseconds refTimeIn)
|
std::chrono::microseconds refTimeIn)
|
||||||
: totalBytesSent{totalBytesSentIn},
|
: totalBytesSent{totalBytesSentIn},
|
||||||
totalBytesRecvd{totalBytesRecvdIn},
|
totalBytesRecvd{totalBytesRecvdIn},
|
||||||
@@ -357,7 +358,8 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
|
|||||||
currentWritableBytes{currentWritableBytesIn},
|
currentWritableBytes{currentWritableBytesIn},
|
||||||
currentConnFlowControl{currentConnFlowControlIn},
|
currentConnFlowControl{currentConnFlowControlIn},
|
||||||
usedZeroRtt{usedZeroRttIn},
|
usedZeroRtt{usedZeroRttIn},
|
||||||
quicVersion{quicVersionIn} {
|
quicVersion{quicVersionIn},
|
||||||
|
dsrPacketCount{dsrPacketCountIn} {
|
||||||
eventType = QLogEventType::TransportSummary;
|
eventType = QLogEventType::TransportSummary;
|
||||||
refTime = refTimeIn;
|
refTime = refTimeIn;
|
||||||
}
|
}
|
||||||
@@ -387,6 +389,7 @@ folly::dynamic QLogTransportSummaryEvent::toDynamic() const {
|
|||||||
data["quic_version"] =
|
data["quic_version"] =
|
||||||
static_cast<std::underlying_type<decltype(quicVersion)>::type>(
|
static_cast<std::underlying_type<decltype(quicVersion)>::type>(
|
||||||
quicVersion);
|
quicVersion);
|
||||||
|
data["dsr_packet_count"] = dsrPacketCount;
|
||||||
|
|
||||||
d.push_back(std::move(data));
|
d.push_back(std::move(data));
|
||||||
return d;
|
return d;
|
||||||
|
|||||||
@@ -393,22 +393,6 @@ class QLogConnectionCloseEvent : public QLogEvent {
|
|||||||
folly::dynamic toDynamic() const override;
|
folly::dynamic toDynamic() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TransportSummaryArgs {
|
|
||||||
uint64_t totalBytesSent{};
|
|
||||||
uint64_t totalBytesRecvd{};
|
|
||||||
uint64_t sumCurWriteOffset{};
|
|
||||||
uint64_t sumMaxObservedOffset{};
|
|
||||||
uint64_t sumCurStreamBufferLen{};
|
|
||||||
uint64_t totalBytesRetransmitted{};
|
|
||||||
uint64_t totalStreamBytesCloned{};
|
|
||||||
uint64_t totalBytesCloned{};
|
|
||||||
uint64_t totalCryptoDataWritten{};
|
|
||||||
uint64_t totalCryptoDataRecvd{};
|
|
||||||
uint64_t currentWritableBytes{};
|
|
||||||
uint64_t currentConnFlowControl{};
|
|
||||||
bool usedZeroRtt{};
|
|
||||||
};
|
|
||||||
|
|
||||||
class QLogTransportSummaryEvent : public QLogEvent {
|
class QLogTransportSummaryEvent : public QLogEvent {
|
||||||
public:
|
public:
|
||||||
QLogTransportSummaryEvent(
|
QLogTransportSummaryEvent(
|
||||||
@@ -426,6 +410,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
|
|||||||
uint64_t currentConnFlowControl,
|
uint64_t currentConnFlowControl,
|
||||||
bool usedZeroRtt,
|
bool usedZeroRtt,
|
||||||
QuicVersion version,
|
QuicVersion version,
|
||||||
|
uint64_t dsrPacketCount,
|
||||||
std::chrono::microseconds refTimeIn);
|
std::chrono::microseconds refTimeIn);
|
||||||
~QLogTransportSummaryEvent() override = default;
|
~QLogTransportSummaryEvent() override = default;
|
||||||
uint64_t totalBytesSent;
|
uint64_t totalBytesSent;
|
||||||
@@ -442,6 +427,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
|
|||||||
uint64_t currentConnFlowControl;
|
uint64_t currentConnFlowControl;
|
||||||
bool usedZeroRtt;
|
bool usedZeroRtt;
|
||||||
QuicVersion quicVersion;
|
QuicVersion quicVersion;
|
||||||
|
uint64_t dsrPacketCount;
|
||||||
|
|
||||||
folly::dynamic toDynamic() const override;
|
folly::dynamic toDynamic() const override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
|
|||||||
22,
|
22,
|
||||||
44,
|
44,
|
||||||
false,
|
false,
|
||||||
QuicVersion::MVFST});
|
QuicVersion::MVFST,
|
||||||
|
37});
|
||||||
|
|
||||||
std::unique_ptr<QLogEvent> p = std::move(q.logs[0]);
|
std::unique_ptr<QLogEvent> p = std::move(q.logs[0]);
|
||||||
auto gotEvent = dynamic_cast<QLogTransportSummaryEvent*>(p.get());
|
auto gotEvent = dynamic_cast<QLogTransportSummaryEvent*>(p.get());
|
||||||
@@ -130,6 +131,7 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
|
|||||||
EXPECT_EQ(gotEvent->currentWritableBytes, 22);
|
EXPECT_EQ(gotEvent->currentWritableBytes, 22);
|
||||||
EXPECT_EQ(gotEvent->currentConnFlowControl, 44);
|
EXPECT_EQ(gotEvent->currentConnFlowControl, 44);
|
||||||
EXPECT_EQ(gotEvent->usedZeroRtt, false);
|
EXPECT_EQ(gotEvent->usedZeroRtt, false);
|
||||||
|
EXPECT_EQ(gotEvent->dsrPacketCount, 37);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(QLoggerTest, CongestionMetricUpdateEvent) {
|
TEST_F(QLoggerTest, CongestionMetricUpdateEvent) {
|
||||||
@@ -757,14 +759,15 @@ TEST_F(QLoggerTest, TransportSummaryFollyDynamic) {
|
|||||||
"current_writable_bytes": 11,
|
"current_writable_bytes": 11,
|
||||||
"current_conn_flow_control": 12,
|
"current_conn_flow_control": 12,
|
||||||
"used_zero_rtt": true,
|
"used_zero_rtt": true,
|
||||||
"quic_version": 4207849474
|
"quic_version": 4207849474,
|
||||||
|
"dsr_packet_count": 37
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
])");
|
])");
|
||||||
|
|
||||||
FileQLogger q(VantagePoint::Client);
|
FileQLogger q(VantagePoint::Client);
|
||||||
q.addTransportSummary(
|
q.addTransportSummary(
|
||||||
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, true, QuicVersion::MVFST});
|
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, true, QuicVersion::MVFST, 37});
|
||||||
folly::dynamic gotDynamic = q.toDynamic();
|
folly::dynamic gotDynamic = q.toDynamic();
|
||||||
gotDynamic["traces"][0]["events"][0][0] = "0"; // hardcode reference time
|
gotDynamic["traces"][0]["events"][0][0] = "0"; // hardcode reference time
|
||||||
folly::dynamic gotEvents = gotDynamic["traces"][0]["events"];
|
folly::dynamic gotEvents = gotDynamic["traces"][0]["events"];
|
||||||
|
|||||||
@@ -4315,6 +4315,7 @@ TEST_F(
|
|||||||
|
|
||||||
TEST_F(QuicServerTransportTest, WriteDSR) {
|
TEST_F(QuicServerTransportTest, WriteDSR) {
|
||||||
server->getNonConstConn().transportSettings.dsrEnabled = true;
|
server->getNonConstConn().transportSettings.dsrEnabled = true;
|
||||||
|
EXPECT_EQ(server->getConn().dsrPacketCount, 0);
|
||||||
// Make sure we are post-handshake
|
// Make sure we are post-handshake
|
||||||
ASSERT_NE(nullptr, server->getConn().oneRttWriteCipher);
|
ASSERT_NE(nullptr, server->getConn().oneRttWriteCipher);
|
||||||
// Rinse anything pending
|
// Rinse anything pending
|
||||||
@@ -4336,6 +4337,7 @@ TEST_F(QuicServerTransportTest, WriteDSR) {
|
|||||||
EXPECT_TRUE(server->getConn().outstandings.packets.back().isDSRPacket);
|
EXPECT_TRUE(server->getConn().outstandings.packets.back().isDSRPacket);
|
||||||
EXPECT_CALL(*rawDSRSender, release()).Times(1);
|
EXPECT_CALL(*rawDSRSender, release()).Times(1);
|
||||||
server->resetStream(streamId, GenericApplicationErrorCode::NO_ERROR);
|
server->resetStream(streamId, GenericApplicationErrorCode::NO_ERROR);
|
||||||
|
EXPECT_EQ(server->getConn().dsrPacketCount, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
|||||||
@@ -813,6 +813,9 @@ struct QuicConnectionStateBase : public folly::DelayedDestruction {
|
|||||||
// in the Observers, to construct Write Blocks
|
// in the Observers, to construct Write Blocks
|
||||||
uint64_t writeCount{0};
|
uint64_t writeCount{0};
|
||||||
|
|
||||||
|
// Number of DSR packets sent by this connection.
|
||||||
|
uint64_t dsrPacketCount{0};
|
||||||
|
|
||||||
// Whether we successfully used 0-RTT keys in this connection.
|
// Whether we successfully used 0-RTT keys in this connection.
|
||||||
bool usedZeroRtt{false};
|
bool usedZeroRtt{false};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user