Run with a profiler
Run a method with a profiler
Click the icon in the gutter next to the method that you want to profile and select the necessary profiling option: CPU, memory, or Java Flight Recorder.
Profile a run configuration
At the moment, you can profile the most common run configurations. Application server run configurations are currently not supported, except the local Tomcat run/debug configuration.
Select a run configuration from the list on the toolbar.
If the list is empty or the necessary configuration is not created yet, refer to Run/debug configurations for instructions on how to create one.
Click next to and select the necessary profiling option: CPU, memory, or Java Flight Recorder.
(Only for Async Profiler on Linux) Upon the first launch of the profiler, IntelliJ IDEA checks whether kernel variables are already set up and suggests the necessary changes:
Profile Maven goals
In IntelliJ IDEA, you can profile several goals:
Maven Failsafe Plugin:
Maven Surefire Plugin:
Exec Maven Plugin:
Make sure to specify the
exec:java. You can do that in your pom.xml or in the Command line field in the corresponding run/debug configuration. For more information, refer to the Exec Maven Plugin documentation.
From the main menu, select.
In the Maven tool window, right-click the goal that you want to profile and select the necessary profiling option: CPU, memory, or Java Flight Recorder.
If you already have a Maven run/debug configuration for the required goal, you can profile it the same way as any other run configuration.
Currently, there are several limitations for profiling Maven goals:
Profiling tools in IntelliJ IDEA do not support Maven profiles, executions, and versions. That is why, some complex configurations might not profile correctly.
Profiling of specific versions of the mentioned goals is not supported (for example:
You cannot profile the goals if they are configured in a way that more than one process is created during their execution.
Profiling of the
failsafe:integration-testgoals is possible only in projects without modules. You can, however, profile a specific module provided that it has no sub-modules.
Profiling is not possible if there are certain arguments in a plugin configuration:
If the Exec Maven Plugin configuration has
<arguments>in pom.xml, the values in
<arguments>are skipped during the execution of the
Attach a profiler to a running process
From the main menu, select.
In the Profiler tool window, you will see the list of running processes.
Click the necessary process and select a profiling type: CPU, memory, or Java Flight Recorder.
Stop profiling and get results
When the profiling data is ready, you will see a confirmation popup together with the Profiler tool window bar. Click this bar to open the Profiler tool window or go to if you don't use tool window bars.
Alternatively, go to Stop Profiling and Show Results., wait for Java Flight Recorder to collect enough data, and click
When the analysis is finished, you can review and analyze the reports.