Linux | c&cpp | Email | github | QQ群:425043908 关注本站

itarticle.cc

您现在的位置是:网站首页 -> Linux 文章内容

Linux下多线程查看工具(pstree、ps、pstack、top -H -p 1254)-itarticl.cc-IT技术类文章记录&分享

发布时间: 9年前Linux 140人已围观返回

1.top 命令,其中H命令可以显示各个线程的情况。(在top命令后,按H键;或者top -H -p 1121)

[root@jay-linux ~]# top -H -p 1121

top - 14:18:20 up 22:32, 4 users, load average: 2.00, 1.99, 1.90

Tasks: 286 total, 1 running, 285 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 3943892k total, 1541540k used, 2402352k free, 164404k buffers

Swap: 4194300k total, 0k used, 4194300k free, 787768k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

10660 root 20 0 1313m 188m 2752 S 2.3 4.9 0:46.78 qemu-system-x86

10661 root 20 0 1313m 188m 2752 S 2.0 4.9 0:39.44 qemu-system-x86

10867 root 20 0 15260 1312 960 R 0.3 0.0 0:00.07 top

1 root 20 0 19444 1560 1252 S 0.0 0.0 0:00.34 init

2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd

....


2. 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 ()

发布时间: 9年前Linux140人已围观返回回到顶端

很赞哦! (1)

文章评论

  • 请先说点什么
    热门评论
    139人参与,0条评论

站点信息

  • 建站时间:2016-04-01
  • 文章统计:728条
  • 文章评论:82条
  • QQ群二维码:扫描二维码,互相交流