0

I want to profile an application compiled with debug symbols:

$ file ../../bin/linux-x86_64/simulator
../../bin/linux-x86_64/simulator: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=156bbd57d203d72f4226ed4ad0727bcf472f83ef, for GNU/Linux 3.2.0, with debug_info, not stripped

It runs inside a podman container. The container is a debian 11 and the host is an ubuntu 22.04. I have been able to use perf with it before but i must be forgetting some necessary configuration.

Outside the container i did:

sudo sysctl kernel.perf_event_paranoid=-1

Then to enter the container:

podman run --privileged --entrypoint=bash --network=host --rm -it -v ./st.cmd/:/opt/ad-sim-epics-ioc/iocBoot/iocsimulator/st.cmd -v /home/marco:/home/marco ghcr.io/cnpem/ad-sim-epics-ioc:v1.0.0

And finally to install perf:

apt-get update && apt-get install linux-perf

To get the profiler results:

perf record -g ./st.cmd # st.cmd is an interpreter with shebang poiting to ../../bin/linux-x86_64/simulator

At the first try, system will complain:

/usr/bin/perf: line 13: exec: perf_5.15: not found

But since i found several people claiming that its okay to copy or symbolically link perf:

ln -s /usr/bin/perf_5.10 /usr/bin/perf_5.15

Finally:

perf record -g ./st.cmd
(do things...)
^C
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.128 MB perf.data (2500 samples) ]

perf script -F +pid > script.txt

But absolutely no userspace function is shown, only kernel kallsyms:

enter image description here

I tried running the container with and without --privileged flag, tried perf record --call-graph dwarf, perf record --call-graph fp, and nothing. I vividly remember being able to see the functions just with perf record -g... what am I doing wrong?

Thanks in advance for anyone who helps this lost, desperate soul.

1 Answer 1

1

Okay, so it was all actually the kernel's fault, i think.

Sometime ago, before I even thought about profiling, I received the following message from the server:

enter image description here

But as it was a production server and the kernel update caused a mess with some drivers, I fixed the kernel version to 5.15.0-91 in my /etc/default/grub file.

Turns out the perf installation I had was from before couldn't deal with the older kernel version. When i remembered this and updated the kernel (thus temporarily sacrificing my operation) perf started working even inside the container.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.