jvm-profiling-tools / perf-map-agent

A java agent to generate method mappings to use with the linux `perf` tool
GNU General Public License v2.0
1.64k stars 260 forks source link

bjdump: /tmp/perf-1390290.map: File format not recognized #92

Open cyberspicecai opened 1 year ago

cyberspicecai commented 1 year ago

Hi, Authors

I want to profile the instruction of the code of https://github.com/mkyong/jmh-benchmark.git and find that: bjdump: /tmp/perf-1390290.map: File format not recognized.

How reproduce: 1, use mvn package to compile the jmh-benchmark 2, numactl -C 3 -m 0 java -jar target/benchmarks.jar loopFor #run the test case. or this method: perf record -v -g -k 1 numactl -C 3 -m 0 java -agentpath:/usr/lib64/libperf-jvmti.so -jar target/benchmarks.jar loopFor 3, perf the thread which is from pgrep java 4, ./create-java-perf-map.sh 3490983 -F 99 #to output the java jit map. 5, perf report -i /tmp/pid-3490983.data will show the error.

thanks.
jrudolph commented 1 year ago

Not sure what the issue is. For JMH you might not even need the agent as JMH has built-in support for perf profiling. E.g. see https://github.com/Valloric/jmh-playground/blob/master/src/jmh/java/org/openjdk/jmh/samples/JMHSample_35_Profilers.java

cyberspicecai commented 1 year ago

Not sure what the issue is. For JMH you might not even need the agent as JMH has built-in support for perf profiling. E.g. see https://github.com/Valloric/jmh-playground/blob/master/src/jmh/java/org/openjdk/jmh/samples/JMHSample_35_Profilers.java

thanks for your info, jrudolph.

cyberspicecai commented 1 year ago

Hi, Rudolph I refer to your link. and use the built-in profiling. Good stuff. but I want to go further into the cpu instruction info as that the normal linux perf does. And I got the following profiling content: ....[Hottest Region 1].............................................................................. c2, level 4, com.mkyong.benchmark.BenchmarkLoop::loopFor, version 399 (180 bytes)

       0x00007f8664a40d90: 004d 8bd0 
       0x00007f8664a40d94: ;*getfield size {reexecute=0 rethrow=0 return_oop=0}
                           ; - java.util.ArrayList::size@1 (line 253)
                           ; - com.mkyong.benchmark.BenchmarkLoop::loopFor@7 (line 53)
       0x00007f8664a40d94: 418b 6a10 | 85ed 660f | 1f44 0000 | 0f8e d700 
       0x00007f8664a40da4: ;*if_icmpge {reexecute=0 rethrow=0 return_oop=0}
                           ; - com.mkyong.benchmark.BenchmarkLoop::loopFor@12 (line 53)
       0x00007f8664a40da4: 0000 4885 | d20f 8481 | 0100 0045 | 33c9 eb0f | 0f1f 8400 | 0000 0000 | 6666 6690 

1.70% 0x00007f8664a40dc0: ;aload_0 {reexecute=0 rethrow=0 return_oop=0} ; - com.mkyong.benchmark.BenchmarkLoop::loopFor@15 (line 54) 1.70% 0x00007f8664a40dc0: 448b cd45 0x00007f8664a40dc4: ; {metadata('java/util/ArrayList')} 0x00007f8664a40dc4: 8b58 0841 | 81fb c0e0 | 0000 0f85 | fc00 0000 1.52% 0x00007f8664a40dd4: ;invokeinterface get {reexecute=0 rethrow=0 return_oop=0} ; - com.mkyong.benchmark.BenchmarkLoop::loopFor@20 (line 54) 1.52% 0x00007f8664a40dd4: 4d8b d045 0x00007f8664a40dd8: ;getfield size {reexecute=0 rethrow=0 return_oop=0} ; - java.util.ArrayList::get@2 (line 427) ; - com.mkyong.benchmark.BenchmarkLoop::loopFor@20 (line 54) 0x00007f8664a40dd8: 8b5a 100f | 1f44 0000 | 4585 db0f | 8c0b 0100 0x00007f8664a40de8: ;invokestatic checkIndex {reexecute=0 rethrow=0 return_oop=0}

 Would you pls show me how to get the cpu-related instruction running info?

 Thanks a lot.