"perf" 可以在 Google Cloud Platform 上 运行 的备用性能管理工具
"perf" alternate performance management tools that can run on Google Cloud Platform
我尝试在 GCP 上托管的 Ubuntu 虚拟机中使用 "perf" 命令。但是当我 运行:
sudo perf stat -e task-clock,cycles,instructions,cache-references,cache-misses ./AppName
输出:
Performance counter stats for './AppName':
490.299513 task-clock (msec) # 0.081 CPUs utilized
<not supported> cycles
<not supported> instructions
<not supported> cache-references
<not supported> cache-misses
6.036963754 seconds time elapsed
除任务时钟外,其他所有显示为"not supported"。
我想要缓存引用和缓存未命中数据。那么除了"perf"还有其他选择吗?
我在 ubuntu、redhat 的项目中重现了相同的场景,方法是使用不同类型的机器(N1、N2)并获得与您提供的相同的输出:
root@perf-test-ubuntu:~# perf stat -e task-clock,cycles,instructions,cache-references,cache-misses
^C
'system wide':
的性能计数器统计
44450.342564 task-clock (msec) # 1.000 CPUs utilized
<not supported> cycles
<not supported> instructions
<not supported> cache-references
<not supported> cache-misses
44.470234233 seconds time elapsed
我找到了一些有用的链接 [1][2],似乎 Linux perf 工具默认尝试使用硬件性能监控计数器。当您的 OS 被虚拟化时,您无法直接访问所有计数器;一些虚拟化解决方案可能允许访问一些基本计数器(如果已配置)。 [1]
您想要的数据在基于硬件的性能监控计数器中。这些通常不会被虚拟机环境模拟,因为它们是开销并且通常没有意义,因为底层缓存统计信息是在每个核心/包的基础上维护的,并且工作负载可以安排在各种核心上 运行,每个核心都有它自己的硬件级别统计信息。 [2]
希望这些信息对您有所帮助。
[1]-Linux perf events profiling in Google Compute Engine not working
[2]-https://www.researchgate.net/post/Why_doesnt_perf_report_cache-refernces_cache-misses
我尝试在 GCP 上托管的 Ubuntu 虚拟机中使用 "perf" 命令。但是当我 运行:
sudo perf stat -e task-clock,cycles,instructions,cache-references,cache-misses ./AppName
输出:
Performance counter stats for './AppName':
490.299513 task-clock (msec) # 0.081 CPUs utilized
<not supported> cycles
<not supported> instructions
<not supported> cache-references
<not supported> cache-misses
6.036963754 seconds time elapsed
除任务时钟外,其他所有显示为"not supported"。 我想要缓存引用和缓存未命中数据。那么除了"perf"还有其他选择吗?
我在 ubuntu、redhat 的项目中重现了相同的场景,方法是使用不同类型的机器(N1、N2)并获得与您提供的相同的输出:
root@perf-test-ubuntu:~# perf stat -e task-clock,cycles,instructions,cache-references,cache-misses ^C 'system wide':
的性能计数器统计 44450.342564 task-clock (msec) # 1.000 CPUs utilized
<not supported> cycles
<not supported> instructions
<not supported> cache-references
<not supported> cache-misses
44.470234233 seconds time elapsed
我找到了一些有用的链接 [1][2],似乎 Linux perf 工具默认尝试使用硬件性能监控计数器。当您的 OS 被虚拟化时,您无法直接访问所有计数器;一些虚拟化解决方案可能允许访问一些基本计数器(如果已配置)。 [1]
您想要的数据在基于硬件的性能监控计数器中。这些通常不会被虚拟机环境模拟,因为它们是开销并且通常没有意义,因为底层缓存统计信息是在每个核心/包的基础上维护的,并且工作负载可以安排在各种核心上 运行,每个核心都有它自己的硬件级别统计信息。 [2]
希望这些信息对您有所帮助。
[1]-Linux perf events profiling in Google Compute Engine not working
[2]-https://www.researchgate.net/post/Why_doesnt_perf_report_cache-refernces_cache-misses