Understanding perf.map

St.Antario :

I'm aware of the great async_profiler tool and I use it for profiling my production projects. Here I want to understand about perf and how to understand its output.

I'm playing around with perf to sample stack traces. I run the JVM with options -XX:+UnlockDiagnosticVMOptions -XX:+PreserveFramePointer -XX:+ShowHiddenFrames to avoid stack trace messing.

I ran it with command sudo perf record -e cycles -g -p <my_pid> in order to sample both user an kernel stack traces and compare the resulting percentage. Here is what I got:

enter image description here

The start_thread symbol seems clear to me. They came from the libjvm.so and I can make the assumtion that I ran my 3 Worker Thread to do some job and this is exactly what I see here. The hexidecimal numbers seem to be a runtime compiled java-code instructions addresses.

QUESTION: But where did the perf-27405.map come from and why it appeared on top.

apangin :

perf-<pid>.map file is a way to provide perf with application-specific symbol map.

In your case one of the sampled instruction pointers 0x00000000008e06e0 belongs to libjvm.so - perf can easily show this. But the other one 0x00007f557d10c19f belongs to anonymous memory region not backed by any object file. This is dynamically generated code, and perf cannot tell anything about it unless someone helps. perf-<pid>.map file is the interface for the application or the external tools to provide symbol information for dynamically generated code.

perf-map-agent is an example of such tool for Java. It fills perf-<pid>.map file with the information about JIT-compiled methods, so that perf can map these addresses to Java method names.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=94599&siteId=1