From: Johannes Truschnigg Date: Sat, 19 Mar 2022 19:39:28 +0000 (+0100) Subject: Optimize accounting of adjust_old and not_increasing_count[peername] X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=667da7f3d942f9b9629b21e7d365b56a75ffc38b;p=sqm_lagthrottle Optimize accounting of adjust_old and not_increasing_count[peername] --- diff --git a/__lagdetect.awk b/__lagdetect.awk index 452e71e..2ab8ebf 100644 --- a/__lagdetect.awk +++ b/__lagdetect.awk @@ -230,7 +230,6 @@ function adjust_sqm(peername, latency) { bw_step_rx_cur = 0 bw_step_rx_next = 0 set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next]) - adjust_old = ts return } @@ -259,19 +258,18 @@ function adjust_sqm(peername, latency) { } } # print "set adjust_old=" ts - adjust_old = ts } not_increasing_count[peername] = 0 } else if (latency < (ping_prev[peername] + FUDGE / 2) && latency < (ping_pprev[peername] + FUDGE / 2) && ping_prev[peername] < (ping_pprev[peername] + FUDGE/2)) { if (prefer_high_bw == 0) { # no preference for high bw caps configured if (rx_rate < (0.9 * STEPS_RX[bw_step_rx_cur])) { # line not loaded close to current cap, so skip increasing bw - adjust_old = ts not_increasing_count[peername]++ print "=== " ts " NOOP skiping increase; rx rate too far from current cap of " STEPS_RX[bw_step_rx_cur] "Kbps rx=" rx_rate " tx=" tx_rate return } } if (not_increasing_count[peername] > (decision_pingslots_factor * PINGSLOTS)) { + not_increasing_count[peername] = 0 if (bw_step_rx_cur < bw_maxindex_rx) { bw_step_rx_next = bw_step_rx_cur + 1 print "+++ " ts " choosing bw rx step " bw_step_rx_next " := " STEPS_RX[bw_step_rx_next] "Kbps rx=" rx_rate " tx=" tx_rate @@ -280,8 +278,6 @@ function adjust_sqm(peername, latency) { } else { print "+++ " ts " already at highest bw rx step " bw_step_rx_cur " rx=" rx_rate " tx=" tx_rate } - not_increasing_count[peername] = 0 - adjust_old = ts } not_increasing_count[peername]++ } else { @@ -334,6 +330,7 @@ function update_ping_avgs(peername) { # Shell out to `tc` to update cake bandwidth settings function set_bw(dev, kbit) { + adjust_old = ts system("set -x; tc qdisc change root dev " dev " cake bandwidth " kbit "Kbit") }