文档介绍:华中科技大学
硕士学位论文
基于硬件计数器虚拟化的多虚拟机性能评测研究
姓名:蒋海鸥
申请学位级别:硕士
专业:计算机系统结构
指导教师:袁平鹏
2011-01-25
华中科技大学硕士学位论文
摘要
虚拟化技术的广泛应用引发了对虚拟化环境下性能分析工具的需求。如不同虚
拟机里的用户需了解运行在该虚拟机的程序的性能问题,以便优化程序性能及运行
环境配置。这都需要对程序的性能进行分析,一种性能分析方法是基于硬件计数器
技术。它需要在程序执行过程中,对相应的 CPU 事件进行统计来分析程序性能。由
于硬件计数器是一种专用的寄存器,每个 CPU 上的硬件计数器数量有限。因此,对
于基于硬件计数器的性能分析工具,一次能同时分析的 CPU 事件有限。如目前 Xen
虚拟环境下的 Xenoprof 工具,它能让多个虚拟机同时分析相同的 CPU 事件,但不能
在不同的虚拟机里同时分析不同的事件。因此,不能满足虚拟环境下多用户在不同
虚拟机同时使用的需要。基于以上提出的问题,可以使用一种基于硬件计数器虚拟
化技术的多虚拟机性能评测方法,从而能让不同的虚拟机同时分析不同的 CPU 事
件,并且各个虚拟机之间互不影响。
对硬件计数器虚拟化来实现各个虚拟机对硬件计数器的分时复用,从而能让多
个虚拟机同时独立地评测不同的事件;为了降低开销对性能分析精度的影响,将对
硬件计数器的读写操作放入 VMM(虚拟机管理器)的时间片。同时,在 Xen VMM
层次通过采样机制来获取 CPU 事件的采样信息,并将这些信息分发到与各个虚拟机
对应的缓冲区,最后再交给虚拟机用户层的分析工具进行分析处理,从而得到相应
的分析结果及详细的性能信息。这样,多个虚拟机里的用户就能同时评测不同的
CPU 事件,并感觉不到其它用户的存在,从而为虚拟环境下的程序分析提供较大的
便利。
从测试结果可以看出,该系统在功能上能较好地满足需求,能让多个虚拟机同
时独立、互不影响地评测不同的 CPU 事件;同时,在性能上也取得了较好的效果,
将该系统的测试结果同 Xenoprof 在同等条件下的测试结果对比,两者得到的性能数
据基本相当。
关键词:虚拟机,硬件计数器,虚拟化,性能评测
I
华中科技大学硕士学位论文
Abstract
With the wide application of virtualization technology, the demand for performance
analysis and system diagnosis in virtualization environment is increasing. For example,
users in different virtual machines may need to obtain the performance issues of programs
in respective virtual machine. A performance analysis approach is based on the
virtualization of hardware performance counters, and it obtains performance information
of programs during its execution by monitoring respective CPU events. However,
hardware performance counters are a kind of special purpose registers, and the count of
them is limited. For example, Xenoprof, the toolkit in Xen virtual machine environment,
can make multiple virtual machines monitor the same CPU events in a session
simultaneously, but monitoring different CPU events in different virtual machines
simultaneously is not allowed. Therefore, it can’t satisfy the individual profiling need of
multiple users in Xen virtual machine e