scottchiefbaker / dool

Python3 compatible fork of dstat
GNU General Public License v3.0
332 stars 64 forks source link

Multiple SWAP's breaks output #60

Closed Mai-Lapyst closed 10 months ago

Mai-Lapyst commented 11 months ago
SUMMARY

When a system has multiple swap's setup (cat /proc/swaps returns multiple lines), the output breaks in certain scenarious; both in CLI-mode and when generating a CSV; all values after the swap columns have an offset to the right.

ISSUE TYPE
DOOL VERSION

Dool 1.3.0 (installed via arch AUR: 1.3.0.r1.g332b828-1)

OS / ENVIRONMENT

Linux / Arch

STEPS TO REPRODUCE
EXPECTED RESULTS

That output dosn't breaks if running with --full and --swap flags.

ACTUAL RESULTS
Plugins: ['epoch', 'swap', 'aio']
Module dool_epoch
Module dool_swap requires ['/proc/swaps']
Module dool_aio requires ['/proc/sys/fs/aio-nr']
┄┄┄┄epoch┄┄┄┄┬┄┄┄┄swap┄┄┄┬async
    epoch    │ used  free│ #aio
1699674984.79│   0    10G┊   0    10G│ 576B  0.18ms
1699674985.79│   0    10G┊   0    10G│ 576B  0.18ms
1699674986.79│   0    10G┊   0    10G│ 576B  0.23ms
1699674987.79│   0    10G┊   0    10G│ 576B  0.17ms
1699674988.79│   0    10G┊   0    10G│ 576B  0.22ms
1699674989.79│   0    10G┊   0    10G│ 576B  0.23ms
1699674990.79│   0    10G┊   0    10G│ 576B  0.24ms 
Mai-Lapyst commented 11 months ago

Tested against master and problem still persists.

Also: If specifing the swap partions by hand output brakes as well:

$ dool --epoch --swap -S /dev/sdb4,/dev/sda4,total --aio
┄┄epoch┄┄┄┬┄┄┄┄swap┄┄┄┬async
  epoch   │ used  free│ #aio
1699676083│   0    10G┊   0    10G┊   0    20G│ 576B
1699676084│   0    10G┊   0    10G┊   0    20G│ 576B
scottchiefbaker commented 10 months ago

Very interesting... I've never worked on a system with more than one swap partition. Let me setup a test VM and do some testing.

scottchiefbaker commented 10 months ago

I refactored the swap code to report swap if there is only one, and the device name if there is more than one. This should be consistent with the previous naming scheme for 99% of use cases where the user only has one swap partition.

Can you test the next branch and see if it works for you? The relevant code is in dool on line 1382

Mai-Lapyst commented 10 months ago

Can you test the next branch and see if it works for you? The relevant code is in dool on line 1382

When using next (commit 63810c265883cd71fad80f23273a43830941b78a), it still produces the wrong output:

$ ./dool --epoch --full --swap --aio
┄┄epoch┄┄┄┬┄┄┄┄swap┄┄┄┬async
  epoch   │ used  free│ #aio
1700554085│   0    10G┊7572M 2667M│ 896B
1700554086│   0    10G┊7572M 2667M│ 896B 
Mai-Lapyst commented 10 months ago

My bad; git didn't checked out the full branch;

Can confirm that using the correct commit of 30847c748483bc088549486292232d805b086b1f it works now:

$ ./dool --epoch --full --swap --aio
┄┄epoch┄┄┄┬┄swap/sda4┄┄┄swap/sdb4┄┬async
  epoch   │ used  free  used  free│ #aio
1700554295│   0    10G┊7571M 2668M│ 896B
1700554296│   0    10G┊7571M 2668M│ 896B
scottchiefbaker commented 10 months ago

Excellent... great news. That will get rolled in to the next official release.