Re: [PATCH] perf/core: Add a tracepoint for perf sampling

From: Wangnan (F)
Date: Fri Jul 29 2016 - 23:43:05 EST

On 2016/7/30 2:05, Brendan Gregg wrote:
On Tue, Jul 19, 2016 at 4:20 PM, Brendan Gregg <bgregg@xxxxxxxxxxx> wrote:
When perf is performing hrtimer-based sampling, this tracepoint can be used
by BPF to run additional logic on each sample. For example, BPF can fetch
stack traces and frequency count them in kernel context, for an efficient
Any comments on this patch? Thanks,


Sorry for the late.

I think it is a useful feature. Could you please provide an example
to show how to use it in perf?

If I understand correctly, I can have a BPF script run 99 times per
second using

# perf -e cpu-clock/freq=99/ -e mybpf.c ...

And in mybpf.c, attach a BPF script on the new tracepoint. Right?

Also, since we already have timer:hrtimer_expire_entry, please provide
some further information about why we need a new tracepoint.

Thank you.