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


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:

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

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.

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

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:

  • 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
The Drive to Develop

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

31 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, 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.

  7. Peter says:

    I briefly checked the profiler window in 2018.2.5. via the ‘Experimental features’ option.
    I use perf as my preferred profiling tool, so having a decent UI for this would be really great.
    I noticed there is a ‘Choose dump file’ option in the ‘CPU Profiler’ tool window. However despite CLion claims to use ‘perf’ internally it seams to be unable to load data recorded via ‘perf record’ outside of CLion. It refuses to do so with: “Can’t read dump file: Not an Intellij Profiler Dump”. I understand there might be reasons to have your own file format or wrapper format, but if perf is used inside anyways it would be much more useful if it would be possible to also be able read/import the native perf format. This gives much more options to profile in a certain environment and conditions and have full control about perf options while still use a great UI for analyzing and browsing call graphs and code.

    • Anastasia Kazakova says:

      Please check the profiler functionality in 2018.3 EAP. 2018.2.5 has a very limited version, not intended for public use.
      Dump files functionality is not yet there.

  8. Peter says:

    Do you know hotspot?
    This is a nice example of how this can be done right.
    Btw.: Is there a issue in the tracker to follow the development for this?

  9. Ernest says:

    Anastasia, is there any ability to load file with data which was previously collected, for example on another machine and I want to open it in CLion to see the hotspots and navigate to the code?

  10. Florian says:

    This question is bit more general than just for CLion, but I dare ask:

    Anastasia you write “to get meaningful profiler data […] build with debug info and without any optimizations”.

    Given that performance of optimized code is matters most in most situations, and optimizations may change speed quite dramatically, this is a huge disadvantage of perf. Making me directly want to stay with hand-written profiling/timers etc.

    Or am I missing something?


    • Anastasia Kazakova says:

      I partially agree. But I don’t know a good profiling tool that can deal with that. Can you recommend smth?

      • Florian says:

        Unfortunately I’m newbie. My friend explains to me -O3 optimization etc. would not necessarily have to be a problem for perf; instead, mainly keeping in the debug flags would be important.

        • Anastasia Kazakova says:

          Optimizations might cut some information that perf and related tools are using to show the trace correctly. So you can profile with -O3, but some info might lack.

Leave a Reply

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