Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217581
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 18/31] perf test: Add 'perf test BPF' |
| Date | 2015-09-02 14:50 +0200 |
| Message-ID | <q4fEe-5kp-23@gated-at.bofh.it> (permalink) |
| References | <q2FWa-7Rj-5@gated-at.bofh.it> <q2FWc-7Rj-67@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Aug 29, 2015 at 04:21:52AM +0000, Wang Nan wrote:
> This patch adds BPF testcase for testing BPF event filtering.
>
> By utilizing the result of 'perf test LLVM', this patch compiles the
> eBPF sample program then test it ability. The BPF script in 'perf test
> LLVM' collects half of execution of epoll_pwait(). This patch runs 111
> times of it, so the resule should contains 56 samples.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Alexei Starovoitov <ast@plumgrid.com>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kaixu Xia <xiakaixu@huawei.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> Link: http://lkml.kernel.org/n/1440151770-129878-16-git-send-email-wangnan0@huawei.com
> ---
[SNIP]
> +static int prepare_bpf(void *obj_buf, size_t obj_buf_sz)
> +{
> + int err;
> + char errbuf[BUFSIZ];
> +
> + err = bpf__prepare_load_buffer(obj_buf, obj_buf_sz, NULL);
> + if (err) {
> + bpf__strerror_prepare_load("[buffer]", false, err, errbuf,
> + sizeof(errbuf));
> + fprintf(stderr, " (%s)", errbuf);
> + return TEST_FAIL;
> + }
> +
> + err = bpf__probe();
> + if (err) {
> + bpf__strerror_load(err, errbuf, sizeof(errbuf));
> + fprintf(stderr, " (%s)", errbuf);
> + if (getuid() != 0)
geteuid() ?
Thanks,
Namhyung
> + fprintf(stderr, " (try run as root)");
> + return TEST_FAIL;
> + }
> +
> + err = bpf__load();
> + if (err) {
> + bpf__strerror_load(err, errbuf, sizeof(errbuf));
> + fprintf(stderr, " (%s)", errbuf);
> + return TEST_FAIL;
> + }
> +
> + return 0;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/31] perf tools: filtering events using eBPF programs Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
[PATCH 18/31] perf test: Add 'perf test BPF' Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
Re: [PATCH 18/31] perf test: Add 'perf test BPF' Namhyung Kim <namhyung@kernel.org> - 2015-09-02 14:50 +0200
Re: [PATCH 18/31] perf test: Add 'perf test BPF' Wang Nan <pi3orama@163.com> - 2015-09-05 14:30 +0200
[PATCH 12/31] perf tools: Allow filter option to be applied to bof object Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:40 +0200
[PATCH 30/31] perf tools: Fix cross compiling error Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:40 +0200
[PATCH 05/31] perf ebpf: Add the libbpf glue Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:40 +0200
[PATCH 13/31] perf tools: Attach eBPF program to perf event Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:50 +0200
csiph-web