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

 

相关文章:

  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-11-23
猜你喜欢
  • 2021-07-29
  • 2023-04-09
  • 2022-12-23
  • 2021-12-27
  • 2021-11-24
  • 2021-12-23
相关资源
相似解决方案