]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf record: Use evlist__new_default when no events specified
authorIan Rogers <irogers@google.com>
Sun, 5 Oct 2025 18:24:20 +0000 (11:24 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 15 Oct 2025 14:59:11 +0000 (23:59 +0900)
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>
tools/perf/builtin-record.c

index 26d8da560446f12fd32405e8e5d00f57aa5b1bd0..cb52aea9607d4612545590e0af918dacf727c616 100644 (file)
@@ -4341,9 +4341,13 @@ int cmd_record(int argc, const char **argv)
                record.opts.tail_synthesize = true;
 
        if (rec->evlist->core.nr_entries == 0) {
-               err = parse_event(rec->evlist, "cycles:P");
-               if (err)
+               struct evlist *def_evlist = evlist__new_default();
+
+               if (!def_evlist)
                        goto out;
+
+               evlist__splice_list_tail(rec->evlist, &def_evlist->core.entries);
+               evlist__delete(def_evlist);
        }
 
        if (rec->opts.target.tid && !rec->opts.no_inherit_set)