Skip to content

Commit 4417599

Browse files
Stephane EranianPeter Zijlstra
authored andcommitted
perf/x86/amd: Add branch-brs helper event for Fam19h BRS
Add a pseudo event called branch-brs to help use the FAM Fam19h Branch Sampling feature (BRS). BRS samples taken branches, so it is best used when sampling on a retired taken branch event (0xc4) which is what BRS captures. Instead of trying to remember the event code or actual event name, users can simply do: $ perf record -b -e cpu/branch-brs/ -c 1000037 ..... Signed-off-by: Stephane Eranian <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ada5434 commit 4417599

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/x86/events/amd/core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,8 +1145,23 @@ static struct attribute_group group_caps_amd_brs = {
11451145
.is_visible = amd_brs_is_visible,
11461146
};
11471147

1148+
EVENT_ATTR_STR(branch-brs, amd_branch_brs,
1149+
"event=" __stringify(AMD_FAM19H_BRS_EVENT)"\n");
1150+
1151+
static struct attribute *amd_brs_events_attrs[] = {
1152+
EVENT_PTR(amd_branch_brs),
1153+
NULL,
1154+
};
1155+
1156+
static struct attribute_group group_events_amd_brs = {
1157+
.name = "events",
1158+
.attrs = amd_brs_events_attrs,
1159+
.is_visible = amd_brs_is_visible,
1160+
};
1161+
11481162
static const struct attribute_group *amd_attr_update[] = {
11491163
&group_caps_amd_brs,
1164+
&group_events_amd_brs,
11501165
NULL,
11511166
};
11521167

0 commit comments

Comments
 (0)