This is a simple tool for displaying memory information including compression ratio and percentage of compressed memory in Linux kernel using zram. This tool works without zram, but in that case it displays only basic memory statistics.
With LC_NUMERIC=en_GB.utf8
the output of ./zraminfo
looks like this:
Physical memory: 4,111,052,800 bytes
Buffers and cache: 599,769,088 bytes / 14.6% of physical memory
Unallocated: 166,268,928 bytes / 4.0% of physical memory
Compressed: 348,880,896 bytes / 8.5% of physical memory
Decompressed size: 967,163,904 bytes / 20.5% of decompressed memory
Compression ratio: 2.772
If zram is not familiar to you, see article in Wikipedia. If you are using recent Debian or Ubuntu, you can start using zram by installing zram-config:
sudo apt-get install zram-config
Merged to "mainline" at https://gist.github.com/zouppen/6886178 . Thanks for the fix!