Skip to content

Commit

Permalink
Fix FlameGraph converter #22
Browse files Browse the repository at this point in the history
  • Loading branch information
parttimenerd committed Mar 12, 2024
1 parent 2a0b797 commit ce29b5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ And the following for a new async-profiler release:
Changelog
---------
### Unreleased
- Fix FlameGraph converter [#22](https://github.com/jvm-profiling-tools/ap-loader/issues/22)
### v8
- Support for [async-profiler 3.0](https://github.com/async-profiler/async-profiler/releases/tag/v3.0)
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/one/profiler/AsyncProfilerLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,13 +642,15 @@ public static boolean jattach(Path agentPath, String arguments) {
}
}

private static String[] processConverterArgs(String[] args) throws IOException {
private static String[] processConverterArgs(String[] args) {
List<String> argList = new ArrayList<>();
argList.add(System.getProperty("java.home") + "/bin/java");
argList.add("-cp");
argList.add(System.getProperty("java.class.path"));
List<String> profilerArgs = new ArrayList<>(Arrays.asList(args));
if (profilerArgs.size() > 0 && profilerArgs.get(0).startsWith("jfr")) {
if (profilerArgs.size() > 0
&& (profilerArgs.get(0).startsWith("jfr")
|| profilerArgs.get(0).startsWith("FlameGraph"))) {
profilerArgs.set(0, "one.converter." + profilerArgs.get(0));
} else {
profilerArgs.add("one.converter.Main");
Expand Down

0 comments on commit ce29b5b

Please sign in to comment.