Building ratatop: The Network Box and ISP Unit Discrepancies in Rust
Developer Maneshwar details the creation of the btop network monitor in Rust, tackling ISP speed units, shared scaling, and network interface parsing.

Stock photo for illustration only, not from the actual event
- Day four of building a btop-style system monitor in Rust using ratatui.
- Addresses the unit mismatch between ISP bits and download manager bytes.
- Implements a shared scale across download and upload graphs for accurate comparison.
- Retrieves IP addresses using getifaddrs(3) and parses /proc/net/dev counters.
Developer Maneshwar, creator of the micro AI code reviewer git-lrc, has reached day four of building a btop-style system monitor in Rust using ratatui. With CPU, memory, and disk monitors already complete, the network box has now landed, bringing three of btop's four core boxes online.
Three specific elements required careful consideration during this phase: the unit situation, the shared scale, and the deliberate decision to flip the upload graph upside down.
The unit situation stems from a fundamental disconnect in how internet speeds are marketed versus how they are measured by software. ISPs sell bandwidth in bits per second (such as 100 Mbps or 300 Mbps), while browsers and download managers report file transfers in bytes per second. Consequently, a 100 Mbps plan tops out around 12.5 MB/s on a progress bar, frequently leading users to mistakenly believe their connection is broken. The monitor displays both units simultaneously so users can compare against their plan and active downloads without mental arithmetic.

Stock photo for illustration only, not from the actual event
The discrepancy between bits and bytes is a persistent source of consumer confusion. By displaying both metrics using a standard 1024 conversion factor, tools like btop bridge the gap between commercial ISP terminology and actual operating system data transfer rates, preventing common diagnostic misconceptions.
Regarding visualization, the left side features download on top and upload on the bottom, with the lower graph mirrored to hang from its top edge. Furthermore, scaling each graph independently would dangerously misrepresent data—causing a 3 KB/s upload and a 3 MB/s download to appear identical in height. Instead, a shared scale is computed from whichever direction peaked higher to preserve proportional accuracy.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment