Re: Reading perf counters at ftrace trace boundaries

2013-08-13 Thread zhangwei(Jovi)
On 2013/8/12 23:26, Karim Yaghmour wrote: > > On 13-08-11 11:24 PM, zhangwei(Jovi) wrote: >> If you want to base on ftrace, below two approach maybe take into use: >> >> - register_ftrace_function/unregister_ftrace_function >> >> - perf_event_create_kernel_counter (function event id is 1) >> >> th

Re: Reading perf counters at ftrace trace boundaries

2013-08-12 Thread Karim Yaghmour
On 13-08-11 11:24 PM, zhangwei(Jovi) wrote: > If you want to base on ftrace, below two approach maybe take into use: > > - register_ftrace_function/unregister_ftrace_function > > - perf_event_create_kernel_counter (function event id is 1) > > the first one is simplest, IMO. Thx for the pointer

Re: Reading perf counters at ftrace trace boundaries

2013-08-11 Thread zhangwei(Jovi)
On 2013/8/12 8:03, Karim Yaghmour wrote: > > Wondering if there's a way for reading perf counters in the kernel. I'd > like to read/record perf counters on ftrace function tracing > entries/exits to provide a rundown of the value of various counters on > function call boundaries. > > [ Steven: ap

Re: Reading perf counters at ftrace trace boundaries

2013-08-11 Thread Karim Yaghmour
On 13-08-11 10:47 PM, Andi Kleen wrote: > That's what normal sampling already does. > > If you're worried about systematic shadow effects just randomize a bit. That's actually the point. I'd like to be able to study/compare both approaches. I could be completely off, but I'd like to see if a div

Re: Reading perf counters at ftrace trace boundaries

2013-08-11 Thread Andi Kleen
> Indeed. It doesn't actually have to be at every single ftrace > begin/exit. But possibly starting with some kind of every nth and then > drilling down as the culprit is incrementally singled-out. That's what normal sampling already does. If you're worried about systematic shadow effects just ra

Re: Reading perf counters at ftrace trace boundaries

2013-08-11 Thread Karim Yaghmour
On 13-08-11 10:23 PM, Andi Kleen wrote: > KVM does it, see arch/x86/kvm/pmu.c. Essentially it would be doing RDPMC. Thx for the pointer, appreciated. > But the overhead will be likely very high, some sampling approach > is likely better. Indeed. It doesn't actually have to be at every single ft

Re: Reading perf counters at ftrace trace boundaries

2013-08-11 Thread Andi Kleen
Karim Yaghmour writes: > Wondering if there's a way for reading perf counters in the kernel. I'd > like to read/record perf counters on ftrace function tracing > entries/exits to provide a rundown of the value of various counters on > function call boundaries. KVM does it, see arch/x86/kvm/pmu.c