perf probe: Show more lines after last line
authorMasami Hiramatsu <mhiramat@redhat.com>
Thu, 25 Feb 2010 13:36:04 +0000 (08:36 -0500)
committerIngo Molnar <mingo@elte.hu>
Thu, 25 Feb 2010 16:49:30 +0000 (17:49 +0100)
Show 2 more lines after the last probe-able line.
This will clearly show the last closed-brace of
inline functions.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
LKML-Reference: <20100225133604.6725.76820.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/probe-event.c

index 71b0dd590a374320386b71e6d49f67bcd05c77a0..91f55f24fa9df17bbc260fe8f6f6fe26e4e40d81 100644 (file)
@@ -716,6 +716,7 @@ void del_trace_kprobe_events(struct strlist *dellist)
 }
 
 #define LINEBUF_SIZE 256
+#define NR_ADDITIONAL_LINES 2
 
 static void show_one_line(FILE *fp, unsigned int l, bool skip, bool show_num)
 {
@@ -776,5 +777,11 @@ void show_line_range(struct line_range *lr)
                        show_one_line(fp, (l++) - lr->offset, false, false);
                show_one_line(fp, (l++) - lr->offset, false, true);
        }
+
+       if (lr->end == INT_MAX)
+               lr->end = l + NR_ADDITIONAL_LINES;
+       while (l < lr->end && !feof(fp))
+               show_one_line(fp, (l++) - lr->offset, false, false);
+
        fclose(fp);
 }