Superkkt Blog

pstack 이라는 명령어가 있다. 원래는 프로세스의 스택 정보를 보여주는 명령어인데, 멀티 쓰레드 프로그램의 경우 쓰레드 별로 스택 정보를 보여주기 때문에 쓰레드의 상태를 확인하는 용도로도 사용 할 수 있다.

[root@newmail14 ~]# pstack 1424
Thread 6 (Thread -1209050192 (LWP 1425)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0083cb26 in pthread_cond_wait@@GLIBC_2.3.2 ()
#2  0x00a0fcb8 in recv_signal () from /usr/local/lib/libpxe.so.1
#3  0x00a0ea3c in agent_controller () from /usr/local/lib/libpxe.so.1
#4  0x0083a371 in start_thread () from /lib/tls/libpthread.so.0
#5  0x00725ffe in clone () from /lib/tls/libc.so.6
Thread 5 (Thread -1219540048 (LWP 1426)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0071ea41 in ___newselect_nocancel () from /lib/tls/libc.so.6
#2  0x00a10272 in receiver () from /usr/local/lib/libpxe.so.1
#3  0x0083a371 in start_thread () from /lib/tls/libpthread.so.0
#4  0x00725ffe in clone () from /lib/tls/libc.so.6
Thread 4 (Thread -1230029904 (LWP 1427)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0083cb26 in pthread_cond_wait@@GLIBC_2.3.2 ()
#2  0x00a0ff78 in pop_queue () from /usr/local/lib/libpxe.so.1
#3  0x00a0e283 in pxe_read () from /usr/local/lib/libpxe.so.1
#4  0x0804a8e3 in core ()
#5  0x0083a371 in start_thread () from /lib/tls/libpthread.so.0
#6  0x00725ffe in clone () from /lib/tls/libc.so.6
Thread 3 (Thread -1240519760 (LWP 1428)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0083cb26 in pthread_cond_wait@@GLIBC_2.3.2 ()
#2  0x00a0ff78 in pop_queue () from /usr/local/lib/libpxe.so.1
#3  0x00a0e283 in pxe_read () from /usr/local/lib/libpxe.so.1
#4  0x0804bdf9 in dir_navigator ()
#5  0x0083a371 in start_thread () from /lib/tls/libpthread.so.0
#6  0x00725ffe in clone () from /lib/tls/libc.so.6
Thread 2 (Thread -1251009616 (LWP 1429)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0083cb26 in pthread_cond_wait@@GLIBC_2.3.2 ()
#2  0x00a0ff78 in pop_queue () from /usr/local/lib/libpxe.so.1
#3  0x00a0e283 in pxe_read () from /usr/local/lib/libpxe.so.1
#4  0x0804c404 in show_status ()
#5  0x0083a371 in start_thread () from /lib/tls/libpthread.so.0
#6  0x00725ffe in clone () from /lib/tls/libc.so.6
Thread 1 (Thread -1209046720 (LWP 1424)):
#0  0x006407a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0083b0fd in pthread_join () from /lib/tls/libpthread.so.0
#2  0x00a0e3f0 in pxe_sleep () from /usr/local/lib/libpxe.so.1
#3  0x0804a4bf in main ()

아직 좀 아쉬운 점이 있다면, 여러개의 CPU를 사용하는 시스템에서 어떤 쓰레드가 어떤 CPU에 올라가 있는지 보는 방법도 있으면 좋겠는데 아무리 검색해봐도 못찾겠다.

-추가-
procps 패키지를 최신버전(3.2.7)으로 컴파일해서 설치하고 top에서 shift + h를 누르면 쓰레드별로 자세한 정보를 보여준다. :-) 그런데 소스코드를 다운로드 받을때 GNU 사이트에서 받은거는 컴파일하고 설치해도 shift + h 키가 안먹혔는데, 소스포지에 있는 코드를 다운 받아서 설치하니 잘 되더라. 뭐가 문제였는지는 모르겠고.. 아무튼 소스포지에 있는 코드 다운받자.
2007/03/22 10:51 2007/03/22 10:51

trackbacks

trackbacks rss

이 글에는 트랙백을 보낼 수 없습니다

Leave a Comment