linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86/amd/core: Rename branch-brs event to not break the parser
@ 2023-09-12 13:33 Michael Petlan
  2023-09-12 17:53 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Petlan @ 2023-09-12 13:33 UTC (permalink / raw)
  To: linux-perf-users, acme, ravi.bangoria; +Cc: peterz, namhyung, sandipan.das

The problem is described in detail in 146edff3d7ed ("perf test: Parse
events workaround for dash/minus"). In short, although perf-list offers
"branch-brs" event to be used, when used with "-e" switch, the parser
does not accept it and needs to be enclosed to "cpu//", such as:

```
  $ perf stat -e branch-brs true
  event syntax error: 'branch-brs'
                             \___ parser error

  $ perf stat -e cpu/branch-brs/ true

   Performance counter stats for 'true':

              46,179      cpu/branch-brs/
```

This is confusing for the users.

Rename the event using underscore instead of dash to avoid the problem.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 arch/x86/events/amd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index abadd5f23425..f4c5d4100035 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -1286,21 +1286,21 @@ amd_branches_is_visible(struct kobject *kobj, struct attribute *attr, int i)
 }
 
 static struct attribute_group group_caps_amd_branches = {
 	.name  = "caps",
 	.attrs = amd_pmu_branches_attrs,
 	.is_visible = amd_branches_is_visible,
 };
 
 #ifdef CONFIG_PERF_EVENTS_AMD_BRS
 
-EVENT_ATTR_STR(branch-brs, amd_branch_brs,
+EVENT_ATTR_STR(branch_brs, amd_branch_brs,
 	       "event=" __stringify(AMD_FAM19H_BRS_EVENT)"\n");
 
 static struct attribute *amd_brs_events_attrs[] = {
 	EVENT_PTR(amd_branch_brs),
 	NULL,
 };
 
 static umode_t
 amd_brs_is_visible(struct kobject *kobj, struct attribute *attr, int i)
 {
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-14  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12 13:33 [PATCH] perf/x86/amd/core: Rename branch-brs event to not break the parser Michael Petlan
2023-09-12 17:53 ` Ian Rogers
2023-09-14  9:36   ` Michael Petlan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).