Skip to content

Commit 2c5f652

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf mem/c2c: Avoid printing empty lines for unsupported events
The 'perf mem' and 'perf c2c' tools can be used with 3 different events: load, store and combined load-store. Some architectures might support only partial set of events in which case, perf prints an empty line for unsupported events. Avoid that. Ex, AMD Zen cpus supports only combined load-store event and does not support individual load and store event. Before patch: $ perf mem record -e list mem-ldst : available $ After patch: $ perf mem record -e list mem-ldst : available $ Signed-off-by: Ravi Bangoria <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ali Saidi <[email protected]> Cc: Ananth Narayan <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Joe Mario <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Santosh Shukla <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent f7b58cb commit 2c5f652

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/perf/util/mem-events.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,12 @@ void perf_mem_events__list(void)
156156
for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
157157
struct perf_mem_event *e = perf_mem_events__ptr(j);
158158

159-
fprintf(stderr, "%-13s%-*s%s\n",
160-
e->tag ?: "",
161-
verbose > 0 ? 25 : 0,
162-
verbose > 0 ? perf_mem_events__name(j, NULL) : "",
163-
e->supported ? ": available" : "");
159+
fprintf(stderr, "%-*s%-*s%s",
160+
e->tag ? 13 : 0,
161+
e->tag ? : "",
162+
e->tag && verbose > 0 ? 25 : 0,
163+
e->tag && verbose > 0 ? perf_mem_events__name(j, NULL) : "",
164+
e->supported ? ": available\n" : "");
164165
}
165166
}
166167

0 commit comments

Comments
 (0)