最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - How to use perf inside docker container with CLion (pass --privileged flag to docker)? - Stack Overflow

programmeradmin0浏览0评论

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

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

Share Improve this question edited Feb 2 at 18:11 Peter Cordes 366k49 gold badges717 silver badges977 bronze badges asked Feb 2 at 18:10 dexnp1dexnp1 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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/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'
发布评论

评论列表(0)

  1. 暂无评论