A Java agent that rewrites bytecode to instrument allocation sites

Overview

The Allocation Instrumenter is a Java agent written using the java.lang.instrument API and ASM. Each allocation in your Java program is instrumented; a user-defined callback is invoked on each allocation.

How to get it

The latest release is available from Maven Central as:

<dependency>
  <groupId>com.google.code.java-allocation-instrumenter</groupId>
  <artifactId>java-allocation-instrumenter</artifactId>
  <version>3.3.0</version>
</dependency>

Basic usage

In order to write your own allocation tracking code, you have to implement the Sampler interface and pass an instance of that to AllocationRecorder.addSampler():

AllocationRecorder.addSampler(new Sampler() {
  public void sampleAllocation(int count, String desc, Object newObj, long size) {
    System.out.println("I just allocated the object " + newObj +
      " of type " + desc + " whose size is " + size);
    if (count != -1) { System.out.println("It's an array of size " + count); }
  }
});

You can also use the allocation instrumenter to instrument constructors of particular classes. You do this by instantiating a ConstructorCallback and passing it to ConstructorInstrumenter.instrumentClass():

try {
  ConstructorInstrumenter.instrumentClass(
      Thread.class, new ConstructorCallback<Thread>() {
        @Override public void sample(Thread t) {
          System.out.println("Instantiating a thread");
        }
      });
} catch (UnmodifiableClassException e) {
  System.out.println("Class cannot be modified");
}

For more information on how to get or use the allocation instrumenter, see Getting Started.

