linux – 如何更改perf_event_open最大采样率
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 如何更改perf_event_open最大采样率,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1529字,纯文字阅读大概需要3分钟。
内容图文
![linux – 如何更改perf_event_open最大采样率](/upload/InfoBanner/zyjiaocheng/970/6e2d0edbddbc409eaaa44a0dfcd25342.jpg)
我正在使用perf_event_open来获取样本.我试图让每个人都受到重视.但是perf_event_open还不够快.我尝试使用以下命令更改采样率:
echo 10000000 > /proc/sys/kernel/perf_event_max_sample_rate
但看起来我设定的值太大了.运行我的代码后,perf_event_max_sample_rate将更改回较低的值,例如12500.当我尝试更改更大的值(例如20000000,50000000等)时,样本速度不会随着值I更改而增加.有没有办法更快地更改perf_event_open采样速度?
解决方法:
这是一种限制perf引起的开销的机制.您可以通过设置禁用它
sysctl -w kernel.perf_cpu_time_max_percent=0
使用风险由您自己承担 – 系统可能会停止响应.
https://www.kernel.org/doc/Documentation/sysctl/kernel.txt
perf_cpu_time_max_percent:
Hints to the kernel how much CPU time it should be allowed to use to
handle perf sampling events. If the perf subsystem is informed that
its samples are exceeding this limit, it will drop its sampling
frequency to attempt to reduce its CPU usage.Some perf sampling happens in NMIs. If these samples unexpectedly
take too long to execute, the NMIs can become stacked up next to each
other so much that nothing else is allowed to execute.0: disable the mechanism. Do not monitor or correct perf’s
sampling rate no matter how CPU time it takes.1-100: attempt to throttle perf’s sample rate to this percentage of
CPU. Note: the kernel calculates an “expected” length of each
sample event. 100 here means 100% of that expected length. Even
if this is set to 100, you may still see sample throttling if this
length is exceeded. Set to 0 if you truly do not care how much CPU
is consumed.
内容总结
以上是互联网集市为您收集整理的linux – 如何更改perf_event_open最大采样率全部内容,希望文章能够帮你解决linux – 如何更改perf_event_open最大采样率所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。