mirror of
https://github.com/torvalds/linux.git
synced 2024-12-07 11:31:41 +00:00
f8dfeae009
This patch enables showing bpf program name, address, and size in the header. Before the patch: perf report --header-only ... # bpf_prog_info of id 9 # bpf_prog_info of id 10 # bpf_prog_info of id 13 After the patch: # bpf_prog_info 9: bpf_prog_7be49e3934a125ba addr 0xffffffffa0024947 size 229 # bpf_prog_info 10: bpf_prog_2a142ef67aaad174 addr 0xffffffffa007c94d size 229 # bpf_prog_info 13: bpf_prog_47368425825d7384_task__task_newt addr 0xffffffffa0251137 size 369 Committer notes: Fix the fallback definition when HAVE_LIBBPF_SUPPORT is not defined, i.e. add the missing 'static inline' and add the __maybe_unused to the args. Also add stdio.h since we now use FILE * in bpf-event.h. Signed-off-by: Song Liu <songliubraving@fb.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stanislav Fomichev <sdf@google.com> Link: http://lkml.kernel.org/r/20190319165454.1298742-3-songliubraving@fb.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
75 lines
1.9 KiB
C
75 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_BPF_EVENT_H
|
|
#define __PERF_BPF_EVENT_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/rbtree.h>
|
|
#include <pthread.h>
|
|
#include <api/fd/array.h>
|
|
#include "event.h"
|
|
#include <stdio.h>
|
|
|
|
struct machine;
|
|
union perf_event;
|
|
struct perf_env;
|
|
struct perf_sample;
|
|
struct record_opts;
|
|
struct evlist;
|
|
struct target;
|
|
|
|
struct bpf_prog_info_node {
|
|
struct bpf_prog_info_linear *info_linear;
|
|
struct rb_node rb_node;
|
|
};
|
|
|
|
struct btf_node {
|
|
struct rb_node rb_node;
|
|
u32 id;
|
|
u32 data_size;
|
|
char data[];
|
|
};
|
|
|
|
#ifdef HAVE_LIBBPF_SUPPORT
|
|
int machine__process_bpf_event(struct machine *machine, union perf_event *event,
|
|
struct perf_sample *sample);
|
|
|
|
int perf_event__synthesize_bpf_events(struct perf_session *session,
|
|
perf_event__handler_t process,
|
|
struct machine *machine,
|
|
struct record_opts *opts);
|
|
int bpf_event__add_sb_event(struct perf_evlist **evlist,
|
|
struct perf_env *env);
|
|
void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
|
|
struct perf_env *env,
|
|
FILE *fp);
|
|
#else
|
|
static inline int machine__process_bpf_event(struct machine *machine __maybe_unused,
|
|
union perf_event *event __maybe_unused,
|
|
struct perf_sample *sample __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
|
|
perf_event__handler_t process __maybe_unused,
|
|
struct machine *machine __maybe_unused,
|
|
struct record_opts *opts __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int bpf_event__add_sb_event(struct perf_evlist **evlist __maybe_unused,
|
|
struct perf_env *env __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info __maybe_unused,
|
|
struct perf_env *env __maybe_unused,
|
|
FILE *fp __maybe_unused)
|
|
{
|
|
|
|
}
|
|
#endif // HAVE_LIBBPF_SUPPORT
|
|
#endif
|