Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1369423

Re: [PATCH] perf tools: Add sample types for bpf-output event

From Arnaldo Carvalho de Melo <acme@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] perf tools: Add sample types for bpf-output event
Date 2016-04-01 17:30 +0200
Message-ID <rj9bk-6jH-27@gated-at.bofh.it> (permalink)
References <rj7jb-4UU-1@gated-at.bofh.it> <rj91E-6gd-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Fri, Apr 01, 2016 at 12:16:10PM -0300, Arnaldo Carvalho de Melo escreveu:
> Perhaps, to make all more familiar we could even define equivalents to
> stdio.h functions like puts, printf, fputs, etc, that would send to this
> bpf-output based "stdout" "channel", then the above would end up being:
> 
>  func(void *ctx, int type)
>  {
>         char err_str[] = "BAD %d\n";
>         int err;
> 
>         err = puts("Raise a BPF event!");
>         if (err)
>                 trace_printk(err_str, sizeof(err_str), err);
>         return 1;
>  }
> 
> This trace_printk() in turn could become error() (glibc's error.h header), i.e.
> the error mechanism would use the equivalent to userland's "syslog", i.e.
> trace_printk :-)
> 
> In general trying to make BPF C scriptlets fed via perf to be as compact as
> possible, hiding all these details while allowing them to be used, if desired.

One extra possibility would be that it would look so much like a user
space C program that we could test it without loading it to the kernel,
with just building it with a different header and feeding it data as it
would get inside the kernel :-)

- Arnaldo

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] perf tools: Add sample types for bpf-output event Wang Nan <wangnan0@huawei.com> - 2016-04-01 15:30 +0200
  Re: [PATCH] perf tools: Add sample types for bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-01 17:20 +0200
    Re: [PATCH] perf tools: Add sample types for bpf-output event Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-04-01 17:30 +0200

csiph-web