Skip to content

d0k1/openj9cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenJ9 Diagnostic tool

OpenJ9 doesn't have any command line diagnostic utilities like jstack / jmap / jstat / jcmd. It is because OpenJ9 does not have Attach API extensions as OpenJDK have at the moment. This project demonstrates abilities of Attach API in OpenJ9 that are added with eclipse-openj9/openj9#2543

Build

You need Eclipse OpenJ9 JDK and Apache Maven.

  • Define environmental variable JAVA_HOME. It must point to OpenJ9 jdk directory.
  • Run mvn clean package That's it. target directory will contains openj9cmd-1.0.jar

Prepare

You cant wrap this tool into shell script, for example openj9cmd.sh

${JAVA_HOME}/bin/java -classpath ${JAVA_HOME}/jre/lib/charsets.jar:${JAVA_HOME}/jre/lib/ext/cldrdata.jar:${JAVA_HOME}/jre/lib/ext/dnsns.jar:${JAVA_HOME}/jre/lib/ext/dtfj.jar:${JAVA_HOME}/jre/lib/ext/dtfjview.jar:${JAVA_HOME}/jre/lib/ext/jaccess.jar:${JAVA_HOME}/jre/lib/ext/localedata.jar:${JAVA_HOME}/jre/lib/ext/nashorn.jar:${JAVA_HOME}/jre/lib/ext/sunec.jar:${JAVA_HOME}/jre/lib/ext/sunjce_provider.jar:${JAVA_HOME}/jre/lib/ext/sunpkcs11.jar:${JAVA_HOME}/jre/lib/ext/traceformat.jar:${JAVA_HOME}/jre/lib/ext/zipfs.jar:${JAVA_HOME}/jre/lib/jce.jar:${JAVA_HOME}/jre/lib/jsse.jar:${JAVA_HOME}/jre/lib/management-agent.jar:${JAVA_HOME}/jre/lib/resources.jar:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/tools.jar:./target/openj9cmd-1.0.jar com.focusit.openj9cmd "$@"

later you can call it

bash ./openj9cmd.sh 31605 threaddump /tmp/threaddump
bash ./openj9cmd.sh 31605 jstack true true jstack.txt

Run

This tool provides just 3 basic functions. It can trigger OpenJ9 JavaDump and HeapDump, and it can get thread dump in jstack fashion.

JavaDump

bash ./openj9cmd.sh PID threaddump PATH/TO/FILE

  • PID processId
  • PATH/TO/FILE file to hold all information

Tip

In my opinion, the best instrument to analyze that kind of dumps is IBM Thread and Monitor Dump Analyzer for Java (https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=2245aa39-fa5c-4475-b891-14c205f7333c)

HeapDump

bash ./openj9cmd.sh PID heapdump PATH/TO/FILE

  • PID processId
  • PATH/TO/FILE file to hold all information

Tip

Heap dump produced by this tool is in PHD (Portable Heap Dump) format. To analyze it you have to install DTJF(IBM Diagnostic Tool Framework for Java) into Eclipse Memory Analyzer Eclipse download site can be found at https://developer.ibm.com/javasdk/tools/ (http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/runtimes/tools/dtfj/)

JStack

bash ./openj9cmd.sh PID jstack LockeMonitors LockedSynchronizers PATH/TO/FILE

  • PID processId
  • LockeMonitors whether or not information on all currently locked object monitors is to be returned (as for ThreadMXBean's JavaDoc)
  • LockedSynchronizers of whether or not information on all currently locked ownable synchronizers is to be returned (as for ThreadMXBean's JavaDoc)
  • PATH/TO/FILE file to hold all information

Releases

No releases published

Packages

No packages published