aristocratos / bashtop

Linux/OSX/FreeBSD resource monitor
Apache License 2.0
10.74k stars 547 forks source link

[REQUEST] Add zram info #119

Open perkinslr opened 4 years ago

perkinslr commented 4 years ago

Describe the solution you'd like ZRam is a compressed page subsystem, used for ramdisks and swap. I'd like the information from zramctl included when there are zram devices in use. I've added it below mem to my local copy (and can provide that implementation if you like), but getting it in upstream, and written better than I did would be nice.

aristocratos commented 4 years ago

Feel free to make a pull request and I will take a look at it. Though it's likely this information would get cut off by size constraints if a swap file is also present.

perkinslr commented 4 years ago

Done, PR #122 I'm not normally a Bash programmer, so I strongly suspect you'll want to extract the logic and do it "right", I tried to copy the style of the rest of the code, but suspect it's not quite right.

That said, I did account for the variable placement from Swap (especially since zram is most commonly used as a swap device). It takes 20 lines in the mem region to display properly if swap is included, 14 otherwise (and that's for a single zram device, which is probably the most common configuration). It's probably possible to drop it to 1 or 2 lines per device, keeping only the compressed size line, as that's the most important.