[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160401151930.GB9494@redhat.com>
Date: Fri, 1 Apr 2016 12:19:30 -0300
From: Arnaldo Carvalho de Melo <acme@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>, linux-kernel@...r.kernel.org,
pi3orama@....com, Adrian Hunter <adrian.hunter@...el.com>,
Ingo Molnar <mingo@...nel.org>,
David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...nel.org>,
Milian Wolff <milian.wolff@...b.com>,
Namhyung Kim <namhyung@...nel.org>,
Brendan Gregg <brendan.d.gregg@...il.com>
Subject: Re: [PATCH] perf tools: Add sample types for bpf-output event
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
Powered by blists - more mailing lists