Clone this repo:
  1. 996b1d2 Merge tag 'upstream/0.8.1' by Filippo Giunchedi · 6 years ago master
  2. 8503bcb [maven-release-plugin] prepare release jvmtool-umbrella-pom-0.8.1 by Alexey Ragozin · 6 years ago upstream/0.8.1
  3. 337b659 Add debian/ directory by Filippo Giunchedi · 6 years ago
  4. 18f7568 Print sample heading space separated instead of comma separated by Alexey Ragozin · 7 years ago
  5. ce750d3 [dexp] should export multiple all tag values if multiple are available by Alexey Ragozin · 7 years ago

Swiss Java Knife (SJK)

Build Status

SJK is a command line tool for JVM diagnostic, troubleshooting and profiling.

SJK exploits standard diagnostic interfaces of JVM (such as JMX, JVM attach and perf counters) and add some more logic on top to be useful for common troubleshooting case. SJK is also can be used as library for building application specific diagnostic tools or to enhance your code with self monitoring features.

What you can do with SJK?

See full command reference.

Download

Latest prebuild binaries Last Version

Starting sjk

java -jar sjk.jar <cmd> <arguments>
java -jar sjk.jar --commands
java -jar sjk.jar --help <cmd>

Below a few command from SJK (full command reference).

ttop

Pools thread CPU usage of target JVM and periodically report to console.

  • can attach via PID or open JMX port
  • display thread memory allocation rate and cumulative process allocation rate
  • display safe point time consumption (only if attache via PID)

More details

jps

Similar to jps from JDK.

  • plus could display specific system properties of process in output
  • plus could display values of specific -XX for HotSpot JVM processes
  • plus could filter process java processes by their system properties

More details

hh

Similar to jmap -histo.

  • plus can show histogram of dead objects (histograms of all and live requested, then difference is calculated)
  • plus can show N top buckets in histogram

More details

stcap, stcpy and ssa

These commands provide basic sample profiler capabilities. stcap produces hyper-dense stack trace dump (about 1000 compression rate compared to text format) and ssa provides few reports over dump files. stcpy can copy data in archives produced by stcap (e.g. merging dumps or filtering selected threads).

So far following reports are available

  • sophisticated filtering (time, stack trace, thread name)
  • stack frame histogram with advanced filtering options
  • flame graph visualization (SVG)
  • per thread summary (CPU usage, memory allocation, etc)
  • converting back to text format

Dump file can be also processed programatically.

More details

mx

This command allow you to do basic operations with MBean from command line.

It can

  • read MBean attributes
  • update MBean writeable attributes
  • invoke MBean operations (arguments are supported)
  • displays composite and tabular data in human readable format
  • use wild cards to shorten MBean names (e.g. *:*,name=CodeCacheManager instead of java.lang:type=MemoryManager,name=CodeCacheManager)
  • connect to local JVM processes by PID (e.i. any Java process, you do not need to enable JMX server)
  • connect to JMX using host:port (password authentication is supported)

More details

gc

Report information about GC in real time. Data is retrieved via JMX.

More details

mxdump

Dumps all MBeans of target java process to JSON.