1

I was used to work with HPROF in order to capture CPU time and memory usage while developing applications. For some reasons, I was forced to work with following JDK :

Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.21.0, JRE 11 Windows 10 amd64-64-Bit Compressed References 20200715_679 (JIT enabled, AOT enabled)

Unfortunately, HPROF modules are not embedded with this JDK and I was wondering if there was any alternative to HPROF in order to perform some automatable profiling/sampling.

Actually, I'm interested in any CLI tool enabling to perform sampling/profiling and, if possible, generating files allowing to easily perform automated comparisons... Am I dreaming ? :)

Any recommendation or suggestion will be welcomed !

Thanks for your help ! :)

a-mn
  • 13
  • 3
  • If the reason you're profiling is to maximize performance (is there any other reason?) just try [this.](https://stackoverflow.com/a/317160/23771) – Mike Dunlavey Sep 29 '22 at 13:55

1 Answers1

0

Instead of HPROF files, the OpenJ9 JVM creates PHD files (Portable Heap Dumps). Just like HPROF, PHD is only intended for memory profiling (the HPROF CPU sampling agent was removed from HotSpot JDKs in Java 9)

Similar to HPROF files, you can create PHD files by using the jcmd command line utility:

jcmd <PID> Dump.heap

The PID of the JVM can be found with the jps command line utility. Optionally, you can pass a third parameter for the path of the PHD file:

jcmd <PID> Dump.heap <path to phd file>

Most tools that can open HPROF files can also open PHD files, like JProfiler.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • Thanks for your answer ! I got the point for memory monitoring, I read some documentation on that to see how far I can go with this approach :) Now, my concern is more on CPU sampling, because what I would like to achieve is to automatically generate CPU samples while executing a given Java program... I am not sure of the feasibility of this from my research. Have you more information about CPU sampling and OpenJ9 ? (VisualVM works through JMX, some automatable actions through CL, but not much...) – a-mn Sep 29 '22 at 10:04
  • Most commercial profilers like JProfiler have full support for profiling OpenJ9, including CPU sampling – Ingo Kegel Sep 29 '22 at 19:52