Commit b1693747 authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim

perf list: Fix JSON segfault by setting the used skip_duplicate_pmus callback

Json output didn't set the skip_duplicate_pmus callback yielding a
segfault.

Fixes: cd4e1efb ("perf pmus: Skip duplicate PMUs and don't print list suffix by default")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20231129213428.2227448-2-irogers@google.com
[namhyung: updated subject line according to Arnaldo]
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 90fe70d4
...@@ -434,6 +434,11 @@ static void json_print_metric(void *ps __maybe_unused, const char *group, ...@@ -434,6 +434,11 @@ static void json_print_metric(void *ps __maybe_unused, const char *group,
strbuf_release(&buf); strbuf_release(&buf);
} }
static bool json_skip_duplicate_pmus(void *ps __maybe_unused)
{
return false;
}
static bool default_skip_duplicate_pmus(void *ps) static bool default_skip_duplicate_pmus(void *ps)
{ {
struct print_state *print_state = ps; struct print_state *print_state = ps;
...@@ -503,6 +508,7 @@ int cmd_list(int argc, const char **argv) ...@@ -503,6 +508,7 @@ int cmd_list(int argc, const char **argv)
.print_end = json_print_end, .print_end = json_print_end,
.print_event = json_print_event, .print_event = json_print_event,
.print_metric = json_print_metric, .print_metric = json_print_metric,
.skip_duplicate_pmus = json_skip_duplicate_pmus,
}; };
ps = &json_ps; ps = &json_ps;
} else { } else {
......
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