perf: Add missing user space support for config1/config2
PATCH 1/1 perf: Add missing user space support for config1/config2
From: Andi Kleen <[email protected]>
The offcore_msr perf kernel code was merged into 2.6.39-rc*, but the user space bits were not. This made it impossible to set the extra mask and actually do the OFFCORE profiling
This patch fixes this. It adds a new syntax ':' to raw events to specify additional event masks. I also added support for setting config2, even though that is not needed currently.
[Note: the original version back in time used , -- but that actually conflicted with event lists, so now it's :]
--- tools/perf/Documentation/perf-list.txt | 11 +++++++++++ tools/perf/util/parse-events.c | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 1 deletions(-)
tools/perf/Documentation/perf-list.txt +11 -0
@@ -61,6 +61,17 @@ raw encoding of 0x1A8 can be used: You should refer to the processor specific documentation for getting these details. Some of them are referenced in the SEE ALSO section below. +Some raw events -- like the Intel OFFCORE events -- support additional +parameters. These can be appended after a ':'. + +For example on a multi socket Intel Nehalem: + + perf stat -e r1b7:20ff -a sleep 1 + +Profile the OFFCORE_RESPONSE.ANY_REQUEST with event mask REMOTE_DRAM_0 +that measures any access to DRAM on another socket. Upto two parameters can +be specified with additional ':' + OPTIONS -------
tools/perf/util/parse-events.c +15 -1
@@ -688,9 +688,23 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr)return EVT_FAILED ; n =hex2u64 (str +1 , &config);if (n >0 ) { - *strp = str + n +1 ; + str += n +1 ; attr->type =PERF_TYPE_RAW ; attr->config = config; +if (*str ==':' ) { + str++; + n =hex2u64 (str, (u64 *)&attr->config1); +if (n ==0 ) +return EVT_FAILED ; + str += n; +if (*str ==':' ) { + str++; + n =hex2u64 (str +1 , (u64 *)&attr->config2); +if (n ==0 ) +return EVT_FAILED ; + } + } + *strp = str;return EVT_HANDLED ; }return EVT_FAILED ;
Signature · 1 line
1.7.4.2
PING Re: [PATCH] perf: Add missing user space support for config1/config2
Quoted 5 lines · Andi Kleen
From: Andi Kleen <[email protected]>
The
offcore_msrperf kernel code was merged into 2.6.39-rc*, but the user space bits were not. This made it impossible to set the extra mask and actually do the OFFCORE profiling
PING. Can someone review/merge this patch please? Without it the offcore profiling support in .39 is unusable.
Thanks,
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only