i would like to profile my c++ app inside docker container. Perf needs container launched with --privileged
flag but CLion doesn't have that option for docker plugin. Are there any ways to use CLion built profiler extension to launch perf inside docker and get flame graph?
I have already tried to add flag to "Container Settings" on ToolChain tab but IDE ignores it
Finally found the solution. Maybe it will be useful for somebody.
Despite the --privileged
flag you still have to add on host:
sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid'
sudo sh -c 'echo 0 >/proc/sys/kernel/kptr_restrict'
from the clion official manual https://www.jetbrains.com/help/clion/cpu-profiler.html#Prerequisites
This worked for me:
sudo sh -c 'echo -1 >/proc/sys/kernel/perf_event_paranoid'
sudo sh -c 'echo 0 >/proc/sys/kernel/kptr_restrict'