GithubHelp home page GithubHelp logo

jvm-profiling-toolkit's Introduction

JVM profiling toolkit

Viewer for collapsed stack and JFR outputs of profiles. Dedicated to Async-profiler 2.x, but works also with Async-profiler 1.x and Java Flight Recorder.

ECID functionality

To benefit from filters with ECID you need to use precompiled Async-profiler from PR, and make use of a new API created there.

JAVA_HOME should point to JDK 17.

How to install - from sources

git clone --depth 1 https://github.com/krzysztofslusarski/jvm-profiling-toolkit.git
cd jvm-profiling-toolkit/
mvn clean package

How to run

java -jar viewer-application/target/viewer-application.jar

Java should point to JDK 11. After you run it, viewer is available on http://localhost:8079/.

How to configure

Viewer is Spring Boot application, you can create application.yml with:

server:
  port: 8079 

Example usage od Async-profiler for collapsed stack

./profiler -t -d 30 -e cpu -o collapsed -f output.txt <pid>

  • -t - gives you output divided by thread
  • -d 30 - 30s duration
  • -e cpu - profiled event, viewer should work with every event
  • -o collapsed - as name suggest, this is collapsed stack viewer, so this is mandatory output
  • -f output.txt - output file
  • <pid> - pid of your JVM

Features of viewer

Analysis of collapsed stack file

Flame graphs

Flame graphs

Viewer can generate flame graphs:

  • Flame graph - common flame graph from your collapsed stack file
  • Flame graph with no thread division - common flame graph with division by thread removed
  • Hotspot flame graph - flame graph that is inverted and reversed, presenting hotspots from collapsed stack file:
    • depth = 10/20/30 - shortened graph with smaller stacks

Method total time

Total time

Total time is number of stacks, that method was anywhere on the stack. Method name can be filtered.

Method self time

Self time

Self time is number of stacks, that method was at the end of the stack. Method name can be filtered.

Callee and callers flame graphs for methods

Callee

Callee graph shows what method is actually doing. This graph is aggregated, so it shows every usage of method.

Callee

Callers graph shows what which method used profiled method. This graph is aggregated, so it shows every usage of method.

Analysis of JFR files

You can add filters to your parser:

  • Thread filter
  • Access log style filter - end date and duration (in milliseconds)
  • Warmup / cooldown filter - this one skips proper number of seconds from the beginning and the end

Collapsed stack files

You can upload multiple JFR files with a single HTTP POST to the analyzer. Analyzer creates following collapsed stack from your JFR file:

  • Wall-clock - if you used Async-profiler in wall mode only
  • CPU - if you used Async-profiler in wall mode the CPU file is made from wall output with stacks that were consuming CPU only
  • Heap allocation (count) - if you used alloc mode - this one presents count of allocations that needed new TLAB or needed allocation outside TLAB
  • Heap allocation (size) - if you used alloc mode - this one presents size of allocations mentioned above
  • Locks - if you used lock mode
  • CPU load
    • JVM system
    • JVM user
    • JVM total
    • Machine total
    • Machine total - JVM total
CPU usage flame graphs

Cpu usage

On example above you can see that the CPU (this one is JVM total) consumed at least 30% of the CPU for 71,21% of time.

Other JFR information

JFR viewer will also show you:

  • OS Info
  • CPU Info
  • Initial system properties
  • JVM Info

If you upload multiple files then last information parsed is present in those sections.

jvm-profiling-toolkit's People

Contributors

krzysztofslusarski avatar sarkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sarkie benevans

jvm-profiling-toolkit's Issues

Thread filter not working

Adding a thread filter hides completely the flame graph, although there are threads that would match..

Example without filter:

image

With filter Core:

image

Failure executing `mvn clean package`

mvn clean package fails on my laptop:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project common: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :common

Caused by: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
    at lombok.javac.JavacImportList.getFullyQualifiedNameForSimpleNameNoAliasing (JavacImportList.java:53)
    at lombok.core.TypeResolver.typeRefToFullyQualifiedName (TypeResolver.java:60)
    at lombok.javac.HandlerLibrary.handleAnnotation (HandlerLibrary.java:247)
    at lombok.javac.JavacTransformer$AnnotationVisitor.visitAnnotationOnType (JavacTransformer.java:79)
    at lombok.javac.JavacNode.traverse (JavacNode.java:132)
    at lombok.javac.JavacAST.traverseChildren (JavacAST.java:222)
    at lombok.javac.JavacNode.traverse (JavacNode.java:95)
    at lombok.javac.JavacAST.traverseChildren (JavacAST.java:222)
    at lombok.javac.JavacNode.traverse (JavacNode.java:90)
    at lombok.javac.JavacAST.traverse (JavacAST.java:218)
    at lombok.javac.JavacTransformer.transform (JavacTransformer.java:63)
    at lombok.javac.apt.LombokProcessor.process (LombokProcessor.java:328)
    at lombok.core.AnnotationProcessor$JavacDescriptor.process (AnnotationProcessor.java:187)
    at lombok.core.AnnotationProcessor.process (AnnotationProcessor.java:241)
    at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.process (AnnotationProcessor.java:90)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:1021)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs (JavacProcessingEnvironment.java:937)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run (JavacProcessingEnvironment.java:1265)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1380)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1272)
    at com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:946)
    at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0 (JavacTaskImpl.java:104)
    at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper (JavacTaskImpl.java:152)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:126)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:174)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1134)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

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.