[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55A9AA4E.6040404@plumgrid.com>
Date: Fri, 17 Jul 2015 18:22:22 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: pi3orama <pi3orama@....com>
Cc: kaixu xia <xiakaixu@...wei.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"acme@...nel.org" <acme@...nel.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"a.p.zijlstra@...llo.nl" <a.p.zijlstra@...llo.nl>,
"masami.hiramatsu.pt@...achi.com" <masami.hiramatsu.pt@...achi.com>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"wangnan0@...wei.com" <wangnan0@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"hekuang@...wei.com" <hekuang@...wei.com>
Subject: Re: [RFC PATCH 0/6] bpf: Introduce the new ability of eBPF programs
to access hardware PMU counter
On 7/17/15 6:02 PM, pi3orama wrote:
> An example: we want to count the number of cycles between entry and exit point of a particular library function (glibc write() for example). Context switch is possible, but we don't care cycles consumed by other tasks. Then we need to create a perf event in task context using:
>
> perf _event_open(&attr, pid, -1/* cpu */, ...);
> Since it is a library function, we have to choose pids we interest.
sure. just store that fd under whatever index in perf_event_array
and use it from the program. index is not cpuid. it's just an index.
> We should also probe sys_clone and create new perf event when thread creating, we haven't think how to do that now.
opening a perf_event from the program? That will be very very hard.
Much easier to kprobe sys_clone and signal to user space via
bpf_output_trace_data() and user space will be
perf_event_open-ing new event for new task.
ps
please tweak your email client to wrap lines.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists