从kernel documenation开始,我们对各种值有以下行为:
perf_event_paranoID:
Controls use of the performance events system by unprivileged users
(without CAP_SYS_admin). The default value is 2.-1: Allow use of (almost) all events by all users
Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK>=0: disallow ftrace function tracepoint by users without CAP_SYS_admin
disallow raw tracepoint access by users without CAP_SYS_admin>=1: disallow cpu event access by users without CAP_SYS_admin
>=2: disallow kernel profiling by users without CAP_SYS_admin
我的perf_event_paranoID文件中有1个应该“禁止cpu事件访问” – 但这究竟是什么意思?
普通读数意味着无法访问cpu性能计数器事件(例如Intel PMU事件),但似乎我可以访问那些就好了.例如:
$perf stat sleep 1 Performance counter stats for 'sleep 1': 0.408734 task-clock (msec) # 0.000 cpus utilized 1 context-switches # 0.002 M/sec 0 cpu-migrations # 0.000 K/sec 57 page-faults # 0.139 M/sec 1,050,362 cycles # 2.570 GHz 769,135 instructions # 0.73 insn per cycle 152,661 branches # 373.497 M/sec 6,942 branch-misses # 4.55% of all branches 1.000830821 seconds time elapsed
这里,许多事件是cpu PMU事件(周期,指令,分支,分支未命中,缓存未命中).
如果这些不是所引用的cpu事件,它们是什么?
解决方法 在这种情况下,cpu事件是指监视每个cpu而不是每个任务的事件.对于perf工具,这限制了使用-C,--cpu= Count only on the List of cpus provIDed. Multiple cpus can be provIDed as a comma-separated List with no space: 0,1. Ranges of cpus are specifIEd with -: 0-2. In per-thread mode,this option is ignored. The -a option is still necessary to activate system-wIDe monitoring. Default is to count on all cpus.-a,--all-cpus system-wIDe collection from all cpus (default if no target is specifIEd)
对于perf_event_open,这考虑以下情况:
pID == -1 and cpu >= 0 This measures all processes/threads on the specifIEd cpu. This requires CAP_SYS_admin capability or a /proc/sys/ker‐ nel/perf_event_paranoID value of less than 1.
这可能是特定于版本的,引用的文档来自4.17.这是another related question.
总结以上是内存溢出为你收集整理的linux-kernel – perf_event_paranoid == 1实际上对x86 perf有什么限制?全部内容,希望文章能够帮你解决linux-kernel – perf_event_paranoid == 1实际上对x86 perf有什么限制?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)