Skip to contentSkip to conversation

IPC sampling

DISCUSSION Jose 2 participants 3 messages Jun 3, 2016

lore
Share & tools
lore

Jose

author
#0 lore raw

Hi all,

I need lot of IPC values for a given program execution. I can use "perf stat":

perf stat -I 10 -e cycles,instructions <program>

and I can calculate IPC from cycles and instructions.

           time             counts unit events
     0.100137436        163.924.770      cycles
     0.100137436         77.957.069      instructions
     0.200370555        250.248.467      cycles
     0.200370555        124.686.255      instructions
     0.300493502        260.316.390      cycles
     0.300493502        467.691.086      instructions
     0.400623447        260.334.219      cycles
     0.400623447        467.711.817      instructions
     0.500922368        389.205.220      cycles
     0.500922368        689.460.813      instructions
     0.601220080      3.229.694.697      cycles
     0.601220080      6.415.412.796      instructions
      .....

The problem is that the frequency is very limited for my purposes (interval must be >= 100ms)

It seems that "perf record" can help me:

perf record -F 10000 -e cycles,instructions <ejecutable> (-F allows
greater frequencies)

My problem now is that I don't know how to obtain "cycles" and "instructions" from perf.data file. I have tried several options using "perf report" and "perf script" but I don't achieve it.

Thanks

Jose

#1 lore raw
Quoted 4 lines · Jose

My problem now is that I don't know how to obtain "cycles" and "instructions" from perf.data file. I have tried several options using "perf report" and "perf script" but I don't achieve it.

perf record -e '{instructions,cycles}:S' ...
perf script

This means sample on cycles, but always read instructions too during the sample. Then match up the values with the same time stamp from perf script and calculate ipc, or use a perf script interpreted script to do so.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only
author
#2 lore raw
Quoted 11 lines · Andi Kleen <andi <at> firstfloor.org> writes:
Quoted 4 lines · Jose <jose.sgarcia.aldonza <at> gmail.com> writes:

My problem now is that I don't know how to obtain "cycles" and "instructions" from perf.data file. I have tried several options using "perf report" and "perf script" but I don't achieve it.

perf record -e '{instructions,cycles}:S' ...
perf script

This means sample on cycles, but always read instructions too during the

sample.

Quoted 5 lines

Then match up the values with the same time stamp from perf script and calculate ipc, or use a perf script interpreted script to do so.

-Andi

Good!

Two additional questions:

- If using '{cycles,instructions}:S', is sampling on instructions? Sometimes I'm interested to sample on number of instructions.

I don't find information about option :S from man pages. Is there a manual with much more information?

- Could you provide more information (links, an example, ...) on "perf script interpreted script"

Thanks
Jose