Process Debugging - Information Collection

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Process Debugging - Information Collection

System level information Finding processes


1. Version of the operating system 1. Find top 10 processes by %CPU usage
more /etc/redhat-release ps -eo %cpu,pid,cmd | sort -nr | head -
10
2. Patch Level
2. Find top 10 processes by %resident memory usage
rpm -qa
ps -eo %mem,pid,cmd | sort -nr | head -
3. Up time 10
uptime 3. Find process identifier by port number
4. Current processes lsof -i:<port> | grep "\(LISTEN\)" |
top -bcn 1 awk '{print $2}'
5. Swap memory 4. Find processes of a specific user
free -mt top -bcn 1 -u <user_login>
6. Virtual memory statistics 5. Find all java processes
vmstat 5 5 top -bcn 1 -p `pgrep java | tr "\n" ","
| sed 's/,$//'`
7. System activity
sar

Process Information Java Process Information


1. Process state 1. Stack trace
top -bcn 1 -p <pid> jstack <pid>
2. Process state including threads 2. Heap summary
top -Hbcn 1 -p <pid> jmap -heap <pid>
3. Open files 3. GC Information
lsof -p <pid> jstat -gc <pid> 250 20
4. Network connections
netstat -an | grep <port_number>
Utilities
1. Convert core dump to heap dump
lsof -i:<port_number>
jmap -
5. Process activity (10 seconds) dump:format=b,file=jvm.<pid>.hprof
strace -t -e trace=network,file,process /usr/local/java/jdk/bin/java
-fp <pid> & sleep 10 ; kill $! ./core.<pid>
6. Memory map 2. Reading specific memory location from a process
pmap -x <pid> cat /proc/<pid>/maps
7. Stack trace gdb --pid <pid>
pstack <pid> (gdb) dump memory mem.<pid>.bin
0x00621000 0x00622000
8. Core file (!make sure that there is enough space, core
hexdump -C mem.<pid>.bin | less
files can be large)
gcore -o core <pid>

Profilers References
 http://docs.oracle.com/cd/E19857-01/820-
 Eclipse MAT 4983/gebbt/index.html
 JProfiler  http://docs.oracle.com/cd/E19159-01/820-
2974/gboyx/index.html
 http://stackoverflow.com/questions/1765311/viewing-file-in-
binary-in-terminal

[email protected]

You might also like