2

I have a Java Spring application that is running on my PC (I can attach debugger), I am looking for a way to profile a single method, preferably one that does have an UI to drilldown the child methods that consume the most time.

I tried JDK mission control and IntelliJ 's default profiler which I believe both are based off Java Flight Recorder. The issue is that most of the time it does not sample my method and my method spend lots of time waitting for (async?) I/O which cause the profiling result to be unusable

Why does the Java flight recorder take too few samples?

How to include IO-bound methods in Java Flight Recorder sampling?

What should I do in this case? Given that

  • I can already debug the method
  • I want to profile a single run on that single method only
  • I can get the drill down of child methods (Flame/Icicle chart) like what Google Chrome can do, including time when function is pending IO?
  • Preferably, without changing source code.

enter image description here

As supplemental detail, I already looked at some questions here that does not address the issue I mentioned: Some require to update to source code and some is dependent on JFR method sampling which I do not know how/if can profile a single specific method run and include the async I/O in the drill-down view

Any recommended Java profiling tutorial?

Profiling a Java Spring application

qkhanhpro
  • 4,371
  • 2
  • 33
  • 45
  • 1
    Does JMH work for you in this case? http://tutorials.jenkov.com/java-performance/jmh.html – Luan Kevin Ferreira Sep 16 '21 at 16:49
  • Give JProfiler https://www.ej-technologies.com/products/jprofiler/overview.html a try – Andreas Radauer Sep 16 '21 at 18:05
  • 1
    You may want look at the JMC Agent. It allows profiling of a single methods without changing the source code: https://developers.redhat.com/blog/2020/10/29/collect-jdk-flight-recorder-events-at-runtime-with-jmc-agent#introduction_to_the_jmc_agent_plugin (There is an enhancement request to add something similar to OpenJDK, but it will not help you now) – Kire Haglin Sep 17 '21 at 00:14

0 Answers0