1#!/vendor/bin/sh 2 3if [ $# -eq 1 ]; then 4 interval=$1 5else 6 exit 1 7fi 8 9kcompactd_pid=`pidof -x kcompactd0` 10kswapd_pid=`pidof -x kswapd0` 11 12while true 13do 14 log_time=`date '+%m-%d-%H-%M-%S'` 15 16 log_vmstat=`cat /proc/vmstat` 17 log_kcompactd=`cat /proc/$kcompactd_pid/stat` 18 log_kswapd=`cat /proc/$kswapd_pid/stat` 19 log_stat=`cat /proc/stat` 20 21 log_line="$log_time $log_vmstat" 22 echo $log_line >> /data/vendor/mm/vmstat/log 23 24 log_line="$log_time $log_kcompactd" 25 echo $log_line >> /data/vendor/mm/kcompactd/log 26 27 log_line="$log_time $log_kswapd" 28 echo $log_line >> /data/vendor/mm/kswapd/log 29 30 log_line="$log_time $log_stat" 31 echo $log_line >> /data/vendor/mm/stat/log 32 33 sleep $interval 34done 35