linux查看进程内存使用情况,以及将线程情况输出文件
用jmap把进程内存使用情况dump到文件中,再用jhat分析查看。jmap进行dump命令格式如下:
jmap -dump:format=b,file=/tmp/dump.dat 21711 -------->进程id
jhat -port 10099 /tmp/dump.dat
运行在10099端口然后浏览器加端口号浏览器访问
将线程信息
Jstack -l PID >> 123.txt
"startQuertz_Worker-2" prio=10 tid=0x00007fb1e1292000 nid=0x8e4e in Object.wait() [0x00007fb27cc9a000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000583eb9b00> (a java.lang.Object)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
- locked <0x0000000583eb9b00> (a java.lang.Object)
Locked ownable synchronizers:
- None
"startQuertz_Worker-1" prio=10 tid=0x00007fb1e1290000 nid=0x8e4d in Object.wait() [0x00007fb27cd9b000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000583eb96f0> (a java.lang.Object)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
- locked <0x0000000583eb96f0> (a java.lang.Object)
Locked ownable synchronizers:
- None
"ClientReconnectTimer-thread-2" daemon prio=10 tid=0x00007fb1d8001000 nid=0x8e2e waiting on condition [0x00007fb27ce9c000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000005c5f30078> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1085)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)