[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190304135341.GK19809@krava>
Date: Mon, 4 Mar 2019 14:53:41 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Song Liu <songliubraving@...com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
ast@...nel.org, daniel@...earbox.net, kernel-team@...com,
peterz@...radead.org, acme@...hat.com, jolsa@...nel.org,
namhyung@...nel.org
Subject: Re: [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@...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
Powered by blists - more mailing lists