CLion 2018.3 EAP: profiling tools on Linux and macOS and multiline TODO

Hi,

The new CLion 2018.3 EAP (build 183.3647.14) is now available for download!

As usual, a patch-update will be available shortly for those using the previous EAP build, and you can also use Toolbox app or snap packages (in the case of Ubuntu) to get this build. No license is required and the build is free to use, but it will expire within 30 days of the build date.

Download CLion 2018.3 EAP

CPU Profiler

Starting from this EAP, CLion comes with the CPU Profiler integration on Linux and macOS. With Perf on Linux and DTrace on macOS you can now analyze the performance of your application (both, kernel and user’s code) right in the IDE.

To run the profiler use a new button in the navigation toolbar or a new action in the run menu, which appears when you click on a run icon in the left gutter:
run_profiler

The results of the profiling is shown in the CPU Profiler tool window (View | Tool Windows | CPU Profiler):
profiler_toolwindow

How to start profiling the code?

Before you start profiling your app, please check and install, if missing, the following tools:

  • On Linux:
    1. Perf is required to run profiling in CLion. Mind, you should install perf for the particular kernel version you have. For example, on Ubuntu you can check the kernel version via uname command and then install the linux-tools package for the particular kernel version:
    2. Besides, you have to allow perf collect information without root privileges. For that you have to tweak /proc/sys/kernel/perf_event_paranoid and update /etc/sysctl.d/local.conf if you want to keep the setting across system reboots:
    3. addr2line tool is also required to show human-readable (demangled) names in the output and to navigate to the source code. It’s part of the binutils package, so you likely have it by default. Otherwise, install binutils.
  • On macOS:
    • DTrace is required to profile on macOS. Most likely, you have it installed by default with your macOS. You can call dtrace command in the terminal to check it.

Perf and DTrace executables will be detected automatically by CLion. Or you can set the path in Settings/Preferences | Build, Execution, Deployment | Dynamic Analysis Tools | Profiler. Besides, you can configure sampling frequency there.

In order to get meaningful profiler data and ability to navigate through it properly, the application need to be build with debug info and without any optimizations, so we recommend using the Debug configuration with -O0 compilation flag.

CPU Profiler tool window

When you start profiling the app, CLion notifies you if the profiler is successfully attached. When the profiling data is ready, CLion shows a balloon with a link to the CPU Profiler tool window with the results. Alternatively, you can open it via View | Tool Windows | CPU Profiler.
profiler_data_ready

In the tool window you can find several useful tabs with the profiling information collected: flame chart, call tree and method lists.
profiler_tabs

Known issues and limitations

CPU profiler integration in CLion is implemented on Linux and macOS platforms. We’ll consider possible tools on Windows later in 2019. Besides, there are a few limitations in the current implementation:

  • Navigation to the source code is available on Linux only for now.
  • By default CLion runs the profiler with quite high sampling frequency, which might require a lot of disk space for long-running programs. Decrease this value in Settings/Preferences | Build, Execution, Deployment | Dynamic Analysis Tools | Profiler to avoid such situations.
  • Profiler integration in CLion currently doesn’t support WSL toolchain or remote mode.
  • Currently profiling works for CMake and Gradle projects. Projects with compilation database project model are not supported.

Multiline TODO comments

With this EAP we bring you multiline TODO comments, which means the first and all subsequent todo comment lines can be highlighted in the editor and listed in the TODO Tool Window (it was only the first line previously). Just add an indent starting from the second line of your multiline TODO comment so the IDE will differentiate it from an ordinary comment:
Multiline TODO comments

That’s it! Give this new CLion EAP a try and let us know what you think! Full release notes are available by the link.

Download CLion 2018.3 EAP

Your CLion Team
JetBrains
The Drive to Develop

This entry was posted in Announcement, Early Access Preview and tagged , , , . Bookmark the permalink.

20 Responses to CLion 2018.3 EAP: profiling tools on Linux and macOS and multiline TODO

  1. Tano says:

    Still hoping that IDEA-199656 will be available in final 2018.3. :)

  2. Alexander Zaitsev says:

    Great news! Do you think about integration Valgrind (Callgrind, Cachegrind) profiler into CLion? What about other profilers?

    • Anastasia Kazakova says:

      We’ll consider other options when finalize our work with perf/dtrace. There is still some issues to be resolved first.

  3. Alexander Zaitsev says:

    CLion already has support for Clang Tidy. But what about integrating Clang Static Analyzer into CLion?

  4. okMan says:

    Hi, gay, Can you use Valgrind in the MacOs Majava?

  5. Michael Klatt says:

    I’m still using EAP 183.2940.13 because of https://youtrack.jetbrains.com/issue/IDEA-199986, and it looks like this update still has that issue. What can I do if my build expires before this is fixed?

    • Anastasia Kazakova says:

      The ticket is under investigation, we hope it to be fixed soon. As this is EAP program, we can’t promise you an improved build ready before your current one expires, but we’ll do our best to fix the issue asap and provide a EAP build with the fix as soon as possible.

  6. kert says:

    Profiling is nice, but can we finally get code coverage support ? It’s available in every other Jetbrains IDE, but for Clion even the plugin api for coverage is not exposed.

Leave a Reply

Your email address will not be published. Required fields are marked *