Skip to content

Commit 89c0a55

Browse files
captain5050acmel
authored andcommitted
perf pmu: To info add event_type_desc
All PMU events are assumed to be "Kernel PMU event", however, this isn't true for fake PMUs and won't be true with the addition of more software PMUs. Make the PMU's type description name configurable - largely for printing callbacks. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20240907050830.6752-5-irogers@google.com Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Yang Jihong <yangjihong@bytedance.com> Cc: Dominique Martinet <asmadeus@codewreck.org> Cc: Clément Le Goffic <clement.legoffic@foss.st.com> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: Howard Chu <howardchu95@gmail.com> Cc: Ze Gao <zegao2021@gmail.com> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: Changbin Du <changbin.du@huawei.com> Cc: Junhao He <hejunhao3@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Weilin Wang <weilin.wang@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: James Clark <james.clark@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Benjamin Gray <bgray@linux.ibm.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Xu Yang <xu.yang_2@nxp.com> Cc: John Garry <john.g.garry@oracle.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Veronika Molnarova <vmolnaro@redhat.com> Cc: Dr. David Alan Gilbert <linux@treblig.org> Cc: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f08cc25 commit 89c0a55

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

tools/perf/util/pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,7 @@ int perf_pmu__for_each_event(struct perf_pmu *pmu, bool skip_duplicate_pmus,
18561856
struct perf_pmu_alias *event;
18571857
struct pmu_event_info info = {
18581858
.pmu = pmu,
1859+
.event_type_desc = "Kernel PMU event",
18591860
};
18601861
int ret = 0;
18611862
struct strbuf sb;

tools/perf/util/pmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ struct pmu_event_info {
194194
const char *encoding_desc;
195195
const char *topic;
196196
const char *pmu_name;
197+
const char *event_type_desc;
197198
const char *str;
198199
bool deprecated;
199200
};

tools/perf/util/pmus.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ struct sevent {
371371
const char *encoding_desc;
372372
const char *topic;
373373
const char *pmu_name;
374+
const char *event_type_desc;
374375
bool deprecated;
375376
};
376377

@@ -444,6 +445,7 @@ static int perf_pmus__print_pmu_events__callback(void *vstate,
444445
COPY_STR(encoding_desc);
445446
COPY_STR(topic);
446447
COPY_STR(pmu_name);
448+
COPY_STR(event_type_desc);
447449
#undef COPY_STR
448450
s->deprecated = info->deprecated;
449451
state->index++;
@@ -498,7 +500,7 @@ void perf_pmus__print_pmu_events(const struct print_callbacks *print_cb, void *p
498500
aliases[j].alias,
499501
aliases[j].scale_unit,
500502
aliases[j].deprecated,
501-
"Kernel PMU event",
503+
aliases[j].event_type_desc,
502504
aliases[j].desc,
503505
aliases[j].long_desc,
504506
aliases[j].encoding_desc);
@@ -511,6 +513,7 @@ void perf_pmus__print_pmu_events(const struct print_callbacks *print_cb, void *p
511513
zfree(&aliases[j].encoding_desc);
512514
zfree(&aliases[j].topic);
513515
zfree(&aliases[j].pmu_name);
516+
zfree(&aliases[j].event_type_desc);
514517
}
515518
if (printed && pager_in_use())
516519
printf("\n");

0 commit comments

Comments
 (0)