【转载】查看Linux进程CPU过高具体的线程堆栈(不中断程序)
具体的命令经常忘记,毕竟用的不是很多。为了避免去找备份一下
1、TOP命令,找到占用CPU最高的进程
$ top
top - 20:11:45 up 850 days, 1:18, 3 users, load average: 1.04, 1.01, 0.99
Tasks: 61 total, 1 running, 60 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.4% us, 0.1% sy, 0.0% ni, 98.3% id, 0.1% wa, 0.0% hi, 0.2% si
Mem: 16418172k total, 15693376k used, 724796k free, 1146696k buffers
Swap: 10223608k total,0k used, 10223608k free, 12537692k cached
PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND
24714 ztgame16 0 1409m 1.2g 4252 S 99.6 7.4 2390:57 IMVChannelServe
1 root 16 0 4772 520 432 S 0.0 0.0 0:03.43 init
2 root RT 0 000 S 0.0 0.0 0:05.75 migration/0
3 root 34 19 000 S 0.0 0.0 5:22.97 ksoftirqd/0
4 root RT 0 000 S 0.0 0.0 0:07.90 migration/1
5 root 34 19 000 S 0.0 0.0 0:00.27 ksoftirqd/1
6 root RT 0 000 S 0.0 0.0 0:04.07 migration/2
7 root 34 19 000 S 0.0 0.0 0:00.47 ksoftirqd/2
8 root RT 0 000 S 0.0 0.0 0:04.00 migration/3
9 root 34 19 000 S 0.0 0.0 0:00.33 ksoftirqd/3
2、通过TOP -H -p 进程ID,找到具体的线程占用情况,Shift+H可以开启关闭线程显示
$ top -H -p 24714
top - 20:15:30 up 850 days, 1:22, 3 users, load average: 1.26, 1.09, 1.02
Tasks: 16 total, 1 running, 15 sleeping, 0 stopped, 0 zombie
Cpu(s): 24.8% us, 0.3% sy, 0.0% ni, 73.1% id, 0.0% wa, 0.0% hi, 1.8% si
Mem: 16418172k total, 15701376k used, 716796k free, 1146704k buffers
Swap: 10223608k total,0k used, 10223608k free, 12546048k cached
PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND
24729 ztgame16 0 1409m 1.2g 4252 R 97.0 7.4 2307:22 IMVChannelServe
24721 ztgame15 0 1409m 1.2g 4252 S 2.0 7.4 84:22.40 IMVChannelServe
24714 ztgame16 0 1409m 1.2g 4252 S 0.0 7.4 0:03.80 IMVChannelServe
24716 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.00 IMVChannelServe
24717 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.04 IMVChannelServe
24718 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.00 IMVChannelServe
24719 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.08 IMVChannelServe
24720 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.01 IMVChannelServe
24722 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.00 IMVChannelServe
24723 ztgame16 0 1409m 1.2g 4252 S 0.0 7.4 0:00.00 IMVChannelServe
24724 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.01 IMVChannelServe
24725 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:09.83 IMVChannelServe
24726 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.00 IMVChannelServe
24727 ztgame15 0 1409m 1.2g 4252 S 0.0 7.4 0:00.76 IMVChannelServe
24728 ztgame16 0 1409m 1.2g 4252 S 0.0 7.4 0:00.53 IMVChannelServe
24730 ztgame16 0 1409m 1.2g 4252 S 0.0 7.4 2:42.18 IMVChannelServe
3、通过命令pstack 进程ID显示线程堆栈,LWP 24729对应线程ID的堆栈,就是占用CPU最高的堆栈,可以具体分析什么原因造成的。
$ pstack 24714
Thread 16 (Thread 1084229984 (LWP 24716)):
#0 0x00000039c5a901d5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1 0x00000039c5ac3058 in usleep () from /lib64/tls/libc.so.6
#2 0x00000000005ebe10 in zVerifyThread::run ()
#3 0x00000000005e9d29 in zThread::threadFunc ()
#4 0x00000039c6106137 in start_thread () from /lib64/tls/libpthread.so.0
#5 0x00000039c5ac9883 in clone () from /lib64/tls/libc.so.6
Thread 15 (Thread 1094719840 (LWP 24717)):
#0 0x00000039c5a901d5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1 0x00000039c5ac3058 in usleep () from /lib64/tls/libc.so.6
#2 0x00000000005ebe10 in zVerifyThread::run ()
#3 0x00000000005e9d29 in zThread::threadFunc ()
#4 0x00000039c6106137 in start_thread () from /lib64/tls/libpthread.so.0
#5 0x00000039c5ac9883 in clone () from /lib64/tls/libc.so.6
Thread 14 (Thread 1105209696 (LWP 24718)):
#0 0x00000039c5a901d5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1 0x00000039c5ac3058 in usleep () from /lib64/tls/libc.so.6
#2 0x00000000005ebe10 in zVerifyThread::run ()
#3 0x00000000005e9d29 in zThread::threadFunc ()
#4 0x00000039c6106137 in start_thread () from /lib64/tls/libpthread.so.0
#5 0x00000039c5ac9883 in clone () from /lib64/tls/libc.so.6
Thread 13 (Thread 1115699552 (LWP 24719)):
#0 0x00000039c5a901d5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1 0x00000039c5ac3058 in usleep () from /lib64/tls/libc.so.6
#2 0x00000000005ebe10 in zVerifyThread::run ()
#3 0x00000000005e9d29 in zThread::threadFunc ()
#4 0x00000039c6106137 in start_thread () from /lib64/tls/libpthread.so.0
#5 0x00000039c5ac9883 in clone () from /lib64/tls/libc.so.6
Thread 3 (Thread 1220598112 (LWP 24729)):
#0 0x00000039c5a71e87 in memset () from /lib64/tls/libc.so.6
#1 0x00000000004fa591 in ChannelTask::forwardToClientByMedia ()
#2 0x0000000000506220 in ChannelTask::parseClientMsg_Normal ()
#3 0x000000000051ef55 in ChannelTask::parseClientMsg ()
#4 0x000000000051f070 in ChannelTask::cmdMsgParse_Forward ()
#5 0x000000000051f1d1 in ChannelTask::cmdMsgParse ()
#6 0x000000000051f414 in ChannelTask::processCmd ()
#7 0x0000000000523ea8 in ChannelTaskManager::processCmd ()
#8 0x0000000000525ddd in ChannelTimeTick::run ()
#9 0x00000000005e9d29 in zThread::threadFunc ()
#10 0x00000039c6106137 in start_thread () from /lib64/tls/libpthread.so.0
#11 0x00000039c5ac9883 in clone () from /lib64/tls/libc.so.6
Thread 2 (Thread 1231087968 (LWP 24730)):
#0 0x00000039c610af8b in __lll_mutex_lock_wait ()
#1 0x0000000000000001 in ?? ()
#2 0x0000000000000065 in ?? ()
#3 0x00000039c6107d87 in pthread_mutex_lock () from /lib64/tls/libpthread.so.0
#4 0x0000003a500ae29e in operator delete () from /usr/lib64/libstdc++.so.6
#5 0x000000000053f59d in ChannelLoadClient::processCmd_DB ()
#6 0x00000000005986c9 in GameAppClient::processTaskCmd_DB ()
#7 0x00000039c5a901e3 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#8 0x0000000000000000 in ?? ()
Thread 1 (Thread 182894183104 (LWP 24714)):
#0 0x00000039c5ac9c5c in epoll_wait () from /lib64/tls/libc.so.6
#1 0x0000000000620cac in zTCPServer::accept ()
#2 0x00000000005f9c0d in zNetService::serviceCallback ()
#3 0x00000000005f89e3 in zService::main ()
#4 0x0000000000564298 in main ()
本文永久更新地址:http://www.linuxdiyf.com/linux/18227.html
【转载】查看Linux进程CPU过高具体的线程堆栈(不中断程序)的更多相关文章
- 查看Linux进程CPU过高具体的线程堆栈(不中断程序)
转自:http://blog.csdn.net/mergerly/article/details/47731305 1.TOP命令,找到占用CPU最高的进程 $ top top - 20:11:45 ...
- linux ps命令,查看某进程cpu和内存占用率情况, linux ps命令,查看进程cpu和内存占用率排序。 不指定
背景:有时需要单看某个进程的CPU及占用情况,有时需要看整体进程的一个占用情况.一. linux ps命令,查看某进程cpu和内存占用率情况[root@test vhost]# ps auxUSER ...
- Java进程CPU使用率高排查
Java进程CPU使用率高排查 生产java应用,CPU使用率一直很高,经常达到100%,通过以下步骤完美解决,分享一下.1.jps 获取Java进程的PID.2.jstack pid >> ...
- 查看linux服务器CPU相关
查看linux服务器CPU相关: 1.查看物理CPU个数 cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l 2.查看 ...
- 查看Linux服务器CPU总核数
下面介绍查看Linux服务器CPU总核数的方法. 通过/proc/cpuinfo可查看CPU个数及总核数. [root@kevin ~]# grep processor /proc/cpuinfo | ...
- linux查看某个进程CPU消耗较高的具体线程或程序的方法
目前我们的监控,可以发现消耗较高CPU的进程(阀值为3个CPU),通过监控我们可以找到消耗较高CPU的进程号: 通过进程号pid,我们在linux上可以通过top –H –p <pid> ...
- java进程CPU飙高
因为这段时间一直在弄监控,但是工作还是在进行中 因为机器不多,所以今天早上巡检了一下,看到一台生产机器上的CPU飙高 top
- JVM进程cpu飙高分析
在项目快速迭代中版本发布频繁 近期上线报错一个JVM导致服务器cpu飙高 但内存充足的原因现象. 对于耗内存的JVM程序来而言, 基本可以断定是线程僵死(死锁.死循环等)问题. 这里是纪录一下排 ...
- JVM 之 Linux定位CPU过高问题及优化
项目部署以后出行卡顿现象,所以对问题进行了排查,记录一下排查过程 (从CSDN编辑器贴过来的,图有水印) 1.找进程 top 可以发现,是Java进程导致的CPU过高,致使系统卡顿 2.找线程 ps ...
随机推荐
- 前端学习(八)sass和bootstrap(笔记)
less sass 和less基本上70%差不多(书写方式不一样) sass功能更多一点 1.定义一个变量 $b:blue; div{width:100px;height:100px; backgro ...
- HBase之BlockCache数据读取(转)
转自:http://blog.csdn.net/u014297175/article/details/47976909 Hbase上Regionserver的内存分为两个部分,一部分作为Memstor ...
- idea 右键没有class文件的问题,,
修改文件夹的 属性 蓝色即为java代码,,绿色为test,,等等
- vue-resource请求
man.js引入 import Vue from 'vue' import VueResource from 'vue-resource' import App from './App.vue' Vu ...
- bypass_safedog
1.SQL注入 手工bypass要点 先通过破坏关键字测试出拦截规则 之后进行针对性绕过 1.Mysql 1.1.联合注入 0x01 and绕过 直接 and 1=1 直接就会被拦截 在数值的前面加特 ...
- Java高并发网络编程(二)BIO
一.阻塞 服务器端 public class BIOServer { public static void main(String[] args) throws Exception { ServerS ...
- pro、pre、test、dev环境
开发过程中四个环境分别是:pro.pre.test.dev环境,中文名字:生产环境.灰度环境.测试环境.开发环境 环境介绍: pro环境:生产环境,面向外部用户的环境,连接上互联网即可访问的正式环境. ...
- ueditor不能上传mp4格式的视频--解决方案
1.ueditor.all.js 去掉所有的 type="application/x-shockwave-flash" 2.ueditor.all.min.js 去掉所有的 typ ...
- 听说这个FFT跑得巨jb快
#pragma GCC target ("avx2") #include <immintrin.h> #include<bits/stdc++.h> usi ...
- 选择排序-Python & Java
选择排序:1.找出最小的数值放在第一位2.找出剩余数据中最小的数值放在第二位,以此类推,直到最后一个数值 算法的时间复杂度为:O(n) ''' 选择排序: 1.找出最小的数值放在第一位 2.找出剩余数 ...