菜鸟笔记
提升您的技术认知

linux pstack命令-ag真人游戏

阅读 : 1223

linux 命令大全

linux pstack命令可显示每个进程的栈跟踪。pstack 命令必须由相应进程的属主或 root 运行。可以使用 pstack 来确定进程挂起的位置。此命令允许使用的唯一选项是要检查的进程的 pid。

实例

pstree命令以树结构显示进程

pstree -p work | grep ad
sshd(22669)---bash(22670)---ad_preprocess(4551)- -{ad_preprocess}(4552)
                                                |-{ad_preprocess}(4553)
                                                |-{ad_preprocess}(4554)
                                                |-{ad_preprocess}(4555)
                                                |-{ad_preprocess}(4556)
                                                `-{ad_preprocess}(4557)

work为工作用户,-p为显示进程识别码,ad_preprocess共启动了6个子线程,加上主线程共7个线程。

ps -lf 4551
uid        pid  ppid   lwp  c nlwp stime tty      stat   time cmd
work      4551 22670  4551  2    7 16:30 pts/2    sl     0:02 ./ad_preprocess
work      4551 22670  4552  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess
work      4551 22670  4553  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess
work      4551 22670  4554  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess
work      4551 22670  4555  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess
work      4551 22670  4556  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess
work      4551 22670  4557  0    7 16:30 pts/2    sl     0:00 ./ad_preprocess

进程共启动了7个线程

pstack显示每个进程的栈跟踪:

pstack 4551
thread 7 (thread 1084229984 (lwp 4552)):
#0  0x000000302afc63dc in epoll_wait () from /lib64/tls/libc.so.6
#1  0x00000000006f0730 in ub::epollex::poll ()
#2  0x00000000006f172a in ub::netreactor::callback ()
#3  0x00000000006fbbbb in ub::ubtask::callback ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
thread 6 (thread 1094719840 (lwp 4553)):
#0  0x000000302afc63dc in epoll_wait () from /lib64/tls/libc.so.6
#1  0x00000000006f0730 in ub::epollex::poll ()
#2  0x00000000006f172a in ub::netreactor::callback ()
#3  0x00000000006fbbbb in ub::ubtask::callback ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
thread 5 (thread 1105209696 (lwp 4554)):
#0  0x000000302b80baa5 in __nanosleep_nocancel ()
#1  0x000000000079e758 in comcm::ms_sleep ()
#2  0x00000000006c8581 in ub::ubclientmanager::healthycheck ()
#3  0x00000000006c8471 in ub::ubclientmanager::start_healthy_check ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
thread 4 (thread 1115699552 (lwp 4555)):
#0  0x000000302b80baa5 in __nanosleep_nocancel ()
#1  0x0000000000482b0e in armor::armor_check_thread ()
#2  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#3  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#4  0x0000000000000000 in ?? ()
thread 3 (thread 1126189408 (lwp 4556)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x000000000044c972 in business_config_manager::run ()
#3  0x0000000000457b83 in thread::run_thread ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
thread 2 (thread 1136679264 (lwp 4557)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x00000000004524bb in process_thread::sleep_period ()
#3  0x0000000000452641 in process_thread::run ()
#4  0x0000000000457b83 in thread::run_thread ()
#5  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#6  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#7  0x0000000000000000 in ?? ()
thread 1 (thread 182894129792 (lwp 4551)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x0000000000420d79 in ad_preprocess::run ()
#3  0x0000000000450ad0 in main ()

linux 命令大全

网站地图