gpt4 book ai didi

AMD 性能事件

转载 作者:行者123 更新时间:2023-12-01 12:18:50 25 4
gpt4 key购买 nike

我正在尝试使用 perf在我的带有 AMD cpu 的设备上,但我真的找不到任何关于如何获取的信息,比如说,cache-misses来自 AMD。我读到你需要写 -e rNNN ,其中 NNN是事件的十六进制代码,但我没有找到任何表格或其他东西来查看这些代码。你能帮我解决这个问题吗,因为互联网上似乎根本没有任何信息!实际上,在 perf 的手册中有一些链接,但它们无效:(

最佳答案

查询 perf list输出,在现代 Linux 内核版本中,它可能会报告一些特定于体系结构的硬件事件。一些通用硬件事件可能总是由 perf list 报告(尤其是对于较旧的内核),但并非所有内核都映射到某个真实的硬件事件。 cache-missescycles是这样的通用性能硬件事件,并不总是映射(映射在性能源代码中大约 http://elixir.free-electrons.com/linux/latest/source/arch/x86/events/amd/core.c 为 amd - 与 cache-misses 映射到 [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, )。

还可以使用 perf stat -e event1,cycles,instructions,cpu-clock 从性能列表中尝试不同的事件其中 event1 是您要检查的事件,并且有一些工作事件。

要编码原始事件,可以更轻松地使用处理器文档、性能源(用于精确的十六进制编码)和 some external tools .对于英特尔,有 ocperf.py来自 http://github.com/andikleen/pmu-tools地点;并且在 perfmon2/libpfm4 中有通用的原始生成器,描述于 http://www.bnikolic.co.uk/blog/hpc-prof-events.html Bojan Nikolic 与 showevtinfo 共同撰写的“如何监控所有 CPU 性能事件” util(这也是在常见问题解答中为 perf 获取 rXXXX 代码的推荐方法:http://web.eece.maine.edu/~vweaver/projects/perf_events/faq.html#q2e Q2e。如何确定正确的“原始”事件值):

In order to make full use of these counters one currently has to specify them to the perf tools as a raw hexadecimal code (-e rXXXX where XXXX is the code). This raises two obvious questions:

  • What codes to use?
  • What does all this information mean?

I'll cover the second of these in later posts, but for time being here is how to figure out raw codes to use:

  1. Get the latest version of perfmon2/libpfm (h/t this developerworks article):

    git clone git://perfmon2.git.sourceforge.net/gitroot/perfmon2/libpfm4; cd libpfm4; make

  2. Run the showevtinfo program (in examples subdirectory) to get a list of all available events, and the masks and modifiers that are supported (see the output below for an example of the full output)

  3. Figure out what events and what with masks and modifiers you want to use. The masks are prefixed by Umask and are given as hexadecimal numbers and also symbolic names in the square brackets. The modifiers are prefixed by Modif and their names are also in square brackets.

  4. Use the check_events program (also in examples sub-directory) to convert the event, umask and modifiers into a raw code. You can do this by running the command as: check_events <event name>:<umask>[(:modifers)*] i.e., you supply the event name, the umask and multiple modifiers all separated by the colon character. The program will then print out, amongst other things, an raw event specification, for example:

    Codes : 0x531003

  5. This hexadecimal code can be used as parameter to GNU/Linux perf tools, for example to perf stat by supplying it with -e r531003 option

关于AMD 性能事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46104738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com