Skip to contentSkip to conversation

perf event "instructions"

DISCUSSION Hank 2 participants 3 messages May 25, 2012 1 message not in the archive

lore
Share & tools
lore

Hank

author
#0 lore raw

Hi,

I've collected number of instructions using predefined event named "instructions" and also collected using the raw event (register and unit mask) for instructions retired. Although they are similar, outputs are not the exactly the same.

Can anyone explain me what is the built-in event "instructions" measuring? If it is the number of retired instructions, then what might be the reason for getting different output when I use the raw event number?

Thanks a lot,

#1 lore raw
Quoted 8 lines · Hank

I've collected number of instructions using predefined event named "instructions" and also collected using the raw event (register and unit mask) for instructions retired. Although they are similar, outputs are not the exactly the same.

Can anyone explain me what is the built-in event "instructions" measuring? If it is the number of retired instructions, then what might be the reason for getting different output when I use the raw event number?

what processor are you running on? What raw event are you using? what version of Linux?

Are you specifying things like user-only?

There's enough variation in retired instruction counts that entire papers have been written on it.

http://web.eecs.utk.edu/~vweaver1/projects/deterministic/fhpm2010_weaver.pdf

Vince

#3 lore raw
In reply to a message not in the archive
Quoted 9 lines · Can Hankendi

Processor is AMD 10H family processor and I'm using this raw event (from AMD Bios and Kernel Developers Guide):

EventSelect 0C0h Retired Instructions

The number of instructions retired (execution completed and architectural state updated). This count includes exceptions and interrupts - each exception or interrupt is counted as one instruction.

Quoted 7 lines

Linux is Ubuntu 12.04, with 3.2.0 kernel.

I'm collecting system-wide data with perf stat command. I'm well aware about the variations in retired instructions. However, I'm collecting the "instructions" and raw event 0x0C0h for the same session and ending up with different results. So I assume it is not about variations, it's more about how the built-in event is configured in perf tool.

so you're saying you are doing something like:
perf stat -e instructions:u,rc0:u my_job

and getting different values for the results?
You keep giving not enough info to diagnose this problem. What's your *exact* perf command?

The only way to find out what the kernel is using is to check the source. (I won't comment on how great a feature I think that is).
In arch/x86/kernel/cpu/perf_event_amd.c you can find
[PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,

Vince