run.sh: Add lines to get zram read/write multipages success ratio

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
Wenchao Hao 2024-11-20 11:07:56 +08:00
parent dc9afb27f1
commit 0f2fea5081
1 changed files with 25 additions and 3 deletions

28
run.sh
View File

@ -26,13 +26,35 @@ folio_alloc_success_ratio=`echo "scale=4; $anon_fault_alloc / $anon_total" | bc`
swpout_alloc=$(cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/swpout)
swpout_fault_fallback=$(cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/swpout_fallback)
swpout_total=$(($swpout_fault_fallback + $swpout_alloc))
swap_success_ratio=`echo "scale=4; $swpout_alloc / $swpout_total" | bc`
swapout_success_ratio=`echo "scale=4; $swpout_alloc / $swpout_total" | bc`
if [ -f /sys/block/zram0/multi_pages_debug_stat ]; then
cat /sys/block/zram0/multi_pages_debug_stat > $tmpfile
nr_write_multipage=$(head -n 1 $tmpfile | awk '{print $5}')
nr_read_multipage=$(head -n 1 $tmpfile | awk '{print $6}')
nr_write_failed_multipage=$(cat $tmpfile | grep "failed" | awk '{print $6}')
nr_read_failed_multipage=$(cat $tmpfile | grep "failed" | awk '{print $7}')
nr_write_succeed_multipage=$(($nr_write_multipage-$nr_write_failed_multipage))
nr_read_succeed_multipage=$(($nr_read_multipage-$nr_read_failed_multipage))
zram_write_multipage_ratio=`echo "scale=4; $nr_write_succeed_multipage / $nr_write_multipage" | bc`
zram_read_multipage_ratio=`echo "scale=4; $nr_read_succeed_multipage / $nr_read_multipage" | bc`
fi
echo swapout $swapout
echo swapin $swapin
echo comp_ratio $comp_ratio
echo pagefault $((pgfault2-pgfault1))
echo pagefault $(($pgfault2-$pgfault1))
echo folio_alloc_success_ratio $folio_alloc_success_ratio
echo swap_success_ratio $swap_success_ratio
echo swapout_success_ratio $swapout_success_ratio
if [ -f /sys/block/zram0/multi_pages_debug_stat ]; then
echo zram_write_multipage_ratio $zram_write_multipage_ratio
echo zram_read_multipage_ratio $zram_read_multipage_ratio
fi
killall test_swap