How to measure IPC with PEBS?

PEBS is the sampling mechanism that Intel processors provide for sampling performance monitors.

Can PEBS be used to measure the IPC process? How does PEBS determine when to choose?

+3
source share
1 answer

See my answer on Core i3 / 5/7 processors provide a mechanism for measuring IPC? to get monitor names for IPC counting.

Yes, you can use pfmon / pebs to get an approximate IPC value:

pfmon --smpl-module=pebs -ecpu_clk_unhalted --inv=1 --counter-mask=1 --long-smpl-periods=2660000 -uk -- foo 

pfmon --smpl-module=pebs -einstructions_retired --inv=1 --counter-mask=1 --long-smpl-periods=2660000 -uk -- foo

There are two pfmon runs using nuts. They will give you the ratio of the instructions_retired and cpu_clk_unhalted counts for the entire program and for each function.

PEBS , 2660000- ( pfmon ) . pfmon , CPU msr. , MSR context_switch. , pfmon CPU, , > 2660000. , pfmon EIP ( ) reset .

PS IPC perf linux: https://perf.wiki.kernel.org/index.php/Tutorial

:

perf stat -B -ecycles:u,instructions:u  dd if=/dev/zero of=/dev/null count=2000000

2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 1.91559 s, 535 MB/s

 Performance counter stats for 'dd if=/dev/zero of=/dev/null count=2000000':

    1,993,541,603 cycles
      764,086,803 instructions             #      0.383 IPC

       1.916930613  seconds time elapsed

(-a ):

perf stat -B -ecycles:u,instructions:u -a sleep 5

 Performance counter stats for 'sleep 5':

      766,271,289 cycles
      596,796,091 instructions             #      0.779 IPC

       5.001191353  seconds time elapsed
+2

Source: https://habr.com/ru/post/1788141/


All Articles