lkml.org 
[lkml]   [2019]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v5 perf,bpf 08/15] perf, bpf: save btf in a rbtree in perf_env
    On Wed, Feb 27, 2019 at 09:06:36PM -0800, Song Liu wrote:
    > btf contains information necessary to annotate bpf programs. This patch
    > saves btf for bpf programs loaded in the system.
    >
    > Signed-off-by: Song Liu <songliubraving@fb.com>
    > ---
    > tools/perf/util/bpf-event.c | 24 ++++++++++++++
    > tools/perf/util/bpf-event.h | 7 ++++
    > tools/perf/util/env.c | 65 +++++++++++++++++++++++++++++++++++++
    > tools/perf/util/env.h | 4 +++
    > 4 files changed, 100 insertions(+)
    >
    > diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
    > index ce81b2c43a51..370b830f2433 100644
    > --- a/tools/perf/util/bpf-event.c
    > +++ b/tools/perf/util/bpf-event.c
    > @@ -34,6 +34,29 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused,
    > return 0;
    > }
    >
    > +static int perf_env__fetch_btf(struct perf_env *env,
    > + u32 btf_id,
    > + struct btf *btf)
    > +{
    > + struct btf_node *node;
    > + u32 data_size;
    > + const void *data;
    > +
    > + data = btf__get_raw_data(btf, &data_size);
    > +
    > + node = malloc(data_size + sizeof(struct btf_node));
    > +

    extra new line

    > + if (!node)
    > + return -1;
    > +
    > + node->id = btf_id;
    > + node->data_size = data_size;
    > + memcpy(node->data, data, data_size);
    > +
    > + perf_env__insert_btf(env, node);
    > + return 0;
    > +}

    SNIP

    \
     
     \ /
      Last update: 2019-03-04 14:54    [W:2.775 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site