HP-UX:每个进程的线程

时间:2011-06-01 10:41:27

标签: multithreading hp-ux

HP-UX上是否有命令检查和查看与进程/任务相关的所有线程。

不支持ps -m。

2 个答案:

答案 0 :(得分:1)

您可以使用pstack显示属于特定进程的线程的堆栈跟踪。它还会为您提供LWPID(线程ID)。例如:

$ whereis pstack
pstack: /usr/ccs/bin/pstack /usr/share/man/man1.Z/pstack.1

$ ps -ef|grep snmpAgt|grep -v grep
   utest 27447     1  0  Aug 26  ?        1544:45 /opt/java6/bin/IA64N/java -DsnmpAgtCfg=./etc/snmpAgt.cfg -Duser.timezone=GMT+8 com.hp.snmpagt.main.SnmpAgtMain

$ pstack 27447|head -30           
27447:  /opt/java6/bin/IA64N/java

--------------------------------  lwpid : 5549697   -------------------------------

 0: 60000000c0380670 : _nanosleep_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)
 1: 60000000c038f360 : nanosleep() + 0xa0 (/usr/lib/hpux32/libc.so.1)
 2: 60000000c89c4ac0 : _Z8os_sleepxb() + 0xa90 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 3: 60000000c89d5140 : _ZN2os5sleepEP6Threadxb() + 0x200 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 4: 60000000c83b51a0 : JVM_Sleep() + 0x340 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 5: 2000000073400ed0 : (unknown) () (unknown)

--------------------------------  lwpid : 5549698   -------------------------------

 0: 60000000c0379e50 : __ksleep() + 0x30 (/usr/lib/hpux32/libc.so.1)
 1: 60000000c013aa10 : __mxn_sleep() + 0xaf0 (/usr/lib/hpux32/libpthread.so.1)
 2: 60000000c00d1f50 : pthread_cond_wait() + 0xdd0 (/usr/lib/hpux32/libpthread.so.1)
 3: 60000000c00d1210 : pthread_cond_wait() + 0x90 (/usr/lib/hpux32/libpthread.so.1)
 4: 60000000c89c1880 : _Z13thread_helperPv() + 0x3b0 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 5: 60000000c00e2060 : __pthread_bound_body() + 0x170 (/usr/lib/hpux32/libpthread.so.1)

--------------------------------  lwpid : 5549699   -------------------------------

 0: 60000000c0379e50 : __ksleep() + 0x30 (/usr/lib/hpux32/libc.so.1)
 1: 60000000c013aa10 : __mxn_sleep() + 0xaf0 (/usr/lib/hpux32/libpthread.so.1)
 2: 60000000c00d1f50 : pthread_cond_wait() + 0xdd0 (/usr/lib/hpux32/libpthread.so.1)
 3: 60000000c00d1210 : pthread_cond_wait() + 0x90 (/usr/lib/hpux32/libpthread.so.1)
 4: 60000000c89e2bb0 : _ZN2os13PlatformEvent4parkEv() + 0x330 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 5: 60000000c8947df0 : _ZN7Monitor5IWaitEP6Threadx() + 0x1a0 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 6: 60000000c8948c30 : _ZN7Monitor4waitEblb() + 0x2b0 (/opt/java6/jre/lib/IA64N/server/libjvm.so)
 7: 60000000c80ab6c0 : _ZN13GCTaskManager8get_taskEj() + 0xa0 (/opt/java6/jre/lib/IA64N/server/libjvm.so)

答案 1 :(得分:0)

使用一瞥

  1. %glance
  2. SlctProc(F6)
  3. 输入PID(14065): 14389
  4. <强“G
  5. ... 
    
    Thread List PID: 14389, xxxxx          PPID: 14241 euid:   112 User: xxxxxxx
                CPU Util    CPU Tm      Phys          Logl                    Block
      TID    ( 600x% max)    Cum       IO Rate      IO Rate   Scheduler  Pri   On
    --------------------------------------------------------------------------------
    7744076    0.0/   0.0    21.1    0.0/   0.0    0.0/   0.0      HPUX  168  SLEEP
    7745285    0.0/   0.0     0.0    0.0/   0.0    0.0/   0.0      HPUX  152  SOCKT
    7745286    0.0/   0.0     0.0    0.0/   0.0    0.0/   0.0      HPUX  154  SOCKT
    7745287    1.5/   1.7 12092.2    0.0/   0.0    0.5/   1.4      HPUX  154  SLEEP
    7745288    0.0/   0.0    46.7    0.0/   0.0    0.0/   0.0      HPUX  154  SLEEP
    7745290    0.0/   0.0   578.4    0.0/   0.0    2.3/   0.0      HPUX  168  SLEEP
    6471709    0.0/   0.0     0.0    0.0/   0.0    0.0/   0.0      HPUX  152  JOBCL