Using async-profiler can be quite a hassle. First, you have to download the right archive from GitHub for your OS and architecture, then you have to unpack it and place it somewhere. Or you get it from your OS distribution, hoping that it is the current version. It gets worse if you want to embed it into your library, agent, or application: Library developers cannot just use maven dependency but have to create wrapper code and build scripts that deal with packaging the binaries themselves, or worse they depend on a preinstalled version which they do not control.
I started the AP-Loader project to fix all this:
- Want to run async-profiler? Just grab the latest loader JAR from GitHub, and run
java -jar ap-loader-all.jar profiler
regardless of your OS or architecture - Want to use the async-profiler as a Java Agent? You can use the loader JAR as javaagent and it behaves like the native async-profiler agent
- Want to use jattach?
java -jar ap-loader-all.jar jattach
is your friend - Wondering what version of async-profiler you’re using?
java -jar ap-loader-all.jar version
has you covered - Want to use the converter to convert between formats? Just use
java -jar ap-loader-all.jar converter
- Want to use async-profiler in your library? Just look in maven central for the dependency.
- Want to use the converter too? All the converter classes are included in the JAR, look no further than the
one.profiler.converter
package - Just want all this for one platform only? I build and package versions for all platforms. There can be multiple platform versions on the classpath
- But what about the JAR size? It’s just under 800KB, so no worries
This project uses original binaries from async-profiler’s GitHub releases page and tests the resulting project using the original tests from async-profiler, so you can expect it to behave as async-profiler does. The idea for this project came up in a discussion with the creator of async-profiler, Andrei Pangin, in spring.
I use this project daily to profile my applications, so might you? I’m open to suggestions, bug reports and happy help to integrate ap-loader into your open-source library.
If I enticed you: Go over to GitHub to get more detailed information on this project.