在Linux中使用的硬件性能计数器 [英] Using Hardware Performance Counters in Linux
问题描述
我想使用附带的Intel和AMD x86_64的多核处理器的硬件性能计数器通过一个程序来计算退休门店数量。我想每个线程单独计算其退休商店。能不能做到?如果是这样,如何C / C ++?
I want to use the Hardware Performance Counters that come with the Intel and AMD x86_64 multicore processors to calculate the number of retired stores by a program. I want each thread to calculate its retired stores separately. Can it be done? And if so, how in C/C++?
推荐答案
可以,如果你想依靠内部程序的某些部分硬件事件(不启动任何第三方工具)使用Perfctr或PAPI。
You can use Perfctr or PAPI if you want to count hardware events on some part of the program internally (without starting any 3rd party tool).
Perfctr快速启动:<一href=\"http://www.ale.csce.kyushu-u.ac.jp/~satoshi/how_to_use_perfctr.htm\">http://www.ale.csce.kyushu-u.ac.jp/~satoshi/how_to_use_perfctr.htm
Perfctr quickstart: http://www.ale.csce.kyushu-u.ac.jp/~satoshi/how_to_use_perfctr.htm
PAPI主页: http://icl.cs.utk.edu/papi/
PerfSuite好的DOC:<一href=\"http://perfsuite.ncsa.illinois.edu/publications/LJ135/x27.html\">http://perfsuite.ncsa.illinois.edu/publications/LJ135/x27.html
PerfSuite good doc: http://perfsuite.ncsa.illinois.edu/publications/LJ135/x27.html
如果你能做到这一点外,还有现代的Linux的 PERF
命令。
If you can do this externally, there is a perf
command of modern Linux.
PERF的维基:<一href=\"https://perf.wiki.kernel.org/index.php/Main_Page\">https://perf.wiki.kernel.org/index.php/Main_Page
这篇关于在Linux中使用的硬件性能计数器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!