- TODO
- visualvm cannot profile remote apps
- Helpful for short-lived apps & junit tests
- Allows instrumentation from startup
- Only works on local applications
- Uses JMX agent internally
- enables taking heap dumps
- Must use same (OS) user for profiler and the app
- Start new process and profile its start
- Point to the same JVM the app uses
- Choose a port
- Profile: memory or cpu
- Memory: defaults are fine
- Copy cli flag for
-agentpath:... - Add
-agentpath:...flag to jvm options for my java program- eg.
/path/to/java -Dcom.sun.management.jmxremote -agentpath:/home/myself/.sdkman/candidates/visualvm/current/visualvm/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/home/myself/.sdkman/candidates/visualvm/current/visualvm/lib,5140- linux uses
libprofilerinterface.so
- linux uses
- eg.
/path/to/java.exe -Dcom.sun.management.jmxremote -agentpath:c:/Users/myself/opt/VisualVM/.../windows-amd64/profilerinterface.dll=c:\...\profiler\lib,5140 -jar app.jar- windows uses
profilerinterface.dll
- windows uses
- eg.
- Click "Profile" button on lower right
- VisualVM will wait for the app to connect
- "Connecting to the target VM..."
- Start the application (with the flags above)
- TODO
...TODOtasks.test {
jvmArgs = [
]
}- TODO
visualvm --fontsize 18- $550 (one developer, installable on multiple machines)
- $2,200 (one active process at a time)
- $550 (one machine)
- $2,750 (one active process at a time)
- TODO