Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
468071ac 3d3056a1

+5 -3
+5 -3
tools/perf/builtin-top.c
··· 1695 1695 goto out_delete_evlist; 1696 1696 1697 1697 if (!top.evlist->core.nr_entries) { 1698 - bool can_profile_kernel = perf_event_paranoid_check(1); 1699 - int err = parse_event(top.evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu"); 1698 + struct evlist *def_evlist = evlist__new_default(); 1700 1699 1701 - if (err) 1700 + if (!def_evlist) 1702 1701 goto out_delete_evlist; 1702 + 1703 + evlist__splice_list_tail(top.evlist, &def_evlist->core.entries); 1704 + evlist__delete(def_evlist); 1703 1705 } 1704 1706 1705 1707 status = evswitch__init(&top.evswitch, top.evlist, stderr);