我有一个应用程序,我想在kvm VM中运行时通过perf stat监视它。 谷歌搜索后我发现perf kvm stat可以做到这一点。但是,运行命令会出错:
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
导致帮助表示......
{{1}}
有人知道这是什么问题吗?
答案 0 :(得分:1)
将vvm用于vPMU(PMU计数器的虚拟化) - 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。虚拟性能监控单元(VPMU)”)。然后在访客中运行perf record -p $pid
和perf stat -p $pid
。
主机系统没有客户进程的知识(表)(它们由来宾内核管理,可以是非Linux,或者是不兼容的表格式的不同版本的linux),因此主机内核无法分析某些特定的来宾进程。它只能描述整个访客(并且有perf kvm
命令 - 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)