Messages in this thread | | | From | Arnaldo Carvalho de Melo <> | Date | Thu, 16 Apr 2020 11:57:04 -0300 | Subject | Re: [PATCH 10/16] perf tools: Add support for synthesized sample type |
| |
Em Thu, Apr 16, 2020 at 11:54:26AM -0300, Arnaldo Carvalho de Melo escreveu: > Em Wed, Apr 01, 2020 at 01:16:07PM +0300, Adrian Hunter escreveu: > > For reporting purposes, an evsel sample can have a callchain synthesized > > from AUX area data. Add support for keeping track of synthesized sample > > types. Note, the recorded sample_type cannot be changed because it is > > needed to continue to parse events. > > > > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> > > --- > > tools/perf/util/evsel.c | 2 +- > > tools/perf/util/evsel.h | 15 ++++++++++++++- > > 2 files changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > index eb880efbce16..60e6cd49dee3 100644 > > --- a/tools/perf/util/evsel.c > > +++ b/tools/perf/util/evsel.c > > @@ -2136,7 +2136,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event, > > } > > } > > > > - if (evsel__has_callchain(evsel)) { > > + if (type & PERF_SAMPLE_CALLCHAIN) { > > const u64 max_callchain_nr = UINT64_MAX / sizeof(u64); > > This ends up looking unrelated, I had to go and look at the source to > see that this is just a simplification, i.e. earlier in this function > (perf_evsel__parse_sample) we have: > > u64 type = evsel->core.attr.sample_type; > > So the above doesn't change anything, good, but slowed reviewing a bit, > please consider next time to have this in a separate patch, I'll do it > this time.
I've added this as the cset comment:
Using 'type' variable for checking for callchains is equivalent to using evsel__has_callchain(evsel) and is how the other PERF_SAMPLE_ bits are checked in this function, so use it to be consistent.
> Thanks, > > - Arnaldo > > > OVERFLOW_CHECK_u64(array); > > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > > index 53187c501ee8..e64ed4202cab 100644 > > --- a/tools/perf/util/evsel.h > > +++ b/tools/perf/util/evsel.h > > @@ -104,6 +104,14 @@ struct evsel { > > perf_evsel__sb_cb_t *cb; > > void *data; > > } side_band; > > + /* > > + * For reporting purposes, an evsel sample can have a callchain > > + * synthesized from AUX area data. Keep track of synthesized sample > > + * types here. Note, the recorded sample_type cannot be changed because > > + * it is needed to continue to parse events. > > + * See also evsel__has_callchain(). > > + */ > > + __u64 synth_sample_type; > > }; > > > > struct perf_missing_features { > > @@ -398,7 +406,12 @@ static inline bool perf_evsel__has_branch_hw_idx(const struct evsel *evsel) > > > > static inline bool evsel__has_callchain(const struct evsel *evsel) > > { > > - return (evsel->core.attr.sample_type & PERF_SAMPLE_CALLCHAIN) != 0; > > + /* > > + * For reporting purposes, an evsel sample can have a recorded callchain > > + * or a callchain synthesized from AUX area data. > > + */ > > + return evsel->core.attr.sample_type & PERF_SAMPLE_CALLCHAIN || > > + evsel->synth_sample_type & PERF_SAMPLE_CALLCHAIN; > > } > > > > struct perf_env *perf_evsel__env(struct evsel *evsel); > > -- > > 2.17.1 > > > > -- > > - Arnaldo
--
- Arnaldo
| |