From: Ian Rogers Date: Sun, 5 Oct 2025 18:24:21 +0000 (-0700) Subject: perf top: Use evlist__new_default when no events specified X-Git-Tag: v6.19-rc1~61^2~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=468071acfc05135b9e24ed0beb535ac5c6cff945;p=thirdparty%2Fkernel%2Flinux.git perf top: Use evlist__new_default when no events specified Rather than distributing the code doing similar things to evlist__new_default, use the one implementation so that paranoia and wildcard scanning can be optimized. Signed-off-by: Ian Rogers Tested-by: James Clark Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a11f629c7d76a..710604c4f6f6c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1695,11 +1695,13 @@ int cmd_top(int argc, const char **argv) goto out_delete_evlist; if (!top.evlist->core.nr_entries) { - bool can_profile_kernel = perf_event_paranoid_check(1); - int err = parse_event(top.evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu"); + struct evlist *def_evlist = evlist__new_default(); - if (err) + if (!def_evlist) goto out_delete_evlist; + + evlist__splice_list_tail(top.evlist, &def_evlist->core.entries); + evlist__delete(def_evlist); } status = evswitch__init(&top.evswitch, top.evlist, stderr);