I am trying to profile ffmpeg using the Linux perf command in docker. In the first run, the output is fine with all function names displayed by "perf report". In the second run, it only shows addresses rather than function names. I am using a script that runs the ffmpeg twice in a docker.
The commands used in the script is:
perf record ffmpeg -y -i input.mp4 -c:v libx264 -b:v 1500k output1.mp4
sleep 5
perf record ffmpeg -y -i input.mp4 -c:v libx264 -b:v 1500k output1.mp4
The command to run the script:
docker run -it --privileged -v $(pwd):/cwd myDocker:someTag /cwd/my_script.sh
I noticed in the second run, it cannot find the libx264 library in perf.data.
The outputs of "perf report" are shown below. Any kind of help is greatly appreciated.
Output 1:
# Overhead Command Shared Object Symbol
# ........ ....... .................. .........................................................
#
6.35% ffmpeg libx264.so.148 [.] x264_cabac_block_residual_rd_internal_ssse3_lzcnt
3.91% ffmpeg libx264.so.148 [.] x264_cabac_encode_decision_bmi2
3.70% ffmpeg ffmpeg [.] quantize_and_encode_band_cost_UPAIR
2.94% ffmpeg libx264.so.148 [.] x264_me_search_ref
Output 2:
# Overhead Command Shared Object Symbol
# ........ ....... .................. .........................................................
#
1.00% ffmpeg (deleted) [.] 0x00000000000c6e87
0.90% ffmpeg (deleted) [.] 0x00000000000c82c1
0.71% ffmpeg (deleted) [.] 0x00000000000c82e2
0.69% ffmpeg (deleted) [.] 0x00000000000c6e98
I appreciate it if someone can provide a clue.
Thank you in advance.
EDIT 1: I also read How can I get perf to find symbols in my program. That post does not answer my question as it does not address my situation.
EDIT 2: I also looked at perf can find symbol in the kernel ,but can not find symbol in my program. How to fix it?. The setting for my experiment is correct.
EDIT 3: When I run the script outside container, both iterations work perfectly fine. The only problem is when I run in in the docker container.
EDIT 4: After the first run, I ensured that both the binary and shared library object are visible to the ls and stat commands.
EDIT 5: After the first run, I ensured that both the binary and shared library object are visible to the nm and objdump commands. In addition, these commands show correct symbols.