mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-24 04:01:07 +03:00
Add network path model update events to qlog
Summary: Several "Network Path Model" parameters are described in Sec. 2.9 of the BBRv2 IETF draft. These quantities evolve throughout the connection and they are useful to analyze BBRv2 performance. This diff adds inflight_hi, inflight_lo, bandwidth_hi, and bandwidth_lo to the qlog. Reviewed By: mjoras Differential Revision: D61414936 fbshipit-source-id: 2862db2a6aab336fd8a60e4ae5b358e9ab5588b4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
93bb817940
commit
5f74df10b6
@@ -106,6 +106,15 @@ void Bbr2CongestionController::onPacketAckOrLoss(
|
||||
getCongestionWindow(),
|
||||
kCongestionPacketAck,
|
||||
bbr2StateToString(state_));
|
||||
conn_.qLogger->addNetworkPathModelUpdate(
|
||||
inflightHi_.value_or(0),
|
||||
inflightLo_.value_or(0),
|
||||
bandwidthHi_.has_value() ? bandwidthHi_->units : 0,
|
||||
bandwidthHi_.has_value() ? bandwidthHi_->interval
|
||||
: std::chrono::microseconds(1),
|
||||
bandwidthLo_.has_value() ? bandwidthLo_->units : 0,
|
||||
bandwidthLo_.has_value() ? bandwidthLo_->interval
|
||||
: std::chrono::microseconds(1));
|
||||
}
|
||||
if (ackEvent) {
|
||||
subtractAndCheckUnderflow(
|
||||
|
||||
@@ -509,6 +509,25 @@ void FileQLogger::addL4sWeightUpdate(
|
||||
l4sWeight, newEct1, newCe, refTime));
|
||||
}
|
||||
|
||||
void FileQLogger::addNetworkPathModelUpdate(
|
||||
uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval) {
|
||||
auto refTime = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch());
|
||||
handleEvent(std::make_unique<quic::QLogNetworkPathModelUpdateEvent>(
|
||||
inflightHi,
|
||||
inflightLo,
|
||||
bandwidthHiBytes,
|
||||
bandwidthHiInterval,
|
||||
bandwidthLoBytes,
|
||||
bandwidthLoInterval,
|
||||
refTime));
|
||||
}
|
||||
|
||||
void FileQLogger::outputLogsToFile(const std::string& path, bool prettyJson) {
|
||||
if (streaming_) {
|
||||
return;
|
||||
|
||||
@@ -113,7 +113,13 @@ class FileQLogger : public BaseQLogger {
|
||||
bool incremental) override;
|
||||
void addL4sWeightUpdate(double l4sWeight, uint32_t newEct1, uint32_t newCe)
|
||||
override;
|
||||
|
||||
void addNetworkPathModelUpdate(
|
||||
uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval) override;
|
||||
void outputLogsToFile(const std::string& path, bool prettyJson);
|
||||
folly::dynamic toDynamic() const;
|
||||
folly::dynamic toDynamicBase() const;
|
||||
|
||||
@@ -124,7 +124,13 @@ class QLogger {
|
||||
bool incremental) = 0;
|
||||
virtual void
|
||||
addL4sWeightUpdate(double l4sWeight, uint32_t newEct1, uint32_t newCe) = 0;
|
||||
|
||||
virtual void addNetworkPathModelUpdate(
|
||||
uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval) = 0;
|
||||
virtual void setDcid(Optional<ConnectionId> connID) = 0;
|
||||
virtual void setScid(Optional<ConnectionId> connID) = 0;
|
||||
};
|
||||
|
||||
@@ -982,6 +982,40 @@ folly::dynamic QLogL4sWeightUpdateEvent::toDynamic() const {
|
||||
return d;
|
||||
}
|
||||
|
||||
QLogNetworkPathModelUpdateEvent::QLogNetworkPathModelUpdateEvent(
|
||||
uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval,
|
||||
std::chrono::microseconds refTimeIn)
|
||||
: inflightHi_(inflightHi),
|
||||
inflightLo_(inflightLo),
|
||||
bandwidthHiBytes_(bandwidthHiBytes),
|
||||
bandwidthHiInterval_(bandwidthHiInterval),
|
||||
bandwidthLoBytes_(bandwidthLoBytes),
|
||||
bandwidthLoInterval_(bandwidthLoInterval) {
|
||||
eventType = QLogEventType::NetworkPathModelUpdate;
|
||||
refTime = refTimeIn;
|
||||
}
|
||||
|
||||
folly::dynamic QLogNetworkPathModelUpdateEvent::toDynamic() const {
|
||||
folly::dynamic d = folly::dynamic::array(
|
||||
folly::to<std::string>(refTime.count()),
|
||||
"metric_update",
|
||||
toString(eventType));
|
||||
folly::dynamic data = folly::dynamic::object();
|
||||
data["inflight_hi"] = inflightHi_;
|
||||
data["inflight_lo"] = inflightLo_;
|
||||
data["bandwidth_hi_bytes"] = bandwidthHiBytes_;
|
||||
data["bandwidth_hi_interval"] = bandwidthHiInterval_.count();
|
||||
data["bandwidth_lo_bytes"] = bandwidthLoBytes_;
|
||||
data["bandwidth_lo_interval"] = bandwidthLoInterval_.count();
|
||||
d.push_back(std::move(data));
|
||||
return d;
|
||||
}
|
||||
|
||||
folly::StringPiece toString(QLogEventType type) {
|
||||
switch (type) {
|
||||
case QLogEventType::PacketSent:
|
||||
@@ -1030,6 +1064,8 @@ folly::StringPiece toString(QLogEventType type) {
|
||||
return "priority";
|
||||
case QLogEventType::L4sWeightUpdate:
|
||||
return "l4s_weight_update";
|
||||
case QLogEventType::NetworkPathModelUpdate:
|
||||
return "network_path_model_update";
|
||||
}
|
||||
folly::assume_unreachable();
|
||||
}
|
||||
|
||||
@@ -395,7 +395,8 @@ enum class QLogEventType : uint32_t {
|
||||
ConnectionMigration,
|
||||
PathValidation,
|
||||
PriorityUpdate,
|
||||
L4sWeightUpdate
|
||||
L4sWeightUpdate,
|
||||
NetworkPathModelUpdate
|
||||
};
|
||||
|
||||
folly::StringPiece toString(QLogEventType type);
|
||||
@@ -778,4 +779,26 @@ class QLogL4sWeightUpdateEvent : public QLogEvent {
|
||||
uint32_t newCEEchoed_;
|
||||
};
|
||||
|
||||
class QLogNetworkPathModelUpdateEvent : public QLogEvent {
|
||||
public:
|
||||
explicit QLogNetworkPathModelUpdateEvent(
|
||||
uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval,
|
||||
std::chrono::microseconds refTimeIn);
|
||||
~QLogNetworkPathModelUpdateEvent() override = default;
|
||||
|
||||
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
|
||||
|
||||
uint64_t inflightHi_;
|
||||
uint64_t inflightLo_;
|
||||
uint64_t bandwidthHiBytes_;
|
||||
std::chrono::microseconds bandwidthHiInterval_;
|
||||
uint64_t bandwidthLoBytes_;
|
||||
std::chrono::microseconds bandwidthLoInterval_;
|
||||
};
|
||||
|
||||
} // namespace quic
|
||||
|
||||
@@ -70,5 +70,14 @@ class MockQLogger : public QLogger {
|
||||
void,
|
||||
addL4sWeightUpdate,
|
||||
(double l4sWeight, uint32_t newEct1, uint32_t newCe));
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
addNetworkPathModelUpdate,
|
||||
(uint64_t inflightHi,
|
||||
uint64_t inflightLo,
|
||||
uint64_t bandwidthHiBytes,
|
||||
std::chrono::microseconds bandwidthHiInterval,
|
||||
uint64_t bandwidthLoBytes,
|
||||
std::chrono::microseconds bandwidthLoInterval));
|
||||
};
|
||||
} // namespace quic::test
|
||||
|
||||
Reference in New Issue
Block a user