Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Core i3/5/7 CPUs provide a mechanism to measure 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?

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.

like image 407
Nathan Fellman Avatar asked Oct 25 '10 21:10

Nathan Fellman


People also ask

How is IPC measured?

Calculation of IPC The number of instructions per second and floating point operations per second for a processor can be derived by multiplying the number of instructions per cycle with the clock rate (cycles per second given in Hertz) of the processor in question.

What does I means in laptop?

The Core “i” names are primarily “high level” categorizations that help differentiate processors within a given generation. A specific Core “i” name doesn't mean the processor has a certain number of cores, nor does it guarantee features, like Hyper-Threading, which allows the CPU to process instructions faster.


1 Answers

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

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).

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

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

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"

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
like image 109
osgx Avatar answered Sep 19 '22 11:09

osgx