计算机工程与应用 ›› 2017, Vol. 53 ›› Issue (11): 61-66.DOI: 10.3778/j.issn.1002-8331.1512-0355

• 理论与研发 • 上一篇    下一篇

基于QEMU的CPU指令频度分析

孙卫真1,张美琳1,向  勇2,毛英明3,曹睿东2   

  1. 1.首都师范大学 信息工程学院 计算机科学与技术系,北京 100048
    2.清华大学 计算机科学与技术系 网络所,北京 100084
    3.北京理工大学 计算机学院,北京 100081
  • 出版日期:2017-06-01 发布日期:2017-06-13

QEMU-based CPU instruction frequency analysis

SUN Weizhen1, ZHANG Meilin1, XIANG Yong2, MAO Yingming3, CAO Ruidong2   

  1. 1.Department of Computer Science and Technology, College of Information Engineering, Capital Normal University, Beijing 100048, China
    2.Institute of Network, Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China
    3.School of Computer Science & Technology, Beijing Institute of Technology, Beijing 100081, China
  • Online:2017-06-01 Published:2017-06-13

摘要: 采集计算机在不同应用环境下的指令流,并对计算机各个指令使用的频度进行统计,对CPU指令设计和优化有指导意义。针对现有指令频度统计方法存在的跟踪效率低、获取速度慢等问题,提出一种新的指令频度分析方法。该方法的核心思想是在QEMU模拟器上执行用户行为脚本,利用QEMU插件获取CPU执行的指令流,并利用基于块的统计优化性能。实验结果表明,该方法可跟踪并获取指令流,能高效地分析出各指令的使用频度,并直观地展示分析结果。

关键词: 指令频度, 虚拟机, 模拟, 自动测试

Abstract: It is instructive for the design and optimization of CPU instruction to collect computer instruction streams and calculate the frequency of each kind of instruction in different application environments. Aiming at the problems of low efficiency and slow speed in the existing methods of calculation instruction frequency, a new method is proposed. The main idea of this method is to perform a script to record user behavior on the QEMU emulator and use the QEMU plug-in to obtain the instruction stream in the simulation of CPU. Analysis performance is promoted by using block-based statistics. Experimental results show that the proposed method can track and obtain the instruction stream and analyze the frequency of each instruction more efficiently. And the results of the analysis are visualized.

Key words: instruction frequency, virtual machine, simulation, automatic test