Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258902
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event |
| Date | 2015-10-29 17:30 +0100 |
| Message-ID | <qoYfo-2xI-5@gated-at.bofh.it> (permalink) |
| References | <qjtFf-7cv-3@gated-at.bofh.it> <qjtFg-7cv-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Wed, Oct 14, 2015 at 12:41:20PM +0000, Wang Nan escreveu: > This patch provides infrastructure for passing source files to --event > directly using: > > # perf record --event bpf-file.c command > > This patch does following works: > > 1) Allow passing '.c' file to '--event'. parse_events_load_bpf() is > expanded to allow caller tell it whether the passed file is source > file or object. > > 2) llvm__compile_bpf() is called to compile the '.c' file, the result > is saved into memory. Use bpf_object__open_buffer() to load the > in-memory object. > > Introduces a bpf-script-example.c so we can manually test it: > > # perf record --clang-opt "-DLINUX_VERSION_CODE=0x40200" --event ./bpf-script-example.c sleep 1 > > Note that '--clang-opt' must put before '--event'. > > Futher patches will merge it into a testcase so can be tested automatically. Not working here... humm, perhaps the version again... [root@felicio linux]# perf record --clang-opt "-DLINUX_VERSION_CODE=0x40200" --event tools/perf/tests/bpf-script-example.c sleep 1 libbpf: load bpf program failed: Invalid argument libbpf: -- BEGIN DUMP LOG --- libbpf: libbpf: -- END LOG -- libbpf: failed to load program 'func=sys_epoll_pwait' Yeah, as soon as I used: # perf record --clang-opt "-DLINUX_VERSION_CODE=0x40300" --event tools/perf/tests/bpf-script-example.c sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.013 MB perf.data ] [root@felicio linux]# I think we should provide some stuff like this LINUX_VERSION_CODE automagically, right? And also check the version in a .o file, to make sure we don't ask the kernel to load something with a mismatch in that version. And you could've provided something that would actually do something meaningful, i.e. a filter that would capture some samples for a given event while discarding something not that important... I.e. show the value provided at the time we build that patch. I'll try to come up with something like that after I have lunch, but so far so good, I think I'll be able to send this to Ingo today, and that is a major milestone! Great work, thanks a lot for doing this! - Arnaldo P.S.: If we pass a .c ending string to 'trace', 'record', 'top', etc, I think we could do away with that pesky --event/-e, i.e.: trace cool_stuff.c Would do the right thing, i.e. be equivalent to: trace --event cool_stuff.c -- 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 — Next in thread | Find similar | Unroll thread
Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-29 17:30 +0100
Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-29 17:40 +0100
Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-30 00:00 +0100
csiph-web