Skip to content

Commit

Permalink
Fix retransmit scaling on the tree
Browse files Browse the repository at this point in the history
  • Loading branch information
thebracket committed Dec 10, 2024
1 parent b659268 commit 6b7bdcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export function formatRetransmit(retransmits) {
return "<span class='muted' style='color: " + color + "'>■</span>" + retransmits.toFixed(1) + "%</span>";
}

export function formatRetransmitRaw(retransmits) {
retransmits *= 100;
let percent = Math.min(100, retransmits);
let color = lerpColor([0, 255, 0], [255, 0, 0], percent);
return "<span class='muted' style='color: " + color + "'>■</span>" + retransmits.toFixed(0) + "</span>";
}

export function formatCakeStat(n) {
let percent = Math.min(100, n) / 100;
let color = lerpColor([128, 128, 0], [255, 255, 255], percent);
Expand Down
10 changes: 5 additions & 5 deletions src/rust/lqosd/src/node_manager/js_build/src/tree.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {clearDiv, clientTableHeader, formatLastSeen, simpleRow, simpleRowHtml, theading} from "./helpers/builders";
import {
formatCakeStat,
formatRetransmit,
formatRetransmit, formatRetransmitRaw,
formatRtt,
formatThroughput,
} from "./helpers/scaling";
Expand Down Expand Up @@ -166,7 +166,7 @@ function buildRow(i, depth=0) {
col = document.createElement("td");
col.id = "re-xmit-down-" + nodeId;
if (node.current_retransmits[0] !== undefined) {
col.innerHTML = formatRetransmit(node.current_retransmits[0]);
col.innerHTML = formatRetransmitRaw(node.current_retransmits[0]);
} else {
col.textContent = "-";
}
Expand All @@ -175,7 +175,7 @@ function buildRow(i, depth=0) {
col = document.createElement("td");
col.id = "re-xmit-up-" + nodeId;
if (node.current_retransmits[1] !== undefined) {
col.innerHTML = formatRetransmit(node.current_retransmits[1]);
col.innerHTML = formatRetransmitRaw(node.current_retransmits[1]);
} else {
col.textContent = "-";
}
Expand Down Expand Up @@ -249,15 +249,15 @@ function treeUpdate(msg) {
col = document.getElementById("re-xmit-down-" + nodeId);
if (col !== null) {
if (node.current_retransmits[0] !== undefined) {
col.innerHTML = formatRetransmit(node.current_retransmits[0]);
col.innerHTML = formatRetransmitRaw(node.current_retransmits[0]);
} else {
col.textContent = "-";
}
}
col = document.getElementById("re-xmit-up-" + nodeId);
if (col !== null) {
if (node.current_retransmits[1] !== undefined) {
col.innerHTML = formatRetransmit(node.current_retransmits[1]);
col.innerHTML = formatRetransmitRaw(node.current_retransmits[1]);
} else {
col.textContent = "-";
}
Expand Down

0 comments on commit 6b7bdcb

Please sign in to comment.