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(),
|
||||
getSendConnFlowControlBytesWire(*conn_),
|
||||
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.
|
||||
|
||||
@@ -87,6 +87,7 @@ uint64_t writePacketizationRequest(
|
||||
// used, so setting it to 0
|
||||
0,
|
||||
true /* isDSRPacket */);
|
||||
connection.dsrPacketCount++;
|
||||
|
||||
if (instructionAddError) {
|
||||
// TODO: Support empty write loop detection
|
||||
|
||||
@@ -195,6 +195,7 @@ void FileQLogger::addTransportSummary(const TransportSummaryArgs& args) {
|
||||
args.currentConnFlowControl,
|
||||
args.usedZeroRtt,
|
||||
args.quicVersion,
|
||||
args.dsrPacketCount,
|
||||
refTime));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ class QLogger {
|
||||
uint64_t currentConnFlowControl{};
|
||||
bool usedZeroRtt{};
|
||||
QuicVersion quicVersion{QuicVersion::MVFST_INVALID};
|
||||
uint64_t dsrPacketCount{};
|
||||
};
|
||||
virtual void addTransportSummary(const TransportSummaryArgs& args) = 0;
|
||||
virtual void addCongestionMetricUpdate(
|
||||
|
||||
@@ -343,6 +343,7 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
|
||||
uint64_t currentConnFlowControlIn,
|
||||
bool usedZeroRttIn,
|
||||
QuicVersion quicVersionIn,
|
||||
uint64_t dsrPacketCountIn,
|
||||
std::chrono::microseconds refTimeIn)
|
||||
: totalBytesSent{totalBytesSentIn},
|
||||
totalBytesRecvd{totalBytesRecvdIn},
|
||||
@@ -357,7 +358,8 @@ QLogTransportSummaryEvent::QLogTransportSummaryEvent(
|
||||
currentWritableBytes{currentWritableBytesIn},
|
||||
currentConnFlowControl{currentConnFlowControlIn},
|
||||
usedZeroRtt{usedZeroRttIn},
|
||||
quicVersion{quicVersionIn} {
|
||||
quicVersion{quicVersionIn},
|
||||
dsrPacketCount{dsrPacketCountIn} {
|
||||
eventType = QLogEventType::TransportSummary;
|
||||
refTime = refTimeIn;
|
||||
}
|
||||
@@ -387,6 +389,7 @@ folly::dynamic QLogTransportSummaryEvent::toDynamic() const {
|
||||
data["quic_version"] =
|
||||
static_cast<std::underlying_type<decltype(quicVersion)>::type>(
|
||||
quicVersion);
|
||||
data["dsr_packet_count"] = dsrPacketCount;
|
||||
|
||||
d.push_back(std::move(data));
|
||||
return d;
|
||||
|
||||
@@ -393,22 +393,6 @@ class QLogConnectionCloseEvent : public QLogEvent {
|
||||
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 {
|
||||
public:
|
||||
QLogTransportSummaryEvent(
|
||||
@@ -426,6 +410,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
|
||||
uint64_t currentConnFlowControl,
|
||||
bool usedZeroRtt,
|
||||
QuicVersion version,
|
||||
uint64_t dsrPacketCount,
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogTransportSummaryEvent() override = default;
|
||||
uint64_t totalBytesSent;
|
||||
@@ -442,6 +427,7 @@ class QLogTransportSummaryEvent : public QLogEvent {
|
||||
uint64_t currentConnFlowControl;
|
||||
bool usedZeroRtt;
|
||||
QuicVersion quicVersion;
|
||||
uint64_t dsrPacketCount;
|
||||
|
||||
folly::dynamic toDynamic() const override;
|
||||
};
|
||||
|
||||
@@ -112,7 +112,8 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
|
||||
22,
|
||||
44,
|
||||
false,
|
||||
QuicVersion::MVFST});
|
||||
QuicVersion::MVFST,
|
||||
37});
|
||||
|
||||
std::unique_ptr<QLogEvent> p = std::move(q.logs[0]);
|
||||
auto gotEvent = dynamic_cast<QLogTransportSummaryEvent*>(p.get());
|
||||
@@ -130,6 +131,7 @@ TEST_F(QLoggerTest, TransportSummaryEvent) {
|
||||
EXPECT_EQ(gotEvent->currentWritableBytes, 22);
|
||||
EXPECT_EQ(gotEvent->currentConnFlowControl, 44);
|
||||
EXPECT_EQ(gotEvent->usedZeroRtt, false);
|
||||
EXPECT_EQ(gotEvent->dsrPacketCount, 37);
|
||||
}
|
||||
|
||||
TEST_F(QLoggerTest, CongestionMetricUpdateEvent) {
|
||||
@@ -757,14 +759,15 @@ TEST_F(QLoggerTest, TransportSummaryFollyDynamic) {
|
||||
"current_writable_bytes": 11,
|
||||
"current_conn_flow_control": 12,
|
||||
"used_zero_rtt": true,
|
||||
"quic_version": 4207849474
|
||||
"quic_version": 4207849474,
|
||||
"dsr_packet_count": 37
|
||||
}
|
||||
]
|
||||
])");
|
||||
|
||||
FileQLogger q(VantagePoint::Client);
|
||||
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();
|
||||
gotDynamic["traces"][0]["events"][0][0] = "0"; // hardcode reference time
|
||||
folly::dynamic gotEvents = gotDynamic["traces"][0]["events"];
|
||||
|
||||
@@ -4315,6 +4315,7 @@ TEST_F(
|
||||
|
||||
TEST_F(QuicServerTransportTest, WriteDSR) {
|
||||
server->getNonConstConn().transportSettings.dsrEnabled = true;
|
||||
EXPECT_EQ(server->getConn().dsrPacketCount, 0);
|
||||
// Make sure we are post-handshake
|
||||
ASSERT_NE(nullptr, server->getConn().oneRttWriteCipher);
|
||||
// Rinse anything pending
|
||||
@@ -4336,6 +4337,7 @@ TEST_F(QuicServerTransportTest, WriteDSR) {
|
||||
EXPECT_TRUE(server->getConn().outstandings.packets.back().isDSRPacket);
|
||||
EXPECT_CALL(*rawDSRSender, release()).Times(1);
|
||||
server->resetStream(streamId, GenericApplicationErrorCode::NO_ERROR);
|
||||
EXPECT_EQ(server->getConn().dsrPacketCount, 1);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
@@ -813,6 +813,9 @@ struct QuicConnectionStateBase : public folly::DelayedDestruction {
|
||||
// in the Observers, to construct Write Blocks
|
||||
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.
|
||||
bool usedZeroRtt{false};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user