lkml.org 
[lkml]   [2020]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 03/14] perf util: Return per-event callchain streams
    Date
    In previous patch, we have created a 'struct callchain_streams'
    array and each array entry contains per-event callchain streams.

    This patch returns the pointer of per-event callchain streams
    according to the evsel_idx.

    Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
    ---
    tools/perf/util/callchain.c | 12 ++++++++++++
    tools/perf/util/callchain.h | 4 ++++
    2 files changed, 16 insertions(+)

    diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
    index d9c68a8e7619..31ecc1abe7f9 100644
    --- a/tools/perf/util/callchain.c
    +++ b/tools/perf/util/callchain.c
    @@ -1724,3 +1724,15 @@ struct callchain_streams *callchain_evsel_streams_create(struct evlist *evlist,
    *nr_evsel_streams = nr_evsel;
    return callchain_streams;
    }
    +
    +struct callchain_streams *callchain_evsel_streams_get(struct callchain_streams *cs,
    + int nr_streams_max,
    + int evsel_idx)
    +{
    + for (int i = 0; i < nr_streams_max; i++) {
    + if (cs[i].evsel_idx == evsel_idx)
    + return &cs[i];
    + }
    +
    + return NULL;
    +}
    diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
    index 5852990cdf60..4e881361e154 100644
    --- a/tools/perf/util/callchain.h
    +++ b/tools/perf/util/callchain.h
    @@ -305,4 +305,8 @@ struct callchain_streams *callchain_evsel_streams_create(struct evlist *evlist,
    int nr_streams_max,
    int *nr_evsel_streams);

    +struct callchain_streams *callchain_evsel_streams_get(struct callchain_streams *cs,
    + int nr_streams_max,
    + int evsel_idx);
    +
    #endif /* __PERF_CALLCHAIN_H */
    --
    2.17.1
    \
     
     \ /
      Last update: 2020-03-10 08:04    [W:4.181 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site