如何找出进程在Solaris上使用的线程数?

时间:2011-02-14 22:24:19

标签: operating-system pthreads solaris process sunos

我知道这个过程的pid。 top -H -p <pid>适用于Linux,但我无法在Solaris上运行它:

$ top -H -p 3677
/usr/local/packages/top/bin/top-default: illegal option -- H
Top version 3.5beta7
Usage: top-default [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]
$ top -p 3677
/usr/local/packages/top/bin/top-default: illegal option -- p
Top version 3.5beta7
Usage: top-default [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]

我有哪些选项可以找到进程在Solaris上使用的线程数?

$ uname
SunOS
$ 

1 个答案:

答案 0 :(得分:7)

使用prstat。线程数显示在最后一列(NLWP =轻量级进程数)。

$ prstat -p 1124,4152,1144
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
  1144 jlliagre   22M   11M sleep   59    0   4:16:05 2.2% multiload-apple/1
  4152 jlliagre  374M  182M sleep   59    0   0:24:53 0.9% firefox-bin/11
  1124 jlliagre   71M   52M sleep   59    0   0:31:50 0.2% java/20

Total: 3 processes, 32 lwps, load averages: 0.14, 0.12, 0.11