diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-01-06 09:45:34 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 04:09:14 -0500 |
commit | 631c9def804b2c92b5cca04fb9ff7b5df9e35094 (patch) | |
tree | 3ce09a1894f765bbea6538335ef11950287d66ee /tools/perf/util/probe-finder.h | |
parent | 6964cd2c8efe6e048401f1fe3952a06c563c34c1 (diff) |
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>
Diffstat (limited to 'tools/perf/util/probe-finder.h')
-rw-r--r-- | tools/perf/util/probe-finder.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index e3f396806e6e..972b386116f1 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
@@ -34,8 +34,26 @@ struct probe_point { | |||
34 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | 34 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ |
35 | }; | 35 | }; |
36 | 36 | ||
37 | /* Line number container */ | ||
38 | struct line_node { | ||
39 | struct list_head list; | ||
40 | unsigned int line; | ||
41 | }; | ||
42 | |||
43 | /* Line range */ | ||
44 | struct line_range { | ||
45 | char *file; /* File name */ | ||
46 | char *function; /* Function name */ | ||
47 | unsigned int start; /* Start line number */ | ||
48 | unsigned int end; /* End line number */ | ||
49 | unsigned int offset; /* Start line offset */ | ||
50 | char *path; /* Real path name */ | ||
51 | struct list_head line_list; /* Visible lines */ | ||
52 | }; | ||
53 | |||
37 | #ifndef NO_LIBDWARF | 54 | #ifndef NO_LIBDWARF |
38 | extern int find_probepoint(int fd, struct probe_point *pp); | 55 | extern int find_probepoint(int fd, struct probe_point *pp); |
56 | extern int find_line_range(int fd, struct line_range *lr); | ||
39 | 57 | ||
40 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ | 58 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ |
41 | #ifndef _MIPS_SZLONG | 59 | #ifndef _MIPS_SZLONG |
@@ -62,6 +80,19 @@ struct probe_finder { | |||
62 | char *buf; /* Current output buffer */ | 80 | char *buf; /* Current output buffer */ |
63 | int len; /* Length of output buffer */ | 81 | int len; /* Length of output buffer */ |
64 | }; | 82 | }; |
83 | |||
84 | struct line_finder { | ||
85 | struct line_range *lr; /* Target line range */ | ||
86 | |||
87 | Dwarf_Unsigned fno; /* File number */ | ||
88 | Dwarf_Unsigned lno_s; /* Start line number */ | ||
89 | Dwarf_Unsigned lno_e; /* End line number */ | ||
90 | Dwarf_Addr addr_s; /* Start address */ | ||
91 | Dwarf_Addr addr_e; /* End address */ | ||
92 | Dwarf_Die cu_die; /* Current CU */ | ||
93 | int found; | ||
94 | }; | ||
95 | |||
65 | #endif /* NO_LIBDWARF */ | 96 | #endif /* NO_LIBDWARF */ |
66 | 97 | ||
67 | #endif /*_PROBE_FINDER_H */ | 98 | #endif /*_PROBE_FINDER_H */ |