ps -eLf | grep pid
查看进程的所有线程
jps -l
11839 kafka.Kafka
54578 kafka.Kafka
99593 -- process information unavailable
11417 org.tanukisoftware.wrapper.WrapperSimpleApp
67658 -- process information unavailable
top -Hp pid
查看进程下的线程CPU使用率
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
45921 root 20 0 537m 50m 10m S 0 0.3 0:02.44 java
45920 root 20 0 537m 50m 10m S 0 0.3 0:00.00 java
jstat -gc pid
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
1024.0 1024.0 997.3 0.0 18432.0 17585.2 22016.0 3972.5 21504.0 3802.9 2 0.014 0 0.000 0.014
----------------------------------------
jmap -dump:format=b,file=heapDump pid
jmap -histo:live pid
jmap -heap pid
Attaching to process ID 45920, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
using thread-local object allocation.
Parallel GC with 4 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 268435456 (256.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 85983232 (82.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 18874368 (18.0MB)
used = 1398912 (1.3341064453125MB)
free = 17475456 (16.6658935546875MB)
7.411702473958333% used
From Space:
capacity = 1048576 (1.0MB)
used = 1021216 (0.973907470703125MB)
free = 27360 (0.026092529296875MB)
97.3907470703125% used
To Space:
capacity = 1048576 (1.0MB)
used = 0 (0.0MB)
free = 1048576 (1.0MB)
0.0% used
PS Old Generation
capacity = 22544384 (21.5MB)
used = 5190120 (4.949684143066406MB)
free = 17354264 (16.550315856933594MB)
23.021786711936773% used
PS Perm Generation
capacity = 22020096 (21.0MB)
used = 3894136 (3.7137374877929688MB)
free = 18125960 (17.28626251220703MB)
17.684464227585565% used
1295 interned Strings occupying 94384 bytes.
----------------------------------------
jstack pid
jstack prints Java stack traces of Java threads for a given Java process or core file or a remote debug server.
打印指定进程中所有的线程栈