Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: JFR Visualizer #252

Merged
merged 18 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## Introduction

Online Analyzer for Heap Dump, GC Log, and Thread Dump.
Online Analyzer for Heap Dump, GC Log, Thread Dump and JFR.

Please refer to [GitHub Pages](https://eclipse.github.io/jifa) for more information.

Expand Down
21 changes: 21 additions & 0 deletions analysis/jfr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# JFR Analysis

Profiling is a type of runtime analysis. Java Flight Recorder (JFR) is the builtin Profiler for Java. It collects data on the fly and generates JFR files. JFR analysis gives you a birds-eye view of what is happening inside Java, such as CPU usage, memory allocation, and other activities of threads.

### Supported Format

- OpenJDK JFR (binary format)

### Feature List

The supported features are as follows:

- CPU
- Allocation
- Wall Clock (Only JFR files created by async-profiler with wall engine)
- File IO
- Socket IO
- Lock
- Class Load
- Thread Sleep
- Native Execution Sample
29 changes: 29 additions & 0 deletions analysis/jfr/jfr.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/********************************************************************************
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
plugins {
id 'java-library'
}

apply from: "$rootDir/gradle/java.gradle"

jar {
archiveBaseName.set("jfr")
}

dependencies {
api project(':analysis')
implementation 'org.openjdk.jmc:flightrecorder:8.2.0'
implementation 'org.openjdk.jmc:flightrecorder.rules:8.2.0'
implementation 'org.openjdk.jmc:flightrecorder.rules.jdk:8.2.0'
implementation group: 'org.ow2.asm', name: 'asm', version: '9.3'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/********************************************************************************
* Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
package org.eclipse.jifa.jfr;

import lombok.extern.slf4j.Slf4j;
import org.eclipse.jifa.analysis.AbstractApiExecutor;
import org.eclipse.jifa.analysis.listener.ProgressListener;
import org.eclipse.jifa.analysis.support.MethodNameConverter;
import org.eclipse.jifa.jfr.api.JFRAnalyzer;

import java.nio.file.Path;
import java.util.Map;
import java.util.function.Predicate;

@Slf4j
public class JFRAnalysisApiExecutor extends AbstractApiExecutor<JFRAnalyzer> {
@Override
public String namespace() {
return "jfr-file";
}

@Override
public Predicate<byte[]> matcher() {
return new Predicate<>() {
static final String HEADER = "FLR";

@Override
public boolean test(byte[] bytes) {
return bytes.length > HEADER.length() && new String(bytes, 0, HEADER.length()).equals(HEADER);
}
};
}

@Override
public boolean needOptionsForAnalysis(Path target) {
return false;
}

@Override
public void clean(Path target) {
super.clean(target);
}

@Override
protected MethodNameConverter methodNameConverter() {
return MethodNameConverter.GETTER_METHOD;
}

@Override
protected JFRAnalyzer buildAnalyzer(Path target, Map<String, String> options, ProgressListener listener) {
return new JFRAnalyzerImpl(target, options, listener);
}
}
Loading
Loading