Re: [PATCH] perf record: Add support to collect callchains from kernel or user space only.

From: çèé
Date: Mon Jun 10 2019 - 03:50:16 EST


Hi Arnaldo, Jirka

> perf_event_attr.exclude_callchain_kernel to 0

I don't think we should set 0 for the desired callchins, because we
will set exclude_callchain_user to 1 if perf_evsel is function event.

void perf_evsel__config(struct perf_evsel *evsel, struct record_opts
*opts, struct callchain_param *callchain)
{
...
if (perf_evsel__is_function_event(evsel))
evsel->attr.exclude_callchain_user = 1;

if (callchain && callchain->enabled && !evsel->no_aux_samples)
perf_evsel__config_callchain(evsel, opts, callchain);
}

If we set exclude_callchain_user to 0 , it will catch user callchain
for function_event. So, it will be best to just set the
exclude_callchain_xxx to 1.

> So that the user don't try using:

> perf record --user-callchains --kernel-callchains

> expecting to get both user and kernel callchains and instead gets
> nothing.

I will add a note in the doc.


Arnaldo Carvalho de Melo <arnaldo.melo@xxxxxxxxx> ä2019å6æ7æåä äå2:15åéï
>
> Em Thu, Jun 06, 2019 at 04:46:14PM +0200, Jiri Olsa escreveu:
> > On Thu, Jun 06, 2019 at 11:26:44AM -0300, Arnaldo Carvalho de Melo wrote:
> > > So that the user don't try using:
>
> > > pref record --user-callchains --kernel-callchains
>
> > > expecting to get both user and kernel callchains and instead gets
> > > nothing.
>
> > good catch.. we should add the logic to keep both (default)
> > in this case.. so do nothing ;-)
>
> Yeah, not using both or using both should amount to the same behaviour.
>
> Can be done with a patch on top of what I have in my tree now.
>
> - Arnaldo