如何通过kvm中的perf监视特定的应用程序? [英] How can a specific application be monitored by perf inside the kvm?

查看:188
本文介绍了如何通过kvm中的perf监视特定的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,当我在kvm VM中运行时,我想通过perf stat对其进行监视. 谷歌搜索后,我发现perf kvm stat可以做到这一点.但是,运行命令会出现错误:

I have an application which I want to monitor it via perf stat when running inside a kvm VM. After Googling I have found that perf kvm stat can do this. However there is an error by running the command:

sudo perf kvm stat record  -p appPID

这将导致帮助表示...

which results in help representation ...

usage: perf kvm stat record [<options>]

-p, --pid <pid>       record events on existing process id
-t, --tid <tid>       record events on existing thread id
-r, --realtime <n>    collect data with this RT SCHED_FIFO priority
    --no-buffering    collect data without buffering
-a, --all-cpus        system-wide collection from all CPUs
-C, --cpu <cpu>       list of cpus to monitor
-c, --count <n>       event period to sample
-o, --output <file>   output file name
-i, --no-inherit      child tasks do not inherit counters
-m, --mmap-pages <pages[,pages]>
                      number of mmap data pages and AUX area tracing mmap pages
-v, --verbose         be more verbose (show counter open errors, etc)
-q, --quiet           don't print any message

有人知道是什么问题吗?

Does any one know what is the problem?

推荐答案

将kvm与vPMU(PMU计数器的虚拟化)一起使用-perf record -p $pid和perf stat -p $pid.

Use kvm with vPMU (virtualization of PMU counters) - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Tuning_and_Optimization_Guide/sect-Virtualization_Tuning_Optimization_Guide-Monitoring_Tools-vPMU.html "2.2. VIRTUAL PERFORMANCE MONITORING UNIT (VPMU)"). Then run perf record -p $pid and perf stat -p $pid inside the guest.

主机系统不了解来宾进程(表)(它们由来宾内核管理,可以是非Linux或表格式不兼容的其他版本的Linux),因此主机内核无法描述某些特定的来宾进程.它只能对整个来宾进行概要分析(并且有perf kvm命令-

Host system has no knowledge (tables) of guest processes (they are managed by guest kernel, which can be non Linux, or different version of linux with incompatible table format), so host kernel can't profile some specific guest process. It only can profile whole guest (and there is perf kvm command - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Tuning_and_Optimization_Guide/chap-Virtualization_Tuning_Optimization_Guide-Monitoring_Tools.html#sect-Virtualization_Tuning_Optimization_Guide-Monitoring_Tools-perf_kvm)

这篇关于如何通过kvm中的perf监视特定的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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