标签:str ash percent 线程 检测 inf psr info lse
#!/bin/bash
function thread_used_cpu(){
# $1 为单个cpu负载的百分比
if [[ $1 == "" ]];then
full_load_percent=95
else
full_load_precent=$1
fi
ps_info=(`ps H -eo pid|uniq -c|grep -v 'PID'|awk '{ if ($1==1) print $2}'`)
echo ${ps_info[@]}|grep '5350'
grep_string=$(echo ${ps_info[@]}|sed 's/ /\|/g')
echo "`ps H -eo pid,psr,pcpu,comm,tid |grep -E ${grep_string}|awk -v full_load_percent=$full_load_percent '{ if ($3 > full_load_percent) print "pid:"$1",核心号:"$2",cpu使用率:"$3",进程名称:"$4",线程id:"$5; else print "None" }'`"
}
thread_used_cpu
标签:str ash percent 线程 检测 inf psr info lse
原文地址:https://www.cnblogs.com/randomlee/p/11576686.html