overseas
overseas

Reputation: 1731

Setting cmask / inv in perf_event

I'm trying to manually use performance measurements with linux/perf_event.h. As a reference: I do it similarly as described in ozlabs.org/~anton/junkcode/perf_events_example1.c

I would like to read some specific performance counter event, for example I would like to have the event UOPS_ISSUED.ANY with Cmask=1 and Inv = 1 (count stalled cycles).

So then I have attr.type=PERF_TYPE_RAW and attr.config=0x010E. But where can I then specify Cmask and Inv?

Upvotes: 3

Views: 501

Answers (1)

papirrin
papirrin

Reputation: 2053

Cmask and Inv are architecture specific attributes. I assume you are using x86. Then the attributes are in the structure x86_pmu_config in arch/x86/kernel/cpu/perf_event.h

You can use the macro X86_CONFIG, defined in the same file, to create the adequate value for attr.config . For example:

X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1);

as described in this link.

Upvotes: 3

Related Questions