Ubuntu 或 Centos 中的 prstat
prstat in Ubuntu or Centos
正如 Java 表现 所说:
Solaris prstat has additional capabilities
such as reporting both user and kernel or system CPU utilization along with other
microstate information using the prstat -m and -L options. The -m option prints
microstate information, and -L prints statistics on per lightweight process.
Centos 或 Ubuntu 中是否有可用的工具,如 prstat?
Linux 中没有 prstat "equivalent" 工具。您可以结合使用 top 和 ps(或 /proc/$pid/ 资源)来获得一些有用的结果;也许编写一个 shell 脚本(使用 grep、sed 和 awk)来收集上述命令和文件的结果。
仅供参考,我发现这个 link 关于顶级命令和内核、用户和空闲 CPU 利用率有趣
http://blog.scoutapp.com/articles/2015/02/24/understanding-linuxs-cpu-stats
希望这个帮助ps。
我相信您正在寻找的 Linux 命令是 top 和 pstree 。
这是 ptree 用于 Linux,
#!/bin/sh
# Solaris style ptree
[ -x /usr/bin/ptree ] && exec /usr/bin/ptree "$@"
# Print process tree
# = PID : extract tree for this process
# = user : filter for this (existing) user
# = user = PID : do both
PATH=/bin:/usr/bin:/usr/sbin:/sbin
export PATH
psopt="-e"
case in
[a-z]*) psopt="-u ";shift;;
esac
[ -z "" ] &&
exec ps $psopt -Ho pid=,args=
#some effort to add less to the ps list
tmp=/tmp/ptree.$$
trap 'rm $tmp' 0 HUP INT TERM
ps $psopt -Ho pid=,args= >$tmp
<$tmp awk '
{ ci=index(substr([=10=],7),); o[ci]=[=10=] }
ci>s[a] { s[++a]=ci }
==pid {
for(i=1;i<=a;i++) {
si=s[i]; if(si<=ci) print o[si]
}
walkdown=ci
next
}
ci<walkdown { exit }
walkdown!=0 { print }
' pid=""
正如 Java 表现 所说:
Solaris prstat has additional capabilities such as reporting both user and kernel or system CPU utilization along with other microstate information using the prstat -m and -L options. The -m option prints microstate information, and -L prints statistics on per lightweight process.
Centos 或 Ubuntu 中是否有可用的工具,如 prstat?
Linux 中没有 prstat "equivalent" 工具。您可以结合使用 top 和 ps(或 /proc/$pid/ 资源)来获得一些有用的结果;也许编写一个 shell 脚本(使用 grep、sed 和 awk)来收集上述命令和文件的结果。 仅供参考,我发现这个 link 关于顶级命令和内核、用户和空闲 CPU 利用率有趣
http://blog.scoutapp.com/articles/2015/02/24/understanding-linuxs-cpu-stats
希望这个帮助ps。
我相信您正在寻找的 Linux 命令是 top 和 pstree 。
这是 ptree 用于 Linux,
#!/bin/sh
# Solaris style ptree
[ -x /usr/bin/ptree ] && exec /usr/bin/ptree "$@"
# Print process tree
# = PID : extract tree for this process
# = user : filter for this (existing) user
# = user = PID : do both
PATH=/bin:/usr/bin:/usr/sbin:/sbin
export PATH
psopt="-e"
case in
[a-z]*) psopt="-u ";shift;;
esac
[ -z "" ] &&
exec ps $psopt -Ho pid=,args=
#some effort to add less to the ps list
tmp=/tmp/ptree.$$
trap 'rm $tmp' 0 HUP INT TERM
ps $psopt -Ho pid=,args= >$tmp
<$tmp awk '
{ ci=index(substr([=10=],7),); o[ci]=[=10=] }
ci>s[a] { s[++a]=ci }
==pid {
for(i=1;i<=a;i++) {
si=s[i]; if(si<=ci) print o[si]
}
walkdown=ci
next
}
ci<walkdown { exit }
walkdown!=0 { print }
' pid=""