diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-13 23:35:17 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-13 23:35:17 +0200 |
| commit | f7e03c864addd6c46f49558275cbb2e7050783d6 (patch) | |
| tree | fce4a9e3c7251cf24d662c3a110cd656a96f704e /internal/collector/parse_test.go | |
| parent | 8ce6aa0a181e123f156ef3d1b75d939f56757ac6 (diff) | |
Document hotkeys in README; fix display/config; net interface help
- README: add Hotkeys section (1,2,3,e,h,n,q,w,a,y,d,c,f,v,arrows)
- README: network interface and netlink config docs
- Display: default window width 1200; clear bar slots to fix CPU/mem/net mixing
- Display: numBars count only non-nil hosts (layout matches draw)
- Display: network bars (key 3), net interface choice and n=cycle
- Display: extended peak line (e), cpu/net avg keys (a,y,d,c) with feedback
- Config: default barwidth 1200; netint/netlink in --help
- Collector: parse_test Linux-style net stats
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'internal/collector/parse_test.go')
| -rw-r--r-- | internal/collector/parse_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/collector/parse_test.go b/internal/collector/parse_test.go index 0faa4fb..6edac33 100644 --- a/internal/collector/parse_test.go +++ b/internal/collector/parse_test.go @@ -72,16 +72,19 @@ func TestParseMemLine(t *testing.T) { func TestParseNetLine(t *testing.T) { tests := []struct { - name string - line string + name string + line string wantIface string - wantB int64 - wantTb int64 - wantErr bool + wantB int64 + wantTb int64 + wantErr bool }{ {"simple", "eth0:b=1000;tb=2000;p=10;tp=20;e=0;te=0;d=0;td=0", "eth0", 1000, 2000, false}, {"with_space", "eth0:b=100;tb=200 p=0;tp=0;e=0;te=0;d=0;td=0", "eth0", 100, 200, false}, {"no_colon", "eth0 b=1", "", 0, 0, true}, + // Linux /proc/net/dev style as emitted by loadbars-remote.sh (iface rx_bytes rx_packets ... tx_bytes ...) + {"linux_style", "eth0:b=123456789;tb=987654321;p=1000;tp=2000 e=0;te=0;d=0;td=0", "eth0", 123456789, 987654321, false}, + {"lo_interface", "lo:b=0;tb=0;p=0;tp=0 e=0;te=0;d=0;td=0", "lo", 0, 0, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { |
