28

Is there a Profiler for IntelliJ like the one for Matlab?

Let's say you have this code

a = true;
i = 0;
while(a)
{
   if(a)
      i++
   // some fancy stuff which takes 1 second each loop
   if(i > 1e6) break;
}  

Now I run the code

In Matlab it would look like this after I opened the Profiler

calls  time
     1  0.0      a = true;
     1  0.0      i = 0;
     1  0.0      while(a)
                 {
   1e3  1.0        if(a)
   1e3  0.4         i++
   1e3  1e3         // some fancy stuff which takes 1 second each loop
   1e3  1.2         if(i > 1e3) break;
                 }  
Yu Hao
  • 119,891
  • 44
  • 235
  • 294
GavriYashar
  • 345
  • 1
  • 3
  • 10

2 Answers2

19

All profilers that are available for Java, which can be used in IntelliJ will show invocation times only aggregated on method level. You can use for example VisualVM, JProfiler or YourKit, but only summary time will be shown.

Jakub Kubrynski
  • 13,724
  • 6
  • 60
  • 85
18

JProfiler has a plugin for IntelliJ IDEA.

It adds "Profile" actions to IntelliJ IDEA, similar to the "Run" and "Debug" actions. The profiler UI is not embedded in IDEA but started as a separate process. However, you can use your existing run configurations for profiling and source code navigations goes back to IDEA.

You have to install JProfiler as a standalone product, the plugin will ask you about the installation directory of JProfiler when you profile something for the first time.

Disclaimer: My company develops JProfiler.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • 10
    quite expensive just for debugging – GavriYashar Jan 18 '14 at 12:04
  • 1
    @GavriYashar but IntelliJ is already expensive, and JRebel is expensive too. If you don't want expensive then there's always NetBeans which has a FREE profiler ;) – dexter meyers Oct 14 '14 at 11:28
  • 6
    @dexter meyers JProfiler: License with 1 year of Support & Upgrades €599 upgrade: For Single Licenses €159 IDEA: €179 upgrade €89. for my purposes/uses JProfiler is too expensive. IDEA for me was not expensive if you don't want to use NetBeans or Eclipse. but i can stick with the fact that there is no such feature. – GavriYashar Oct 15 '14 at 14:47
  • 2
    Finally there is IntelliJ profiller: https://blog.jetbrains.com/idea/2018/09/intellij-idea-2018-3-eap-git-submodules-jvm-profiler-macos-and-linux-and-more/ – Kamil Witkowski Dec 04 '18 at 15:45