Git Product home page Git Product logo

javamemflame's Introduction

javamemflame will generate a flame graph with Java memory allocation information.

Requirements

  • Java 11
  • Apache Maven

Build

mvn clean package

Usage

javamemflame will record memory allocation during the lifetime of the JVM with

java -javaagent:/path/to/javamemflame.jar ...

Then the information can be turned into a flame graph using

java -jar /path/to/javamemflame.jar javamemflame-pid.jfr

The result javamemflame-pid.svg can be viewed with any SVG viewer, like Firefox.

Agent options

The following agent options are supported.

  • delay=<number>: Delays the recording by the specified number of milliseconds.
  • duration=<number>: Record by the specified number of milliseconds.

Multiple options can be selected using the ',' character, like

java -javaagent:/path/to/javamemflame.jar=duration=1000,delay=500 ...

Main options

Output format

The output format of javamemflame can be controlled by

java -jar javamemflame.jar -o svg javamemflame-pid.jfr

Supported values

  • svg: Flame graph
  • txt: Text file

The text file can be turned into a flame graph using FlameGraph

/path/to/FlameGraph/flamegraph.pl --flamechart --color=java javamemflame-pid.txt > javamemflame-pid.svg

Threads

javamemflame can use multiple threads to process the .jfr file faster by

java -jar javamemflame.jar -t 8 javamemflame-pid.jfr

Cut off

javamemflame can filter out allocations under the specified number, and merge them together under a Filtered category. F.ex. cut off at 100 MB

java -jar javamemflame.jar -c 100000000 javamemflame-pid.jfr

Title

The flame graph can be given a title using

java -jar javamemflame.jar --title "My FlameGraph" javamemflame-pid.jfr

Count

The number of allocation counts, instead of their combined size, can be done using

java -jar javamemflame.jar -n javamemflame-pid.jfr

JFR files

Multiple .jfr files can be specified on the command line and their information will be merged

java -jar javamemflame.jar javamemflame-pid1.jfr javamemflame-pid2.jfr

Package filtering

javamemflame can filter on package names, and only include their information

java -jar javamemflame.jar javamemflame-pid.jfr package[,package]*

Thanks to

License

This project is licensed under EPL v2. See the LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.