From 8ea116a3aae244e2cb224dcda92ec46c81278fa0 Mon Sep 17 00:00:00 2001 From: Jens Wille Date: Fri, 18 Oct 2024 11:31:58 +0200 Subject: [PATCH] Switch profiling from HPROF to Java Flight Recorder. After the switch to Java 11 (#343), the JVM TI hprof Agent (introduced in e144936) is no longer available (removed in JDK 9, see https://bugs.openjdk.org/browse/JDK-8046661). Use the `jfr` command-line tool or JDK Mission Control (https://jdk.java.net/jmc/) to analyze the recording file. --- .gitignore | 2 +- build.gradle | 2 +- metafix-runner/build.gradle | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 12ec8d9a..c738b091 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ out/ node_modules/ xtext-server/ package-lock.json -*.hprof.txt +*.jfr *.vsix /metafix/src/test/resources/org/metafacture/metafix/integration/**/*.diff /metafix/src/test/resources/org/metafacture/metafix/integration/**/*.err diff --git a/build.gradle b/build.gradle index 566eb558..569c60cf 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { // excludes = [ // '**/*.diff', // '**/*.err', -// '**/*.hprof.txt', +// '**/*.jfr', // '**/*.out', // '**/*.vsix', // '**/.*', diff --git a/metafix-runner/build.gradle b/metafix-runner/build.gradle index 783e85e2..fe2f8d9b 100644 --- a/metafix-runner/build.gradle +++ b/metafix-runner/build.gradle @@ -42,8 +42,10 @@ application { if (project.hasProperty('profile')) { def file = project.getProperty('profile') ?: project.name def depth = project.hasProperty('profile.depth') ? project.getProperty('profile.depth') : 8 - def cutoff = project.hasProperty('profile.cutoff') ? project.getProperty('profile.cutoff') : 0.001 - applicationDefaultJvmArgs = ["-agentlib:hprof=heap=sites,cpu=samples,depth=${depth},cutoff=${cutoff},file=${file}.hprof.txt"] + applicationDefaultJvmArgs = [ + "-XX:FlightRecorderOptions=stackdepth=${depth}", + "-XX:StartFlightRecording=dumponexit=true,filename=${file}.jfr,settings=profile" + ] } }