Java 性能映射代理 "Could not find Agent_OnLoad function"

Java Perf Map Agent "Could not find Agent_OnLoad function"

在 oracle jdk1.8 上。0_251 我在尝试使用 perf 工具帮助程序库时遇到错误“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

错误消息的另一种变体:

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

perf-map-agent 目前不支持加载为 -agentpath。有关该主题的先前讨论,请参阅 issue #27

还有两个拉取请求 (#63, #85) 添加了 Agent_OnLoad 功能;你可以尝试其中之一。

同时我可以推荐 async-profiler 作为替代方案。它支持 -agentpath 模式并在运行时附加。它还支持 perf 事件并生成开箱即用的火焰图,无需 3rd 方软件。