Browse Source

bbr: исправить отображение сырых BW-значений (bw_latest/bw_lo/bw_hi) с /125 на /2097

BW_RAW_TO_KBPS = bw_raw * 8000 / BW_UNIT = bw_raw / 2097.152
pacing_rate / 125 остаётся без изменений (уже в bytes/sec после bbr_rate_bytes_per_sec)
etcp-inflight-fix
Evgeny 4 months ago
parent
commit
0adff0253d
  1. 9
      tests/bbr_integration/test_bbr_integration.c

9
tests/bbr_integration/test_bbr_integration.c

@ -52,6 +52,9 @@
#define EMU_LOSS_PERM 50 /* 5% */
#define EMU_QUEUE_PKTS 65 /* ~100KB at MTU 1400-1600 */
/* Convert raw BBR bandwidth (BW_UNIT * bytes / usec) to kbps */
#define BW_RAW_TO_KBPS(bw) ((double)(bw) / 2097.152)
/* ===== BBR name helpers ===== */
static const char* bbr_mode_name(uint8_t m) {
switch (m) {
@ -237,8 +240,8 @@ static void print_metrics(struct test_ctx* ctx) {
inlo_kb = (double)b->inflight_lo / 1024.0;
pace_kbps = (double)l->bbr_pacing_rate / 125.0;
rtt_ms = (double)b->min_rtt_us / 1000.0;
bw_latest_k = (double)b->bw_latest / 125.0;
bw_lo_k = (double)b->bw_lo / 125.0;
bw_latest_k = BW_RAW_TO_KBPS(b->bw_latest);
bw_lo_k = BW_RAW_TO_KBPS(b->bw_lo);
round_start = b->round_start;
deliv_k = (double)b->delivered / 1024.0;
full_bw = b->full_bw_reached;
@ -455,7 +458,7 @@ int main(void) {
" minrtt=%.1fms bw_hi=%.0fK bw_lo=%.0fK pace=%.0fK infl_hi=%.1fK infl_lo=%.1fK\n",
l->bbr->mode, l->bbr->cycle_idx, l->bbr->full_bw_reached, l->bbr->loss_in_round,
(double)l->bbr->min_rtt_us / 1000.0,
(double)l->bbr->bw_hi[0] / 125.0, (double)l->bbr->bw_lo / 125.0,
(double)l->bbr->bw_hi[0] / 2097.152, (double)l->bbr->bw_lo / 2097.152,
(double)l->bbr_pacing_rate / 125.0,
(double)l->bbr->inflight_hi / 1024.0, (double)l->bbr->inflight_lo / 1024.0);
l = l->next;

Loading…
Cancel
Save