Comments
  • NullPointerException in other shutdown hooks

    NullPointerException in other shutdown hooks

    We are working to make Log4j 2 garbage-free and we are using the Allocation Instrumenter in our unit tests to verify that we don't allocate objects during steady state logging.

    We see our tests randomly fail with this exception:

    Exception in thread "Thread-0" java.lang.NullPointerException
     at com.google.monitoring.runtime.instrumentation.AllocationRecorder.getObjectSize(AllocationRecorder.java:200)
     at com.google.monitoring.runtime.instrumentation.AllocationRecorder.recordAllocation(AllocationRecorder.java:244)
     at java.util.Hashtable.getEnumeration(Hashtable.java:665)
     at java.util.Hashtable.keys(Hashtable.java:329)
     at java.util.logging.LogManager$LoggerContext.getLoggerNames(LogManager.java:688)
     at java.util.logging.LogManager.reset(LogManager.java:1135)
     at java.util.logging.LogManager$Cleaner.run(LogManager.java:248)
    

    I believe this is a bug in AllocationRecorder:

    The NullPointerException above occurs when the (java.util.logging) LogManager$Cleaner shutdown hook allocates a new object and the instrumented bytecode invokes the recordAllocation method.

    The AllocationRecorder also has a shutdown hook which sets its instrumentation field to null. These shutdown hook threads can run at the same time, so if the instrumentation field is set to null after the null check (line 236) but before it is used in getObjectSize (line 200), we get the above exception.

    One solution would be to introduce a local Instrumentation variable, assign the value of the static instrumentation field to the local variable, and do the null check on that local variable. If non-null, call the getObjectSize method with the local Instrumentation variable as one of the parameters. The getObjectSize method would use the passed Instrumentation parameter and should not access the static field.

    opened by remkop 15
  • Instrumenting constructors fails with VerificationError when interacting with classes that lack stack map frames

    Instrumenting constructors fails with VerificationError when interacting with classes that lack stack map frames

    The Java Allocation Instrumenter passes the ClassWriter.COMPUTE_MAXS flag to the ASM ClassWriter during constructor instrumentation. According to the ASM Javadocs:

    for classes whose version is Opcodes.V1_7 of more, this option requires valid stack map frames. The maximum stack size is then computed from these frames, and from the bytecode instructions in between. If stack map frames are not present or must be recomputed, used COMPUTE_FRAMES instead.

    Other Java agents (such as the JaCoCo code coverage agent) may use ASM to write modified class files without computing stack map frames by passing 0 as a flag to the ClassWriter object. This flag is mapped to MethodWriter.COMPUTE_NOTHING which means that neither stack map frames nor the maximum stack size are computed. The interaction between agents which modify bytecode and do not recompute stack map frames and the Allocation Instrumenter leads to VerifyErrors when the JVM attempts to verify the twice-modified classes.

    To improve the resiliency of the Allocation Instrumenter, we recommend passing the ClassWriter.COMPUTE_FRAMES flag to the ASM ClassWriter in place of the ClassWriter.COMPUTE_MAXS flag.

    I have a minimal reproducible test case which has been used to verify that making the change suggested above does resolve the issue; I can provide you with it if necessary. In parallel, I am also opening an issue with the JaCoCo project to adjust the flags that they pass to their ClassWriter. However, in theory any bytecode-modifying agent could elect not to write stack map frames so it seems most effectively to address the issue here in the Allocation Instrumenter.

    opened by kyle-cackett 10
  • Support for JDK 11?

    Support for JDK 11?

    We are getting errors on JDK 11:

    WARNING: Failed to instrument class.
    java.lang.IllegalArgumentException
    	at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:160)
    	at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:143)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:177)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:210)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.transform(AllocationInstrumenter.java:157)
    	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
    	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:563)
    	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
    	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.bootstrap(AllocationInstrumenter.java:141)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.premain(AllocationInstrumenter.java:117)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenterBootstrap.premain(AllocationInstrumenterBootstrap.java:48)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
    	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
    Oct 21, 2018 6:49:27 PM com.google.monitoring.runtime.instrumentation.AllocationInstrumenter instrument
    

    https://github.com/RoaringBitmap/RoaringBitmap/issues/277#issuecomment-431875047

    opened by lemire 9
  • Fix for issue #15 (NullPointerException in shutdown hook)

    Fix for issue #15 (NullPointerException in shutdown hook)

    Please consider merging these changes into allocation-instrumenter master and creating a new release.

    This fixes issue #15 (NullPointerException in shutdown hook).

    Many thanks from the Log4j 2 project!

    opened by remkop 8
  • Support for jdk13?

    Support for jdk13?

    It seems that the allocation instrumenter cannot work on jdk13. Can I know the reason? Like, some ASM APIs used in the allocation instrumenter aren't supported by jdk13 yet? Thank you!

    opened by bolunli11 4
  • Class loading breakage: Will not be able to instrument JDK classes

    Class loading breakage: Will not be able to instrument JDK classes

    I did everything as described on your Getting Started page.

    $ uname -a Linux sweden 3.5.7-03050732-generic #201403120653 SMP Wed Mar 12 10:54:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux $ javac -version javac 1.8.0_45 $ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

    $ javac -classpath allocation-jdk8.jar Test.java $ java -javaagent:allocation-jdk8.jar Test Class loading breakage: Will not be able to instrument JDK classes

    I downloaded the latest java-allocation-instrumenter-3.0.jar and renamed to allocation-jdk8.jar.

    Interestingly enough, this was working very fine with the previous allocation.jar for JDK7. But now I need to make it work for JDK8 as well.

    I am lost here, can you give me some help.

    Thanks!

    opened by paulwbill 4
  • JDK11 Compilation Error

    JDK11 Compilation Error

    Hello,

    I just wanted to compile the tool (mvn package) with JDK11 and mvn 3.6.1. It seems that it always has the compilation errors:

    [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.680 s [INFO] Finished at: 2019-12-25T21:13:34-05:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project java-allocation-instrumenter: Compilation failure: Compilation failure: [ERROR] /home/bli11/allocation-instrumenter/target/generated-sources/java/com/google/monitoring/runtime/instrumentation/AllocationInstrumenterBootstrap.java:[7,24] cannot find symbol [ERROR] symbol: class Generated [ERROR] location: package javax.annotation [ERROR] /home/bli11/allocation-instrumenter/target/generated-sources/java/com/google/monitoring/runtime/instrumentation/AllocationInstrumenterBootstrap.java:[33,2] cannot find symbol [ERROR] symbol: class Generated [ERROR] -> [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/MojoFailureException

    I have added some dependencies in pom.xml, but it doesn't work? Any suggestions? Thanks a lot!

    opened by anonymousemberxxx 3
  • pom.xml cleanup.

    pom.xml cleanup.

    • Add copyright header.
    • Add some whitespace and rearrange sections a little.
    • Update build plugins to most recent versions.
    • Update Guava dependency to 18.0.
    opened by cgdecker 3
  • I don't understand how to integrate it in a standard Gradle-based project

    I don't understand how to integrate it in a standard Gradle-based project

    Here is my configuration in build.gradle file:

    plugins {
        id 'java'
    }
    
    group 'com.company.test'
    version '1.0.0-SNAPSHOT'
    
    sourceCompatibility = '11'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation 'com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.2.0'
        testCompile group: 'junit', name: 'junit', version: '4.12'
    }
    

    My code is the same as the example:

    package com.company.test;
    
    import com.google.monitoring.runtime.instrumentation.AllocationRecorder;
    
    public final class App {
        public static void main(final String[] arg) {
            AllocationRecorder.addSampler((count, desc, newObj, size) -> {
                System.out.printf(
                        "I just allocated the object %s of type %s whose size is %d%n",
                        newObj,
                        desc,
                        size
                );
                if (count != -1) {
                    System.out.println("It's an array of size " + count);
                }
            });
            for (int i = 0; i < 10; i++) {
                new String("foo");
            }
        }
    }
    

    But I don't understand what is the path/to/allocation.jar in this example:

    % javac -classpath path/to/allocation.jar Test.java
    % java -javaagent:path/to/allocation.jar Test
    

    And what's the proper way to compile my application with Gradle and run it with the javaagent?

    Thanks for help.

    opened by RoRoche 2
  • Escape analysis

    Escape analysis

    Am I correct in thinking that the instrumenter reports both on-heap and on-stack allocations? It seems that it has to, given that it's (in part) instrumenting calls to constructors — which should take place irrespective of the kind of allocation.

    I ask in part because a bunch of comments in the code mention heap allocation but not on-stack allocation.

    Is there a way to modify the instrumenter to only report on-heap allocations, which are the ones that are relevant to garbage collection pressure? (I think the answer is no, unfortunately.) I know one can use the -XX:+PrintEscapeAnalysis JVM flag but parsing the output appears rather tedious.

    opened by cinquin 2
  • Bump junit from 4.13 to 4.13.1

    Bump junit from 4.13 to 4.13.1

    Bumps junit from 4.13 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    Changelog

    Sourced from junit's changelog.

    Summary of changes in version 4.13.1

    Rules

    Security fix: TemporaryFolder now limits access to temporary folders on Java 1.7 or later

    A local information disclosure vulnerability in TemporaryFolder has been fixed. See the published security advisory for details.

    Test Runners

    [Pull request #1669:](junit-team/junit#1669) Make FrameworkField constructor public

    Prior to this change, custom runners could make FrameworkMethod instances, but not FrameworkField instances. This small change allows for both now, because FrameworkField's constructor has been promoted from package-private to public.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • CVE-2022-42920 Critical org.apache.bcel propagated in 3.3.0 google/allocation-instrumenter

    CVE-2022-42920 Critical org.apache.bcel propagated in 3.3.0 google/allocation-instrumenter

    google/allocation-instrumenter contains org.apache.bcel:bcel v6.0 which has CVE-2022-42920 | CRITICAL |
    This is fixed in bcel 6.6.0
    Apache Commons BCEL vulnerable to out-of-bounds write --> avd.aquasec.com/nvd/cve-2022-42920

    opened by c3ivodujmovic 1
  • String created through java makeConcat not reported

    String created through java makeConcat not reported

    Based on findings from https://github.com/bazelbuild/bazel/issues/14890#issuecomment-1049057981 looks like some string concatenations are not reported.

    makeConcat was introduced in java 9 - see https://openjdk.java.net/jeps/280 and implementation in java 11 in http://hg.openjdk.java.net/jdk/jdk11/file/jdk-11+28/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java#l1483

    Possibly UNSAFE.allocateUninitializedArray calls done from http://hg.openjdk.java.net/jdk/jdk11/file/jdk-11+28/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java#l1633 could be instrumented - but not sure how it will play with JVM machinery.

    Current workaround seems to be -Djava.lang.invoke.stringConcat=MH_SB_SIZED that forces to use concat implementation that instrumenter is able to catch.

    opened by glukasiknuro 0
  • allocation-instrumenter breaks JPMS compliant builds

    allocation-instrumenter breaks JPMS compliant builds

    The allocation-instrumenter uses the shade plugin to include some guava classes into its jar. Any project - such as Log4j 2 - that includes this tool as a test dependency will fail to build if they have other dependencies that require guava and have a module-info.java in their jar. The errors all resemble

    [ERROR] error: module com.lmax.disruptor reads package com.google.thirdparty.publicsuffix from both guava and java.allocation.instrumenter
    [ERROR] error: module org.jctools.core reads package com.google.thirdparty.publicsuffix from both guava and java.allocation.instrumenter
    [ERROR] error: module org.yaml.snakeyaml reads package com.google.thirdparty.publicsuffix from both guava and java.allocation.instrumenter
    
    opened by rgoers 0
  • Bump guava from 28.1-android to 29.0-android

    Bump guava from 28.1-android to 29.0-android

    Bumps guava from 28.1-android to 29.0-android.

    Release notes

    Sourced from guava's releases.

    29.0

    Maven

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>29.0-jre</version>
      <!-- or, for Android: -->
      <version>29.0-android</version>
    </dependency>
    

    Javadoc

    JDiff

    Changelog

    • Guava types can no longer be sent over GWT-RPC. To temporarily reenable support, set the guava.gwt.emergency_reenable_rpc system property to true. (5214a10b1e)
      • This is the only breaking change in this release, and it affects only users of the guava-gwt artifact, not people who use only the guava artifact. This release contains no changes that break binary compatibility for any users.
    • API documentation for Guava classes is now easier to reach. For example, for ImmutableList, visit guava.dev/ImmutableList. Also, more easily access the index at guava.dev/api.
    • collect: Annotated FluentIterable.from(FluentIterable) with @DoNotCall. (b1c77b7df3)
    • collect: Made ceiling, floor, headSet(E, boolean), and tailSet(E, boolean) methods available in the GWT-emulated ImmutableSortedSet. (7e0fe90ca8, 5f2fbf27b2)
    • graph: Made it possible to set a stable incident edge order by calling the newly added method [Value]Graph.Builder.incidentEdgeOrder(ElementOrder.stable()). (70164025a8)
    • graph: Added incidentEdgeOrder() to the [Value]Graph interfaces. (cde576ec00)
    • util.concurrent: Added Duration-based default methods to ListeningScheduledExecutorService. (931e83f969)
    • util.concurrent: Added immediateVoidFuture. (9f3bae5853)
    • util.concurrent: Removed @Beta from Service and related classes. (dc46627fea)
    • util.concurrent: Deprecated the 1-arg overload of ServiceManager.addListener. (86e3620125)
    • util.concurrent: Changed the return type of ServiceManager.servicesByState() to ImmutableSetMultimap (but also retained a method with the old signature for binary compatibility). (31999ae6f5)
    • util.concurrent: Made it safe to load the AbstractFuture class from a ForkJoinPool thread under a security manager. (6e0c5b5d50)

    28.2

    Maven

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>28.2-jre</version>
      <!-- or, for Android: -->
      <version>28.2-android</version>
    </tr></table> 
    

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(java-allocation-instrumenter-3.3.0)
Owner
Google
Google ❤️ Open Source
Google
Java Agent for Memory Measurements

Overview Jamm provides MemoryMeter, a Java agent for all Java versions to measure actual object memory use including JVM overhead. Use To use MemoryMe

Jonathan Ellis 624 Dec 28, 2022
A java agent to generate method mappings to use with the linux `perf` tool

perf-map-agent A java agent to generate /tmp/perf-<pid>.map files for just-in-time(JIT)-compiled methods for use with the Linux perf tools. Build Make

null 1.5k Jan 1, 2023
The Java agent for Apache SkyWalking

Apache SkyWalking Java Agent SkyWalking-Java: The Java Agent for Apache SkyWalking, which provides the native tracing/metrics/logging abilities for Ja

The Apache Software Foundation 447 Jan 5, 2023
Log analyser / visualiser for Java HotSpot JIT compiler. Inspect inlining decisions, hot methods, bytecode, and assembly. View results in the JavaFX user interface.

JITWatch Log analyser and visualiser for the HotSpot JIT compiler. Video introduction to JITWatch video Slides from my LJC lightning talk on JITWatch

AdoptOpenJDK 2.8k Jan 3, 2023
Assembler/disassembler for java bytecode

Raung raung - yet another assembler/disassembler for java bytecode. Similar to Krakatau and Smali, based on ASM library. ❗ Warning: this project at a

null 20 Oct 2, 2022
Kotlin-decompiled - (Almost) every single language construct of the Kotlin programming language compiled to JVM bytecode and then decompiled to Java again for better readability

Kotlin: Decompiled (Almost) every single language construct of the Kotlin programming language compiled to JVM bytecode and then decompiled to Java ag

The Self-Taught Software Engineer 27 Dec 14, 2022
One file java script for visualizing JDK flight recorder execution logs as flamegraphs without any dependencies except Java and a browser.

Flamegraph from JFR logs Simple one file Java script to generate flamegraphs from Java flight recordings without installing Perl and the Brendan Gregg

Billy Sjöberg 17 Oct 2, 2022
JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines.

JVM Explorer JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines. Features Browse

null 109 Nov 30, 2022
Sampling CPU and HEAP profiler for Java featuring AsyncGetCallTrace + perf_events

async-profiler This project is a low overhead sampling profiler for Java that does not suffer from Safepoint bias problem. It features HotSpot-specifi

null 5.8k Jan 3, 2023
BTrace - a safe, dynamic tracing tool for the Java platform

btrace A safe, dynamic tracing tool for the Java platform Version 2.1.0 Quick Summary BTrace is a safe, dynamic tracing tool for the Java platform. BT

btrace.io 5.3k Jan 9, 2023
Fork of tagtraum industries' GCViewer. Tagtraum stopped development in 2008, I aim to improve support for Sun's / Oracle's java 1.6+ garbage collector logs (including G1 collector)

GCViewer 1.36 GCViewer is a little tool that visualizes verbose GC output generated by Sun / Oracle, IBM, HP and BEA Java Virtual Machines. It is free

null 4.1k Jan 4, 2023
Get Method Sampling from Java Flight Recorder Dump and convert to FlameGraph compatible format.

Note: Travis has removed the support for Oracle JDK 8. Therefore the build status is removed temporarily. Converting JFR Method Profiling Samples to F

M. Isuru Tharanga Chrishantha Perera 248 Dec 16, 2022
Tool for creating reports from Java Flight Recorder dumps

jfr-report-tool Tool for creating reports from Java Flight Recorder dumps. Influenced by https://github.com/chrishantha/jfr-flame-graph . Kudos to @ch

Lari Hotari 50 Oct 28, 2022
Java monitoring for the command-line, profiler included

jvmtop is a lightweight console application to monitor all accessible, running jvms on a machine. In a top-like manner, it displays JVM internal metri

null 1.2k Jan 6, 2023
PerfJ is a wrapper of linux perf for java programs.

PerfJ PerfJ is a wrapper of linux perf for java programs. As Brendan Gregg's words In order to profile java programs, you need a profiler that can sam

Min Zhou 353 Jan 2, 2023
OOM diagnostics for Java.

Polarbear A tool to help diagnose OutOfMemoryError conditions. Polarbear helps track down the root cause of OutOfMemoryError exceptions in Java. When

Cue 20 May 14, 2019
Inline raw ASM instructions in Java

asm-inline At first I thought: Oh, I can make an optimization transformer for Proguard And then this happened. Example: public class Test { public

null 27 Dec 8, 2022
Some utility classes around java records

record-util Some utility classes around java records On the menu MapTrait Transform any record to a java.util.Map just by implementing the interface M

Rémi Forax 32 Apr 6, 2022
Terminal UI JMX (Java management extension) viewer

JMXViewer Terminal UI JMX (Java management extension) viewer Usage java -jar jmxviewer.jar [pid] The PID is optional. If it is not provided, the appli

Ivan Yurchenko 20 Sep 15, 2022