From: "Wangnan (F)" <wangnan0@huawei.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Alexei Starovoitov <ast@fb.com>, Zefan Li <lizefan@huawei.com>,
He Kuang <hekuang@huawei.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
pi3orama <pi3orama@163.com>, Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH 00/34] perf clang: Builtin clang and perfhook support
Date: Tue, 15 Nov 2016 13:03:38 +0800 [thread overview]
Message-ID: <582A972A.1010304@huawei.com> (raw)
In-Reply-To: <CAADnVQLG9OcJh63rUN0JcgcfB1cCj6riFJBPwZoWe0V-u9bh6g@mail.gmail.com>
On 2016/11/15 12:57, Alexei Starovoitov wrote:
> On Mon, Nov 14, 2016 at 8:05 PM, Wang Nan <wangnan0@huawei.com> wrote:
>> This is version 2 of perf builtin clang patch series. Compare to v1,
>> add an exciting feature: jit compiling perf hook functions. This
>> features allows script writer report result through BPF map in a
>> customized way.
> looks great.
>
>> SEC("perfhook:record_start")
>> void record_start(void *ctx)
>> {
>> int perf_pid = getpid(), key = G_perf_pid;
>> printf("Start count, perfpid=%d\n", perf_pid);
>> jit_helper__map_update_elem(ctx, &GVALS, &key, &perf_pid, 0);
> the name, I think, is too verbose.
> Why not to keep them as bpf_map_update_elem
> even for user space programs?
I can make it shorter by give it a better name or use a wrapper like
BPF_MAP(update_elem)
but the only thing I can't do is to make perfhook and in-kernel script
use a uniform name for these bpf_map functions, because
bpf_map_update_elem is already defined:
"static long (*bpf_map_update_elem)(void *, void *, void *, unsigned
long) = (void *)2;\n"
>> SEC("perfhook:record_end")
>> void record_end(void *ctx)
>> {
>> u64 key = -1, value;
>> while (!jit_helper__map_get_next_key(ctx, &syscall_counter, &key, &key)) {
>> jit_helper__map_lookup_elem(ctx, &syscall_counter, &key, &value);
>> printf("syscall %ld\tcount: %ld\n", (long)key, (long)value);
> this loop will be less verbose as well.
next prev parent reply other threads:[~2016-11-15 5:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 4:57 [PATCH 00/34] perf clang: Builtin clang and perfhook support Alexei Starovoitov
2016-11-15 5:03 ` Wangnan (F) [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-11-15 5:21 Alexei Starovoitov
2016-11-15 5:37 ` Wangnan (F)
2016-11-15 4:05 Wang Nan
2016-11-15 4:32 ` Wangnan (F)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=582A972A.1010304@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@fb.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).