lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 10/16] perf tools: Add support for synthesized sample type
    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.

    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

    \
     
     \ /
      Last update: 2020-04-16 16:55    [W:4.134 / U:1.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site