]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf callchain: Refactor callchain option parsing
authorIan Rogers <irogers@google.com>
Wed, 18 Mar 2026 23:45:59 +0000 (16:45 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 19 Mar 2026 21:42:46 +0000 (14:42 -0700)
commitc006753c3aae432efda28d5aaea4b8fec0343da8
treead8325b4d57ac5781d0ee8beb8d02195334cd9f5
parent443556be8adc59126624eccd41f4150ec0e5a11a
perf callchain: Refactor callchain option parsing

record_opts__parse_callchain is shared by builtin-record and
builtin-trace, it is declared in callchain.h. Move the declaration to
callchain.c for consistency with the header. In other cases make the
option callback a small static stub that then calls into callchain.c.

Make the no argument '-g' callchain option just a short-cut for
'--call-graph fp' so that there is consistency in how the arguments
are handled. This requires the const char* string to be strdup-ed in
__parse_callchain_report_opt. For consistency also make
parse_callchain_record use strdup and remove some unnecessary
casts. Also, be more explicit about the '-g' behavior if there is a
.perfconfig file setting.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/util/callchain.c
tools/perf/util/callchain.h