1 #!/bin/bash 2 3 pid=$(ps -T -p $(pgrep xxx) | grep xxx | gawk -F" " '{print $2}') 4 if [ -z $pid ]; then 5 echo "can not find xxx" 6 exit 1 7 fi 8 echo "pid: "$pid 9 prev_runtime=0 10 while true; do 11 current_runtime=`cat /proc/$pid/sched | grep exec_run | gawk -F: '{print $2}' | gawk -F"." '{print $1}'`; 12 #echo $current_runtime 13 delta=$(expr $current_runtime - $prev_runtime) 14 echo "rtime:$delta ms/s" 15 prev_runtime=$current_runtime 16 sleep 1; 17 done