0% found this document useful (0 votes)
11 views1 page

Process Debugging - Information Collection

1. This document provides information on collecting various system and process level diagnostics for debugging purposes. It outlines steps to gather operating system details, find specific processes, collect process information, analyze Java processes, use profiling and debugging utilities, and references additional resources. 2. Key process debugging steps include finding top processes by CPU/memory usage, process IDs by port, processes of a user, Java stack traces, heap summaries, and GC information. System debugging covers OS version, patches, uptime, current/swap memory, and activity monitoring. 3. Additional process details involve state, threads, open files, network connections, activity monitoring, memory maps, stack traces, and core files. Profiling utilities mentioned are Eclipse

Uploaded by

nehaagrawal2210
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Process Debugging - Information Collection

1. This document provides information on collecting various system and process level diagnostics for debugging purposes. It outlines steps to gather operating system details, find specific processes, collect process information, analyze Java processes, use profiling and debugging utilities, and references additional resources. 2. Key process debugging steps include finding top processes by CPU/memory usage, process IDs by port, processes of a user, Java stack traces, heap summaries, and GC information. System debugging covers OS version, patches, uptime, current/swap memory, and activity monitoring. 3. Additional process details involve state, threads, open files, network connections, activity monitoring, memory maps, stack traces, and core files. Profiling utilities mentioned are Eclipse

Uploaded by

nehaagrawal2210
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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
 [Link]
 Eclipse MAT 4983/gebbt/[Link]
 JProfiler  [Link]
2974/gboyx/[Link]
 [Link]
binary-in-terminal

[Link]@[Link]

Common questions

Powered by AI

To identify the top ten CPU-consuming processes, use the command `ps -eo %cpu,pid,cmd | sort -nr | head -10`. This list is useful for diagnosing performance bottlenecks or understanding system load distribution .

To identify open files for a specific process ID, the `lsof -p <pid>` command is used. It lists all files that are opened by the given process .

Convert a core dump to a heap dump using the command `jmap -dump:format=b,file=jvm.<pid>.hprof /usr/local/java/jdk/bin/java ./core.<pid>`. This is used for analyzing Java heap memory to find memory leaks or inefficient memory use .

To find all JAVA processes, use the command `top -bcn 1 -p \\`pgrep java | tr "\n" "," | sed 's/,$//'\\``. This command uses `pgrep` to list PIDs of all JAVA processes, formats them, and then passes them to `top` for detailed display .

To determine the version of the operating system on a Red Hat-based system, use the command `more /etc/redhat-release`. To find the installed patch level, execute the command `rpm -qa` .

`pstack <pid>` provides a snapshot of stack traces for all threads within a process. This is valuable for diagnosing issues related to process state anomalies, performance drops, or verifying thread execution paths during troubleshooting .

Core dump files can be very large and contain detailed memory snapshots which aid in debugging. Storage considerations are crucial to avoid disk space issues, potentially hindering system operations .

A stack trace for a Java process is obtained using the command `jstack <pid>`. This information helps in diagnosing hangs, deadlocks, or performance bottlenecks by showing the call stack of each thread in the Java virtual machine .

To check network connections for a specific port, use either `netstat -an | grep <port_number>` or `lsof -i:<port_number>`. These commands display current network connections involving the specified port .

The `strace` command traces system calls and signals, revealing a process's interaction with the operating system. For network, file, and process tracing over 10 seconds, use `strace -t -e trace=network,file,process -fp <pid> & sleep 10 ; kill $!` .

You might also like