Commit d58b3f7e authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf auxtrace: Automatically group aux-output events

aux-output events need to have an AUX area event as the group leader.
However, grouping events does not allow the AUX area event to be given
an address filter because the --filter option must come after the event,
which conflicts with the grouping syntax.

To allow filtering in that case, automatically create a group since that
is the requirement anyway.

Example: (requires Intel Tremont)

  perf record -c 500 -e 'intel_pt//u' --filter 'filter main @ /bin/ls' -e 'cycles/aux-output/pp' ls
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20210121140418.14705-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c5c97cad
...@@ -731,6 +731,8 @@ static int record__auxtrace_init(struct record *rec) ...@@ -731,6 +731,8 @@ static int record__auxtrace_init(struct record *rec)
if (err) if (err)
return err; return err;
auxtrace_regroup_aux_output(rec->evlist);
return auxtrace_parse_filters(rec->evlist); return auxtrace_parse_filters(rec->evlist);
} }
......
...@@ -788,6 +788,21 @@ int auxtrace_parse_sample_options(struct auxtrace_record *itr, ...@@ -788,6 +788,21 @@ int auxtrace_parse_sample_options(struct auxtrace_record *itr,
return auxtrace_validate_aux_sample_size(evlist, opts); return auxtrace_validate_aux_sample_size(evlist, opts);
} }
void auxtrace_regroup_aux_output(struct evlist *evlist)
{
struct evsel *evsel, *aux_evsel = NULL;
struct evsel_config_term *term;
evlist__for_each_entry(evlist, evsel) {
if (evsel__is_aux_event(evsel))
aux_evsel = evsel;
term = evsel__get_config_term(evsel, AUX_OUTPUT);
/* If possible, group with the AUX event */
if (term && aux_evsel)
evlist__regroup(evlist, aux_evsel, evsel);
}
}
struct auxtrace_record *__weak struct auxtrace_record *__weak
auxtrace_record__init(struct evlist *evlist __maybe_unused, int *err) auxtrace_record__init(struct evlist *evlist __maybe_unused, int *err)
{ {
......
...@@ -559,6 +559,7 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr, ...@@ -559,6 +559,7 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
int auxtrace_parse_sample_options(struct auxtrace_record *itr, int auxtrace_parse_sample_options(struct auxtrace_record *itr,
struct evlist *evlist, struct evlist *evlist,
struct record_opts *opts, const char *str); struct record_opts *opts, const char *str);
void auxtrace_regroup_aux_output(struct evlist *evlist);
int auxtrace_record__options(struct auxtrace_record *itr, int auxtrace_record__options(struct auxtrace_record *itr,
struct evlist *evlist, struct evlist *evlist,
struct record_opts *opts); struct record_opts *opts);
...@@ -740,6 +741,11 @@ int auxtrace_parse_sample_options(struct auxtrace_record *itr __maybe_unused, ...@@ -740,6 +741,11 @@ int auxtrace_parse_sample_options(struct auxtrace_record *itr __maybe_unused,
return -EINVAL; return -EINVAL;
} }
static inline
void auxtrace_regroup_aux_output(struct evlist *evlist __maybe_unused)
{
}
static inline static inline
int auxtrace__process_event(struct perf_session *session __maybe_unused, int auxtrace__process_event(struct perf_session *session __maybe_unused,
union perf_event *event __maybe_unused, union perf_event *event __maybe_unused,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment