linux/tools/perf
Masami Hiramatsu 631c9def80 perf probe: Support --line option to show probable source-code lines
Add --line option to support showing probable source-code lines.

  perf probe --line SRC:LN[-LN|+NUM]
   or
  perf probe --line FUNC[:LN[-LN|+NUM]]

This option shows source-code with line number if the line can
be probed. Lines without line number (and blue color) means that
the line can not be probed, because debuginfo doesn't have the
information of those lines.

The argument specifies the range of lines, "source.c:100-120"
shows lines between 100th to l20th in source.c file. And
"func:10+20" shows 20 lines from 10th line of func function.

e.g.
 # ./perf probe --line kernel/sched.c:1080
 <kernel/sched.c:1080>
          *
          * called with rq->lock held and irqs disabled
          */
         static void hrtick_start(struct rq *rq, u64 delay)
         {
                struct hrtimer *timer = &rq->hrtick_timer;
   1086         ktime_t time = ktime_add_ns(timer->base->get_time(), delay);

                hrtimer_set_expires(timer, time);

   1090         if (rq == this_rq()) {
   1091                 hrtimer_restart(timer);
   1092         } else if (!rq->hrtick_csd_pending) {
   1093                 __smp_call_function_single(cpu_of(rq), &rq->hrtick_csd,
   1094                 rq->hrtick_csd_pending = 1;

If you specifying function name, this shows function-relative
line number.

 # ./perf probe --line schedule
 <schedule:0>
         asmlinkage void __sched schedule(void)
      1  {
                struct task_struct *prev, *next;
                unsigned long *switch_count;
                struct rq *rq;
                int cpu;

         need_resched:
                preempt_disable();
      9         cpu = smp_processor_id();
     10         rq = cpu_rq(cpu);
     11         rcu_sched_qs(cpu);
     12         prev = rq->curr;
     13         switch_count = &prev->nivcsw;

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20100106144534.27218.77939.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-13 10:09:14 +01:00
..
bench perf sched: Fix build failure on sparc 2009-12-14 08:59:12 +01:00
Documentation perf probe: Support --line option to show probable source-code lines 2010-01-13 10:09:14 +01:00
scripts/perl perf trace/scripting: List available scripts 2009-12-15 10:31:32 +01:00
util perf probe: Support --line option to show probable source-code lines 2010-01-13 10:09:14 +01:00
.gitignore perf tools: Add perf.data to .gitignore 2009-11-24 16:37:01 +01:00
builtin-annotate.c perf session: Remove redundant prefix & suffix from perf_event_ops 2009-12-28 09:03:35 +01:00
builtin-bench.c perf bench: Add "all" pseudo subsystem and "all" pseudo suite 2009-12-14 08:51:19 +01:00
builtin-buildid-list.c perf diff: Fix usage array, it must end with a NULL entry 2009-12-18 20:01:52 +01:00
builtin-diff.c perf diff: Fix support for all --sort combinations 2009-12-30 12:00:00 +01:00
builtin-help.c perf: Use format string of printf to align strings 2009-12-28 09:03:16 +01:00
builtin-kmem.c Merge branch 'perf/urgent' into perf/core 2010-01-13 10:08:50 +01:00
builtin-list.c perf list: Fix large list output by using the pager 2009-08-13 09:05:48 +02:00
builtin-probe.c perf probe: Support --line option to show probable source-code lines 2010-01-13 10:09:14 +01:00
builtin-record.c perf tools: Handle relocatable kernels 2010-01-13 10:09:11 +01:00
builtin-report.c perf report: Fix --no-call-chain option handling 2010-01-13 10:09:10 +01:00
builtin-sched.c perf session: Remove redundant prefix & suffix from perf_event_ops 2009-12-28 09:03:35 +01:00
builtin-stat.c perf tools: Fix --pid option for stat 2010-01-13 10:09:08 +01:00
builtin-timechart.c perf session: Remove redundant prefix & suffix from perf_event_ops 2009-12-28 09:03:35 +01:00
builtin-top.c perf symbols: Move symbol filtering to event__preprocess_sample() 2009-12-16 08:53:49 +01:00
builtin-trace.c perf session: Remove redundant prefix & suffix from perf_event_ops 2009-12-28 09:03:35 +01:00
builtin.h perf diff: Introduce tool to show performance difference 2009-12-15 08:50:29 +01:00
command-list.txt perf diff: Introduce tool to show performance difference 2009-12-15 08:50:29 +01:00
CREDITS perf_counter tools: Add CREDITS file for Git contributors 2009-06-24 19:54:29 +02:00
design.txt perf: Rename perf_event_hw_event in design document 2009-12-28 09:14:37 +01:00
Makefile Merge branch 'perf/urgent' into perf/core 2010-01-13 10:08:50 +01:00
perf.c perf tools: Mount debugfs automatically 2009-12-28 10:36:36 +01:00
perf.h perf tools: Allow building for ARM 2009-12-11 13:50:21 +01:00