Skip to content

Commit 58c89fd

Browse files
authored
Merge pull request #1521 from TheSovietPancakes/main
2 parents 6598b7d + f643a3a commit 58c89fd

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/btop_draw.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,11 @@ namespace Gpu {
11441144
// + Symbols::title_right + Symbols::h_line*(b_width/2-12) + Symbols::div_down + Symbols::h_line*(b_width/2-2) + Symbols::div_right;
11451145

11461146
//? PCIe link throughput
1147-
if (gpu.supported_functions.pcie_txrx and Config::getB("nvml_measure_pcie_speeds")) {
1147+
// Negative RX/TX means that they are manually disabled, not that they are unsupported
1148+
if (gpu.supported_functions.pcie_txrx and not (gpu.pcie_rx < 0 or gpu.pcie_tx < 0)) {
11481149
string tx_string = floating_humanizer(gpu.pcie_tx, 0, 1, 0, 1);
11491150
string rx_string = floating_humanizer(gpu.pcie_rx, 0, 1, 0, 1);
1150-
out += Mv::to(b_y + b_height_vec[index] - 1, b_x+2) + Theme::c("div_line")
1151+
out += Mv::to(b_y + height - 3, b_x+2) + Theme::c("div_line")
11511152
+ Symbols::title_left_down + Theme::c("title") + Fx::b + "TX:" + Fx::ub + Theme::c("div_line") + Symbols::title_right_down + Symbols::h_line*(b_width/2-9-tx_string.size())
11521153
+ Symbols::title_left_down + Theme::c("title") + Fx::b + tx_string + Fx::ub + Theme::c("div_line") + Symbols::title_right_down + (gpu.supported_functions.mem_total and gpu.supported_functions.mem_used ? Symbols::div_down : Symbols::h_line)
11531154
+ Symbols::title_left_down + Theme::c("title") + Fx::b + "RX:" + Fx::ub + Theme::c("div_line") + Symbols::title_right_down + Symbols::h_line*(b_width/2+b_width%2-9-rx_string.size())

src/linux/btop_collect.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,9 @@ namespace Gpu {
13521352
Logger::warning("NVML: Failed to get PCIe RX throughput: {}", nvmlErrorString(result));
13531353
} else gpus_slice[i].pcie_rx = (long long)rx;
13541354
});
1355+
} else {
1356+
gpus_slice[i].pcie_tx = -1;
1357+
gpus_slice[i].pcie_rx = -1;
13551358
}
13561359

13571360
// DebugTimer nvTimer("Nv utilization");
@@ -1781,7 +1784,7 @@ namespace Gpu {
17811784
}
17821785

17831786
//? PCIe link speeds
1784-
if (gpus_slice[i].supported_functions.pcie_txrx and Config::getB("rsmi_measure_pcie_speeds")) {
1787+
if ((gpus_slice[i].supported_functions.pcie_txrx and Config::getB("rsmi_measure_pcie_speeds")) or is_init) {
17851788
uint64_t tx, rx;
17861789
result = rsmi_dev_pci_throughput_get(i, &tx, &rx, nullptr);
17871790
if (result != RSMI_STATUS_SUCCESS) {
@@ -1791,6 +1794,9 @@ namespace Gpu {
17911794
gpus_slice[i].pcie_tx = (long long)tx;
17921795
gpus_slice[i].pcie_rx = (long long)rx;
17931796
}
1797+
} else {
1798+
gpus_slice[i].pcie_tx = -1;
1799+
gpus_slice[i].pcie_rx = -1;
17941800
}
17951801
}
17961802

0 commit comments

Comments
 (0)