Running perf in docker when executables are on shared volumes

52 Views Asked by At

I'm using Docker Desktop for Mac and have launched my container using the following command:

$ docker run --privileged -it -v $PWD:/opt image-codecs-bench sh

I want to build the library from PWD and profile it. I have the working setup for perf tool inside a container, there is no problem with rights. I also don't have a problem with debug symbols, they are present in executables after compiling.

There is no problem if I do make install after build and run pref record cjxl ....

But if I run pref record against local executables, which are on shared drive, I can't see functions names in perf report output.

/opt/build_docker # perf record ./tools/cjxl ...
...
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.093 MB perf.data (2307 samples) ]

/opt/build_docker # perf report -v
Looking at the vmlinux_path (8 entries long)
symsrc__init: cannot get elf header.
Using /proc/kcore for kernel data
Using /proc/kallsyms for symbols
Failed to open /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0, continuing without symbols
#
# Total Lost Samples: 0
#
# Samples: 2K of event 'cpu-clock:pppH'
# Event count (approx.): 576750000
#
# Overhead  Command  Shared Object                                                         Symbol                               
# ........  .......  ....................................................................  .....................................
#
     7.07%  cjxl     /proc/kcore                                                           0xffffdeccf367ceb4 k [k] memchr_inv
     3.21%  cjxl     /proc/kcore                                                           0xffffdeccf366c7d8 k [k] memset
     2.30%  cjxl     /proc/kcore                                                           0xffffdeccf30bf504 k [k] preempt_coun
     2.25%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0x1e938            ! [.] 0x0000000000
     1.86%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0xb0668            ! [.] 0x0000000000
     1.34%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0x1a060            ! [.] 0x0000000000
     1.30%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0x19fe4            ! [.] 0x0000000000
     1.26%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0xb0698            ! [.] 0x0000000000
     1.00%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0xb1000            ! [.] 0x0000000000
     0.91%  cjxl     /host_virtiofs/Users/Master/Code/libjxl/build_docker/libjxl.so.0.9.0  0xaba54            ! [.] 0x0000000000
     0.87%  cjxl     /proc/kcore                                                           0xffffdeccf3cc2714 k [k] el0_da

The problem is there is no /host_virtiofs in my container, but perf trying this paths for some reason. Is there any way to solve this?

0

There are 0 best solutions below