Google Compute Engine中的Linux性能事件分析不起作用 [英] Linux perf events profiling in Google Compute Engine not working

查看:83
本文介绍了Google Compute Engine中的Linux性能事件分析不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用Google Compute Engine的新手.我想使用Linux性能工具对我的应用程序进行一些性能事件测量,并最终进行性能分析.我已经在Ubuntu 16.04 LTS VM上安装了Linux性能工具.但是,即使是基本事件(如循环)也显示为不支持".我猜测底层的KVM虚拟机管理程序未启用虚拟PMU支持,尽管我相信KVM确实使用非默认标志设置来支持此功能.有什么办法可以使它正常工作吗?

I'm new to using Google Compute Engine. I'd like to use the Linux perf tool to do some various perf events measurements of my application and eventually sample profiling. I've installed the linux perf tool on my Ubuntu 16.04 LTS VM. However even basic events like cycles show up as "not supported". I'm guessing that the underlying KVM hypervisor does not have virtual PMU support enabled, although I believe KVM does support this with a non-default flag setting. Is there any way to get this working?

# perf stat -e cycles -a sleep 10

Performance counter stats for 'system wide':

<not supported>      cycles                   

  10.000598339 seconds time elapsed

推荐答案

Linux性能工具默认尝试使用硬件性能监视计数器.虚拟化操作系统后,您将无法直接访问所有计数器.如果配置了多种虚拟化解决方案,它们可能允许访问一些基本计数器.

Linux perf tool by default tries to use hardware performance monitoring counters. When your OS is virtualized, you have no direct access to all counters; several virtualization solutions may allow access to some basic counters, if configured.

在您的情况下,GCE虚拟化似乎不提供此类访问权限. (问您对GCE的支持吗?如果已在VM外部将其禁用,则无法更改.)

In your case it seems that GCE virtualization give no such access. (Ask support of your GCE? If it was disabled outside of your VM, you cant change this.)

您可以将perf与某些软件事件一起使用,例如-e task-clock以获取基本配置文件.在perf stat输出中检查受支持的事件,在perf list中检查软件事件.

You may use perf with some software events, for example -e task-clock to get basic profiling. Check perf stat output for supported events and perf list for Software events.

perf stat -e task-clock ...
perf record -e task-clock ...

这篇关于Google Compute Engine中的Linux性能事件分析不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