-
Notifications
You must be signed in to change notification settings - Fork 250
Importing from async‐profiler (Java)
The async-profiler tool can be used to profile Java applications and generate trace files that can be imported into speedscope. To do this install async-profiler from github. The easiest way to do this is to download a binary build of the latest release from the releases page and unzip it.
Once installed, a profile file can be created by using async-profiler's collapsed
output format, which is specified via -o collapsed
. For example:
- Automatically profile for a fixed length of time
Find the pid or name of the process you want to profile using jps
. Then run the following command to profile the process for s seconds:
./asprof collect -d <s> -o collapsed -f profile.collapsed <progname or pid>
- Manually start and stop profiling
Find the pid or name of the process you want to profile using jps
. Then run the following command when you want to start profiling:
./asprof start <progname or pid>
When you want to stop profiling, run:
./asprof stop -o collapsed -f profile.collapsed <progname or pid>
Once a properly formatted trace file exists, drop the resulting profile.collapsed into (https://www.speedscope.app/)
To view it offline, you'll need to install speedscope via npm:
npm install -g speedscope
Then you should be able to open it like so:
speedscope profile.collapsed