Skip to content

asb2m10/thop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thop - Java Thread Top

Thop is a Java thread monitoring tool similar to the UNIX utility top. It lists the top CPU thread usage and the current stack traces and threads that are blocked.

I've made this tool to understand what the JVM is doing and what it is waiting for. My stuff (especially in production) is always behind multiples VPNs so X (visualvm) is not an option. It uses the Lanterna pure java library as ssh friendly terminal UI.

Use the 's' key to obtain of full thread dump (snapshot) of the JVM to enable full stack trace browse. The stack will not be updated until the user hit 'ESC'.

Usage

Lanterna and tools.jar (from the jdk lib directory) needs to be on the classpath. See "thop" bash script in the root directory. Right now the thop and thstat will do it's best to find a tools.jar on your machine.

./thop [pid]

You can also use thstat that shows up the thread activity on stdout. Useful if you want to log Java thread activity without the interactive interface.

./thstat [pid] > activity.log

  • For now only Linux/OS X is supported.

Screenshot

Screenshot 1

Key bindings

  • c - config settings dialog
  • h - brings the help page
  • q - quits the application
  • s - gets a full thread dump (snapshot) and browse interactively into this dump by using the arrow keys

Todo

  • Make scrolling available in refresh (non snapshot) mode (mix of full snapshots and dynamic snapshots)
  • Understand why with OperatingSystemMXBean.getProcessCpuLoad() I get very different readings on different servers