Search code examples
jvmperf

Java Perf Map Agent "Could not find Agent_OnLoad function"


On oracle jdk1.8.0_251 I have error when trying to use perf tool helper library "libperfmap.so" (perf-map-agent)

taskset -c 1,7 java -XX:+PreserveFramePointer -agentpath:$WORK_HOME/perf-map-agent/out/libperfmap.so=unfold,msig -cp $WORK_HOME/HARDWARE/xx/target/xx-1.0-SNAPSHOT.jar org.xx.xx.logic.xx.xxTest 0 50
Error occurred during initialization of VM
Could not find Agent_OnLoad function in the agent library: /home/username/Documents/JINT/perf-map-agent/out/libperfmap.so

Another variant of the error message:

Error occurred during initialization of VM
Could not find Agent_OnLoad function in the agent library: /home/username/Documents/lowlatency/xxx/JINT/perf-map-agent/out/libperfmap.so

Solution

  • perf-map-agent currently does not support loading as -agentpath. See issue #27 for the previous discussion on the topic.

    There are also two pull requests (#63, #85) adding Agent_OnLoad functionality; you may try one of those.

    Meanwhile I can recommend async-profiler as an alternative. It supports both -agentpath mode and attach in runtime. It also supports perf events and generates flame graphs out of the box without 3rd party software.