Google Benchmark负面配置计数器
我正在将Google/Benchmark用于一个项目,而我刚刚开始使用-benchmark_perf_counters
flag。显然,我做错了什么,因为perf柜台通常是负面的。我假设这是一个带溢出的问题,但是我仍然不太了解计数器如何起作用。
例如,第一个基准测试中的高速缓存0是如何,然后在第二个基准上进行-372k?这些价值对我来说都不是有意义的。
(两个基准的参数非常相似,并且运行时)
我在Ubuntu上运行18.04 W/ Intel(R)Xeon(R)Gold 6138 CPU。 Google基准版本为1.6.1,我安装了libpfm4-dev
。我正在调用我的基准二进制w/ - benchmark_perf_counters =循环,说明,cach-misses
-----------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
-----------------------------------------------------------------------------------------------------
bit::shift_left (small) (AA) 3.15 ns 3.15 ns 221185726 CACHE-MISSES=0 CYCLES=11.0005 INSTRUCTIONS=15
bit::shift_left (small) (UU) 2.65 ns 2.65 ns 254254663 CACHE-MISSES=-372.709k CYCLES=553.131k INSTRUCTIONS=372.709k
boost::shift_left (small) (AA) 2.71 ns 2.71 ns 258007443 CACHE-MISSES=-367.288k CYCLES=-367.288k INSTRUCTIONS=3.87586n
std::shift_left (small) 23.5 ns 23.5 ns 29812478 CACHE-MISSES=-3.17853M CYCLES=-102.703 INSTRUCTIONS=-972.747n
I'm using Google/benchmark for a project, and I just started playing around with the --benchmark_perf_counters
flag. Clearly I'm doing something wrong, since the perf counters are often negative. I'm assuming it's an issue w/ overflow, but I still don't quite understand how the counters work to begin with.
For example, how is CACHE-MISSES 0 on the first benchmark, and then -372k on the second? Neither of those values make sense to me.
(the two benchmarks have very similar parameters and runtime)
I'm running on Ubuntu 18.04 w/ an Intel(R) Xeon(R) Gold 6138 CPU. Google benchmark version is 1.6.1 and I have libpfm4-dev
installed. I'm calling my benchmark binary w/ --benchmark_perf_counters=CYCLES,INSTRUCTIONS,CACH-MISSES
-----------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
-----------------------------------------------------------------------------------------------------
bit::shift_left (small) (AA) 3.15 ns 3.15 ns 221185726 CACHE-MISSES=0 CYCLES=11.0005 INSTRUCTIONS=15
bit::shift_left (small) (UU) 2.65 ns 2.65 ns 254254663 CACHE-MISSES=-372.709k CYCLES=553.131k INSTRUCTIONS=372.709k
boost::shift_left (small) (AA) 2.71 ns 2.71 ns 258007443 CACHE-MISSES=-367.288k CYCLES=-367.288k INSTRUCTIONS=3.87586n
std::shift_left (small) 23.5 ns 23.5 ns 29812478 CACHE-MISSES=-3.17853M CYCLES=-102.703 INSTRUCTIONS=-972.747n
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题!升级到最新版本的Google Benchmark(1.7.0)修复了它,现在我的Perf Counter结果很有意义。
I had this same problem! Upgrading to the latest version of Google Benchmark (1.7.0) fixed it and now my perf counter results make sense.