Rework the panel onto SI figures, labelled chips and one spacing scale

This commit is contained in:
flamingcow
2026-08-01 16:07:44 -07:00
parent de2ff13eb6
commit 726c4c2445
4 changed files with 280 additions and 146 deletions
+20 -19
View File
@@ -303,17 +303,17 @@ func gbps(bytes, frames uint64, secs float64) float64 {
}
var intervalCols = []colSpec{
{title: "UPTIME", width: 9, right: true},
{title: "ELAPSED", width: 9, right: true},
{title: "DIR", width: 5},
{title: "TX pps", width: 9, right: true},
{title: "TX Gb/s", width: 7, right: true},
{title: "RX pps", width: 9, right: true},
{title: "RX Gb/s", width: 7, right: true},
{title: "LOST", width: 11, right: true},
{title: "CORRUPT", width: 11, right: true},
{title: "LINK", width: 11, right: true},
{title: "INTERNAL", width: 11, right: true},
{title: "ERRORS", width: 13, right: true},
{title: "TX packets/s", width: 12, right: true},
{title: "TX bits/s", width: 10, right: true},
{title: "RX packets/s", width: 12, right: true},
{title: "RX bits/s", width: 10, right: true},
{title: "LOST", width: 9, right: true},
{title: "CORRUPT", width: 9, right: true},
{title: "LINK", width: 9, right: true},
{title: "INTERNAL", width: 9, right: true},
{title: "ERRORS", width: 9, right: true},
{title: "MIN ns", width: 9, right: true},
{title: "LEN m", width: 6, right: true},
}
@@ -430,12 +430,12 @@ func (d *direction) displayView(t time.Time) view {
func (d *direction) row(elapsed time.Duration, v view, target float64, length string) []string {
return []string{
uptime(elapsed),
scaleTime(elapsed),
paint(d.short, cCyan),
commas(uint64(v.txPPS)),
rateCell(v.txGbps, target),
commas(uint64(v.rxPPS)),
rateCell(v.rxGbps, target),
scaleSI(v.txPPS),
rateCell(v.txGbps*1e9, target*1e9),
scaleSI(v.rxPPS),
rateCell(v.rxGbps*1e9, target*1e9),
statusCell(v.since.lost),
statusCell(v.since.corrupt),
statusCell(v.since.link),
@@ -801,12 +801,13 @@ func run(aName, bName, sizesArg string,
for i, d := range dirs {
views[i] = d.displayView(now)
}
cable := "-"
// Empty until the probe has a stamp from each direction, so the
// panel shows nothing there rather than a placeholder.
cable := ""
if m, ok := cfg.cableMetres(views); ok {
cable = fmt.Sprintf("%.1f m", m)
cable = fmt.Sprintf("%.1f", m)
}
if err := disp.render(totalView(views), now.Sub(start),
target*float64(len(dirs)), cable); err != nil {
if err := disp.render(totalView(views), now.Sub(start), cable); err != nil {
return err
}
case now := <-tick.C: