Core i3/5/7 CPU是否提供测量IPC的机制? [英] Do Core i3/5/7 CPUs provide a mechanism to measure IPC?

查看:119
本文介绍了Core i3/5/7 CPU是否提供测量IPC的机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

至少在过去十年中,所有Intel CPU都包括一组性能监视器,该监视器记录各种事件.最新的Intel CPU,Core i3,i5和i7(又名Nehalem)是否提供一种对每个时钟的指令数(IPC)进行计数的机制?如果是这样,如何使用它们?

All the Intel CPUs in the last decade (at least) include a set of performance monitors that count a variety of events. Do the latest Intel CPUs, Core i3, i5 and i7 (aka Nehalem) provide a mechanism to count Instructions Per Clock (IPC)? If so, how are they used?

如果可能的话,我可能会在Assembly中为此编写代码,但是Windows或Linux系统调用也可能很有用.

If this is possible, I'll probably be writing the code for this in Assembly, but Windows or Linux system calls may also come in useful.

推荐答案

是的,Intel(Linux和Windows)的Vtune可以测量IPC.

Yes, the Vtune from Intel (linux and windows) can measure IPC.

如果您想用精确的计数器自己测量代码的某些部分,则需要使用一些性能api,例如PAPI或perfctr(两者都适用于linux).

If you want to measure it by yourself with precise counters for some part of code, you need to use some performance api like PAPI or perfctr (both for linux).

它们使用硬件性能计数器,如英特尔手册 http://www.intel.com /products/processor/manuals/

They uses hardware performance counters, described in intel manuals http://www.intel.com/products/processor/manuals/

第3卷第30章及以后的版本附录A http://www.intel.com/Assets/PDF/manual/253669.pdf

Volume 3D, Chapter 30 & appendix A. http://www.intel.com/Assets/PDF/manual/253669.pdf

Vtune使用已退休的指令"和非睡眠时钟"的比率来计算CPI(已退休的每条指令的周期").对于Core2,使用的性能计数器为:"CPU_CLK_UNHALTED.CORE","INST_RETIRED.ANY"

Vtune uses the ratio of "Instructions Retired" and "Non-sleep clockticks " to compute CPI ("Cycles per instructions retired"). For Core2 the performance counters used are: "CPU_CLK_UNHALTED.CORE","INST_RETIRED.ANY"

所有Core * CPU的此计数器均相同: 第3B卷的附录A1,第384页:

This counters are the same for all Core* CPUs: Appendix A1 of Volume 3B, page384:

Table A-1. Architectural Performance Events

Event | Event Mask Mnemonic | Umask | Description
num.  
3CH   | UnHalted Core Cycles| 00H   | Unhalted core cycles
C0H   | Instruction Retired | 00H   | Instruction retired

这篇关于Core i3/5/7 CPU是否提供测量IPC的机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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