I was trying to profile CPU usage in my code and discovered the built-in hprof. https://docs.oracle.com/javase/8/docs/technotes/samples/hprof.html
However, as I tested I got the following error:
javac -J-agentlib:hprof=cpu=samples Main.java
Error occurred during initialization of VM
Could not find agent library hprof on the library path, with error: Can't find dependent libraries
I believe I am having a path issue, however, I have no clue of where this library is located to try adding to the path, I am using the jdk-15.0.2.
- I have already tried to look for "hprof" in my jdk folder, however can´t find anything.
- So I tried to check in the documentation, however, I could only find a path for a demo for the javase8 https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr008.html#BABIDBJJ. However, it points to a demo code JAVA_HOME/demo/jvmti/hprof that does not exist in my jdk.
Does anyone have an idea of what could I try to find the exact location? Or any other alternative/Visual Studio Code extension to profile a java code?
Thanks a lot