mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
perf evsel: Add has_callchain() helper to make code more compact/clear
Its common to have the (evsel->attr.sample_type & PERF_SAMPLE_CALLCHAIN), so add an evsel__has_callchain(evsel) helper. This will actually get more uses as we check that instead of symbol_conf.use_callchain in places where that produces the same result but makes this decision to be more fine grained, per evsel. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-145340oytbthatpfeaq1do18@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
9d0199cd2a
commit
27de9b2bd9
8 changed files with 16 additions and 16 deletions
|
@ -517,7 +517,7 @@ static int perf_session__check_output_opt(struct perf_session *session)
|
|||
|
||||
evlist__for_each_entry(session->evlist, evsel) {
|
||||
not_pipe = true;
|
||||
if (evsel->attr.sample_type & PERF_SAMPLE_CALLCHAIN) {
|
||||
if (evsel__has_callchain(evsel)) {
|
||||
use_callchain = true;
|
||||
break;
|
||||
}
|
||||
|
@ -532,22 +532,18 @@ static int perf_session__check_output_opt(struct perf_session *session)
|
|||
*/
|
||||
if (symbol_conf.use_callchain &&
|
||||
!output[PERF_TYPE_TRACEPOINT].user_set) {
|
||||
struct perf_event_attr *attr;
|
||||
|
||||
j = PERF_TYPE_TRACEPOINT;
|
||||
|
||||
evlist__for_each_entry(session->evlist, evsel) {
|
||||
if (evsel->attr.type != j)
|
||||
continue;
|
||||
|
||||
attr = &evsel->attr;
|
||||
|
||||
if (attr->sample_type & PERF_SAMPLE_CALLCHAIN) {
|
||||
if (evsel__has_callchain(evsel)) {
|
||||
output[j].fields |= PERF_OUTPUT_IP;
|
||||
output[j].fields |= PERF_OUTPUT_SYM;
|
||||
output[j].fields |= PERF_OUTPUT_SYMOFFSET;
|
||||
output[j].fields |= PERF_OUTPUT_DSO;
|
||||
set_print_ip_opts(attr);
|
||||
set_print_ip_opts(&evsel->attr);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue