linux perf: 为什么采样频率设置成99Hz而不是100Hz
早晨在linuxer看到文章,感觉挺有意思,最早研究perf的时候接触过这些概念,乍一看倍感亲切。
sudo perf record -F 99 -a -g --sleep 20
perf record中这么几个参数还蛮有意思:
-F, --freq <n> profile at this frequency -g enables call-graph recording -G, --cgroup <name> monitor event in cgroup name only
-g可以设置Cgroup,竟然用cgroup的名字做索引
-F 是采样的频率?
-F 99: sample at 99 Herz (samples per second), I'll sometimes sample faster than this (up to 999 Herz), but that also costs overhead. 99 Hert should be negligible. Also, the value '99' and not '100' is to avoid lockstep sampleing, which can produce skewed results.
lockstep 采样!
lockstep sampleing is when the profiling samples occur at the same frequency as a loop in the application. The result of this would be that the sample often occurs at the same place in the loop, so it will think that opration is the most common operation, and a likely bottleneck. An analogy would be if you were