Commit 4f19fc18 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

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: default avatarIan 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e44b47b9
...@@ -395,6 +395,8 @@ void print_symbol_events(const struct print_callbacks *print_cb, void *print_sta ...@@ -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) void print_events(const struct print_callbacks *print_cb, void *print_state)
{ {
char *tmp;
print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE, print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE,
event_symbols_hw, PERF_COUNT_HW_MAX); event_symbols_hw, PERF_COUNT_HW_MAX);
print_symbol_events(print_cb, print_state, PERF_TYPE_SOFTWARE, 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) ...@@ -418,17 +420,21 @@ void print_events(const struct print_callbacks *print_cb, void *print_state)
/*long_desc=*/NULL, /*long_desc=*/NULL,
/*encoding_desc=*/NULL); /*encoding_desc=*/NULL);
print_cb->print_event(print_state, if (asprintf(&tmp, "%s/t1=v1[,t2=v2,t3 ...]/modifier",
/*topic=*/NULL, perf_pmus__scan_core(/*pmu=*/NULL)->name) > 0) {
/*pmu_name=*/NULL, print_cb->print_event(print_state,
"cpu/t1=v1[,t2=v2,t3 ...]/modifier", /*topic=*/NULL,
/*event_alias=*/NULL, /*pmu_name=*/NULL,
/*scale_unit=*/NULL, tmp,
/*deprecated=*/false, /*event_alias=*/NULL,
event_type_descriptors[PERF_TYPE_RAW], /*scale_unit=*/NULL,
"(see 'man perf-list' on how to encode it)", /*deprecated=*/false,
/*long_desc=*/NULL, event_type_descriptors[PERF_TYPE_RAW],
/*encoding_desc=*/NULL); "(see 'man perf-list' on how to encode it)",
/*long_desc=*/NULL,
/*encoding_desc=*/NULL);
free(tmp);
}
print_cb->print_event(print_state, print_cb->print_event(print_state,
/*topic=*/NULL, /*topic=*/NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment