Skip to content

Instantly share code, notes, and snippets.

@ouyi
Created January 27, 2018 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ouyi/26bc2947fa09f27460cd096dbbf29744 to your computer and use it in GitHub Desktop.
Save ouyi/26bc2947fa09f27460cd096dbbf29744 to your computer and use it in GitHub Desktop.
Thread dump in Java
top # list processes, shift+p to sort processes by CPU usage
top -H -p <pid> # list threads, shift+p to sort threads by CPU usages
printf "%x\n" <tid> # convert tid to hexadecimal, called nid
jstack -l <pid> | grep -i <nid> -A 15 # get stack trace of the thread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment