public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: xiakaixu <xiakaixu@huawei.com>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: <davem@davemloft.net>, <daniel@iogearbox.net>, <acme@kernel.org>,
	<mingo@redhat.com>, <a.p.zijlstra@chello.nl>,
	<masami.hiramatsu.pt@hitachi.com>, <jolsa@kernel.org>,
	<linux-kernel@vger.kernel.org>, <wangnan0@huawei.com>,
	<pi3orama@163.com>
Subject: Re: [RFC PATCH 0/4] perf tools: Use the new ability of eBPF programs to access hardware PMU counter
Date: Sat, 29 Aug 2015 10:14:59 +0800	[thread overview]
Message-ID: <55E115A3.8030506@huawei.com> (raw)
In-Reply-To: <55E10AC1.1000706@plumgrid.com>

于 2015/8/29 9:28, Alexei Starovoitov 写道:
> On 8/27/15 3:42 AM, Kaixu Xia wrote:
>> An example is pasted at the bottom of this cover letter. In that example,
>> we can get the cpu_cycles and exception taken in sys_write.
>>
>>   $ cat /sys/kernel/debug/tracing/trace_pipe
>>   $ ./perf record --event perf-bpf.o ls
>>     ...
>>               cat-1653  [003] d..1 88174.613854: : ente:  CPU-3    cyc:48746333    exc:84
>>               cat-1653  [003] d..2 88174.613861: : exit:  CPU-3    cyc:48756041    exc:84
> 
> nice. probably more complex example that computes the delta of the pmu
> counters on the kernel side would be even more interesting.

Right, this is just a little example. Actually, I have tested this
ability on kernel side and user space side, that is kprobe and uprobe.
The collected delta of the pmu counters form kernel and glibc is correct
and meets the expected goals. I will give them in the next version.

At this time i wish to get your comment on the current chosen implementation.
Now the struct perf_event_map_def is introduced and the user can directly
define the struct perf_event_attr, so we can skip the parse_events process
and call the sys_perf_event_open on the events directly. This is the most
simple implementation, but I am not sure it is the most appropriate.
> Do you think you can extend 'perf stat' with a flag that does
> stats collection for a given kernel or user function instead of the
> whole process ?
> Then we can use perf record/report to figure out hot functions and
> follow with 'perf stat -f my_hot_func my_process' to drill into
> particular function stats.

Good idea! I will consider it when this patchset is basically completed.
> 
> 
> .
> 



  reply	other threads:[~2015-08-29  2:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 10:42 [RFC PATCH 0/4] perf tools: Use the new ability of eBPF programs to access hardware PMU counter Kaixu Xia
2015-08-27 10:42 ` [RFC PATCH 1/4] bpf tools: Add bpf_update_elem() and perf_event_open() for common bpf operations Kaixu Xia
2015-08-27 10:42 ` [RFC PATCH 2/4] bpf tools: Collect BPF_MAP_TYPE_PERF_EVENT_ARRAY map definitions from 'maps' section Kaixu Xia
2015-08-27 10:42 ` [RFC PATCH 3/4] bpf tools: Save the perf event fds from "maps" sections to 'struct bpf_object' Kaixu Xia
2015-08-27 10:42 ` [RFC PATCH 4/4] bpf tools: Enable/disable the perf events stored in " Kaixu Xia
2015-08-29  1:28 ` [RFC PATCH 0/4] perf tools: Use the new ability of eBPF programs to access hardware PMU counter Alexei Starovoitov
2015-08-29  2:14   ` xiakaixu [this message]
2015-08-29  2:42     ` Alexei Starovoitov

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=55E115A3.8030506@huawei.com \
    --to=xiakaixu@huawei.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ast@plumgrid.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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