Created
October 22, 2016 18:18
-
-
Save nvtkaszpir/6904f7d066b6d27b1f82e49f5d0d931e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for dir in $( find -L /sys/block/ -maxdepth 1 -type d -name zram* ); do | |
if [ ! -d "$dir" ]; then | |
echo "status: disabled" | |
exit 0 | |
fi | |
mem_used_total="$(cat $dir/mem_used_total)" | |
orig_data_size="$(cat $dir/orig_data_size)" | |
echo "status: enabled" | |
echo "compression: $((($orig_data_size - $mem_used_total) * 100 / $mem_used_total))%" | |
echo "disksize: $(($(cat $dir/disksize) / 1048576))M" | |
echo "compr_data_size: $(($(cat $dir/compr_data_size) / 1024 / 1024))M" | |
echo "orig_data_size: $(($orig_data_size / 1024 / 1024))M" | |
echo "mem_used_total: $(($mem_used_total / 1024 / 1024))M" | |
echo "max_comp_streams: $(cat $dir/max_comp_streams)" | |
echo "comp_algorithm: $(cat $dir/comp_algorithm)" | |
echo "" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment