Profile Java and Kotlin Code with the IntelliJ Profiler
At JetBrains, we believe that profiling Java and Kotlin code should be simple and accessible to all developers, regardless of their level of expertise. That’s why the IntelliJ Profiler puts ease of use and seamless integration at the forefront of its mission.
In previous releases, we introduced a range of features to support these efforts. These include a single out-of-the-box configuration that spares you tedious setup, as well as the Home tab of the Profiler tool window. This tab makes it easy to attach the profiler to a running process.
We’re continuing on our mission to simplify profiling, and we want to share some of our progress with you.
First, you can now attach the profiler and capture a memory dump for a running Java or Kotlin program right from the Run tool window:
Find synchronization issues and bottlenecks
Second, the profiling report has become more informative. The default configuration now also profiles sleeping and waiting threads. This enables you to detect synchronization issues and external bottlenecks like long service calls and other I/O interactions. Together with milliseconds as the new default measurement unit, this makes profiling more intuitive and transparent.
On the screenshot below, you can see a timeline with color-coding for threads’ busy states (green) and waiting states (red):
In-editor performance hints
Finally, in a particularly exciting update, you no longer need to leave your code to view profiling data. When you open a snapshot, lines of code that took a significant amount of time to execute are labeled with their respective runtimes.
Hot lines are indicated with a distinctive red fire icon:
Clicking on a label takes you directly to its declaration, enabling you to examine the method’s implementation in detail and pinpoint slow lines. If this does not give you enough granularity, you can continue to drill down until you find the root cause.
While this feature can definitely be used in large-scale projects, we hope that it will be equally useful for novice users and smaller problems like evaluating the performance of a LeetCode submission.
If you need more advanced views, like Flame Graph and Call Tree, you can still access them through the Profiler tool window.
If you’re new to profiling and interested in these updates, don’t hesitate to give the new features a try. To learn about more advanced techniques and in-depth profiling with IntelliJ IDEA, we recommend following these tutorials:
- Get started with CPU profiling – In this tutorial you’ll learn how to improve Java application performance in a few simple steps.
- Find a memory leak – Troubleshoot a real Java application with the IntelliJ Profiler.
More exciting improvements are on their way, so stay tuned!
Subscribe to Blog updates
Java Best Practices
Good code follows certain rules, and knowing them increases your chances of success. We’d like to share some Java best practices that will help you on your way. We'll cover the must-know tips and tricks, from broad advice on software development to Java- and project-specific know-how. Let's get star…
The Best of IntelliJ IDEA’s HTTP Client
In today's fast-paced tech world, easy and efficient management of web services and APIs is crucial. That's where IntelliJ IDEA's HTTP Client steps in, turning complex HTTP requests into a walk in the park. The HTTP Client is a feature-rich, text-based tool in IntelliJ IDEA Ultimate. It seamlessl…
History of Gradle Delegation Process in IntelliJ IDEA
Nowadays, a build tool is an essential part of any project, and IntelliJ IDEA integrates with the majority of them. Among the most popular build tools is Gradle. We’d like to give a brief historical overview of its integration with IntelliJ IDEA and the delegation process implemented inside the I…
How to Work With Protobuf-Maven Projects in IntelliJ IDEA
Protobuf, short for Protocol Buffers, is a language-agnostic data serialization format developed by Google. It is designed to efficiently and reliably serialize structured data to communicate between different systems and programming languages. Protobuf offers a compact binary representation of data…