perf list: Avoid a hardcoded cpu PMU name
Use the first core PMU instead.
On a Raspberry Pi, before:
$ perf list
...
cpu/t1=v1[,t2=v2,t3 ...]/modifier [Raw hardware event descriptor]
[(see 'man perf-list' on how to encode it)]
...
After:
$ perf list
...
armv8_cortex_a72/t1=v1[,t2=v2,t3 ...]/modifier [Raw hardware event descriptor]
[(see 'man perf-list' on how to encode it)]
...
```
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Kang Minchul <tegongkang@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20230906234416.3472339-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
e44b47b931
commit
4f19fc1839
@@ -395,6 +395,8 @@ void print_symbol_events(const struct print_callbacks *print_cb, void *print_sta
|
||||
*/
|
||||
void print_events(const struct print_callbacks *print_cb, void *print_state)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE,
|
||||
event_symbols_hw, PERF_COUNT_HW_MAX);
|
||||
print_symbol_events(print_cb, print_state, PERF_TYPE_SOFTWARE,
|
||||
@@ -418,17 +420,21 @@ void print_events(const struct print_callbacks *print_cb, void *print_state)
|
||||
/*long_desc=*/NULL,
|
||||
/*encoding_desc=*/NULL);
|
||||
|
||||
print_cb->print_event(print_state,
|
||||
/*topic=*/NULL,
|
||||
/*pmu_name=*/NULL,
|
||||
"cpu/t1=v1[,t2=v2,t3 ...]/modifier",
|
||||
/*event_alias=*/NULL,
|
||||
/*scale_unit=*/NULL,
|
||||
/*deprecated=*/false,
|
||||
event_type_descriptors[PERF_TYPE_RAW],
|
||||
"(see 'man perf-list' on how to encode it)",
|
||||
/*long_desc=*/NULL,
|
||||
/*encoding_desc=*/NULL);
|
||||
if (asprintf(&tmp, "%s/t1=v1[,t2=v2,t3 ...]/modifier",
|
||||
perf_pmus__scan_core(/*pmu=*/NULL)->name) > 0) {
|
||||
print_cb->print_event(print_state,
|
||||
/*topic=*/NULL,
|
||||
/*pmu_name=*/NULL,
|
||||
tmp,
|
||||
/*event_alias=*/NULL,
|
||||
/*scale_unit=*/NULL,
|
||||
/*deprecated=*/false,
|
||||
event_type_descriptors[PERF_TYPE_RAW],
|
||||
"(see 'man perf-list' on how to encode it)",
|
||||
/*long_desc=*/NULL,
|
||||
/*encoding_desc=*/NULL);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
print_cb->print_event(print_state,
|
||||
/*topic=*/NULL,
|
||||
|
||||
Reference in New Issue
Block a user