Re: [RESEND][PATCH v2] perf probe: add kernel source path option

From: Arnaldo Carvalho de Melo
Date: Thu Jun 17 2010 - 19:56:35 EST


Corrected Masami-san address,

Em Mon, Jun 14, 2010 at 03:26:30PM -0400, Chase Douglas escreveu:
> The probe plugin requires access to the source code for some operations.
> The source code must be in the exact same location as specified by the
> DWARF tags, but sometimes the location is an absolute path that cannot
> be replicated by a normal user. This change adds the -s|--source option
> to allow the user to specify the root of the kernel source tree.
>
> Signed-off-by: Chase Douglas <chase.douglas@xxxxxxxxxxxxx>

Just tested it, works as advertised:

[root@emilia mingo]# perf probe -L __schedule | head -22
Debuginfo analysis failed. (-2)
Error: Failed to show lines. (-2)
[root@emilia mingo]# perf probe -s /usr/src/debug/kernel-rt-2.6.33.4-rt20.19.el5rt/linux-2.6.33.4.x86_64 -L __schedule | head -22
<__schedule:0>
0 {
struct task_struct *prev, *next;
unsigned long *switch_count;
struct rq *rq;
int cpu;

6 cpu = smp_processor_id();
7 rq = cpu_rq(cpu);
8 rcu_sched_qs(cpu);
9 prev = rq->curr;
10 switch_count = &prev->nivcsw;

12 release_kernel_lock(prev);

schedule_debug(prev);

16 preempt_disable();

18 if (sched_feat(HRTICK))
19 hrtick_clear(rq);

[root@emilia mingo]# cat /sys/kernel/debug/sched_features
FAIR_SLEEPERS GENTLE_FAIR_SLEEPERS NO_NORMALIZED_SLEEPER START_DEBIT WAKEUP_PREEMPT ADAPTIVE_GRAN ASYM_GRAN NO_WAKEUP_SYNC NO_WAKEUP_OVERLAP SYNC_WAKEUPS AFFINE_WAKEUPS SYNC_LESS NO_SYNC_MORE NO_NEXT_BUDDY LAST_BUDDY CACHE_HOT_BUDDY NO_ARCH_POWER NO_HRTICK NO_DOUBLE_TICK LB_BIAS LB_SHARES_UPDATE ASYM_EFF_LOAD OWNER_SPIN
[root@emilia mingo]# perf probe __schedule:19
Add new event:
probe:__schedule (on __schedule:19)

You can now use it on all perf tools, such as:

perf record -e probe:__schedule -aR sleep 1

[root@emilia mingo]# perf record -e probe:__schedule -aR sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.061 MB perf.data (~2684 samples) ]
[root@emilia mingo]# perf report | head -15
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@emilia mingo]# echo HRTICK > /sys/kernel/debug/sched_features
[root@emilia mingo]# cat /sys/kernel/debug/sched_features
FAIR_SLEEPERS GENTLE_FAIR_SLEEPERS NO_NORMALIZED_SLEEPER START_DEBIT WAKEUP_PREEMPT ADAPTIVE_GRAN ASYM_GRAN NO_WAKEUP_SYNC NO_WAKEUP_OVERLAP SYNC_WAKEUPS AFFINE_WAKEUPS SYNC_LESS NO_SYNC_MORE NO_NEXT_BUDDY LAST_BUDDY CACHE_HOT_BUDDY NO_ARCH_POWER HRTICK NO_DOUBLE_TICK LB_BIAS LB_SHARES_UPDATE ASYM_EFF_LOAD OWNER_SPIN
[root@emilia mingo]# perf record -e probe:__schedule -aR sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.528 MB perf.data (~66766 samples) ]
[root@emilia mingo]# perf report | head -15
# Events: 19K cycles
#
# Overhead Command Shared Object Symbol
# ........ ............... .................. ......
#
38.42% init 0 [k] 0000000000000000
5.42% sirq-timer/0 [kernel.kallsyms] [k] kernel_thread_helper
5.41% sirq-timer/5 [kernel.kallsyms] [k] kernel_thread_helper
5.41% sirq-timer/4 [kernel.kallsyms] [k] kernel_thread_helper
5.41% sirq-timer/3 [kernel.kallsyms] [k] kernel_thread_helper
5.41% sirq-timer/2 [kernel.kallsyms] [k] kernel_thread_helper
5.41% sirq-timer/1 [kernel.kallsyms] [k] kernel_thread_helper
5.40% sirq-timer/7 [kernel.kallsyms] [k] kernel_thread_helper
5.40% sirq-timer/6 [kernel.kallsyms] [k] kernel_thread_helper
5.26% swapper 0 [k] 0000000000000000
[root@emilia mingo]#

Really cool stuff, thanks for your patch and to Masami for his amazing work on
'perf probe'.

I think we should look at usual places like debuginfo packages and
/usr/src/linux-`uname`, ~/git/linux-2.6/, etc, but that is something for a
follow on patch.

Best Regards,

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/