linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/8] perf/urgent new features
@ 2012-04-07 20:54 Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 1/8] perf ui browser: Return the current color when setting a new one Arnaldo Carvalho de Melo
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen, Ashay Rane,
	David Ahern, Frederic Weisbecker, Linus Torvalds,
	Masami Hiramatsu, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, arnaldo.melo,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling.

	This was forked from my perf/urgent branch, that I submitted to you
recently.

	The jump stuff needs some more work and the offset mode has to become
the default, the long address as operand of jump instructions needs to be
suppressed, but I just wanted to push what I have to get comments about it at
this stage.

	Will be visiting some airports in the next two days on my way home, so
with limited or no connectivity.

- Arnaldo

The following changes since commit 31d68e7b66f168e623902e194af1e52b8cf75d71:

  perf annotate: Validate addr in symbol__inc_addr_samples (2012-04-05 19:51:14 -0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo

for you to fetch changes up to d3d1f61acf62204bb7b2b4509329247bffaedd7c:

  perf annotate browser: string search: /?n (2012-04-07 17:37:22 -0300)

----------------------------------------------------------------
Improvements for perf/core:

. Navigate jump instructions in the annotate browser, just press enter or ->,
  still needs support for a jump navigation history, i.e. to go back.

. Search string in the annotate browser: same keys as vim:
   / forward
   n next backward/forward
   ? backward

. Clarify number of events/samples in the report header, from Ashay Rane

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (7):
      perf ui browser: Return the current color when setting a new one
      perf annotate: Allow printing objdump line addr in different color
      perf ui annotate browser: Allow toggling addr offset view
      perf ui annotate browser: Move callq handling to separate function
      perf ui annotate browser: Add list based search for addr offset
      perf annotate browser: Initial support for navigating jump instructions
      perf annotate browser: string search: /?n

Ashay Rane (1):
      perf report: Correct display of samples and events in header

 tools/perf/Documentation/perfconfig.example |    1 +
 tools/perf/builtin-report.c                 |   11 +-
 tools/perf/util/annotate.c                  |   35 ++-
 tools/perf/util/ui/browser.c                |   11 +-
 tools/perf/util/ui/browser.h                |    4 +-
 tools/perf/util/ui/browsers/annotate.c      |  362 ++++++++++++++++++++++-----
 tools/perf/util/ui/browsers/hists.c         |   10 +-
 7 files changed, 353 insertions(+), 81 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/8] perf ui browser: Return the current color when setting a new one
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 2/8] perf annotate: Allow printing objdump line addr in different color Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Tools that want to change parts of the line to a different color and
then restore the previous one will use this, starting with the annotate
browser that will change the color of addresses if not on the current
entry, i.e. the selected one.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-uiajpevhxo4mzrvna6remb4a@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browser.c |    5 ++++-
 tools/perf/util/ui/browser.h |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 5568291..076a5ff 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser,
 	return HE_COLORSET_NORMAL;
 }
 
-void ui_browser__set_color(struct ui_browser *self __used, int color)
+int ui_browser__set_color(struct ui_browser *browser, int color)
 {
+	int ret = browser->current_color;
+	browser->current_color = color;
 	SLsmg_set_color(color);
+	return ret;
 }
 
 void ui_browser__set_percent_color(struct ui_browser *self,
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 6ee82f6..65b2592 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -15,6 +15,7 @@ struct ui_browser {
 	u64	      index, top_idx;
 	void	      *top, *entries;
 	u16	      y, x, width, height;
+	int	      current_color;
 	void	      *priv;
 	const char    *title;
 	char	      *helpline;
@@ -27,7 +28,7 @@ struct ui_browser {
 	bool	      use_navkeypressed;
 };
 
-void ui_browser__set_color(struct ui_browser *self, int color);
+int  ui_browser__set_color(struct ui_browser *browser, int color);
 void ui_browser__set_percent_color(struct ui_browser *self,
 				   double percent, bool current);
 bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/8] perf annotate: Allow printing objdump line addr in different color
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 1/8] perf ui browser: Return the current color when setting a new one Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 3/8] perf ui annotate browser: Allow toggling addr offset view Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

And by default use "magenta" for it.

Both the --stdio and --tui routines follow the same semantics.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ede5zkaf7oorwvbqjezb4yg4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perfconfig.example |    1 +
 tools/perf/util/annotate.c                  |   35 ++++++++++++++++++---------
 tools/perf/util/ui/browser.c                |    6 +++++
 tools/perf/util/ui/browser.h                |    1 +
 tools/perf/util/ui/browsers/annotate.c      |   26 ++++++++++++++++----
 5 files changed, 53 insertions(+), 16 deletions(-)

diff --git a/tools/perf/Documentation/perfconfig.example b/tools/perf/Documentation/perfconfig.example
index d144866..42c6fd2 100644
--- a/tools/perf/Documentation/perfconfig.example
+++ b/tools/perf/Documentation/perfconfig.example
@@ -6,6 +6,7 @@
 	normal = black, lightgray
 	selected = lightgray, magenta
 	code = blue, lightgray
+	addr = magenta, lightgray
 
 [tui]
 
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 08c6d13..9fc4126 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -84,10 +84,15 @@ static struct objdump_line *objdump_line__new(s64 offset, char *line, size_t pri
 
 	if (self != NULL) {
 		self->offset = offset;
-		self->line = line;
+		self->line = strdup(line);
+		if (self->line == NULL)
+			goto out_delete;
 	}
 
 	return self;
+out_delete:
+	free(self);
+	return NULL;
 }
 
 void objdump_line__free(struct objdump_line *self)
@@ -112,7 +117,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
 }
 
 static int objdump_line__print(struct objdump_line *oline, struct symbol *sym,
-			       int evidx, u64 len, int min_pcnt,
+			       u64 start, int evidx, u64 len, int min_pcnt,
 			       int printed, int max_lines,
 			       struct objdump_line *queue)
 {
@@ -128,6 +133,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym,
 		struct source_line *src_line = notes->src->lines;
 		struct sym_hist *h = annotation__histogram(notes, evidx);
 		s64 offset = oline->offset;
+		const u64 addr = start + offset;
 		struct objdump_line *next;
 
 		next = objdump__get_next_ip_line(&notes->src->source, oline);
@@ -157,7 +163,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym,
 			list_for_each_entry_from(queue, &notes->src->source, node) {
 				if (queue == oline)
 					break;
-				objdump_line__print(queue, sym, evidx, len,
+				objdump_line__print(queue, sym, start, evidx, len,
 						    0, 0, 1, NULL);
 			}
 		}
@@ -180,6 +186,7 @@ static int objdump_line__print(struct objdump_line *oline, struct symbol *sym,
 
 		color_fprintf(stdout, color, " %7.2f", percent);
 		printf(" :	");
+		color_fprintf(stdout, PERF_COLOR_MAGENTA, "  %" PRIx64 ":", addr);
 		color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", oline->line);
 	} else if (max_lines && printed >= max_lines)
 		return 1;
@@ -201,7 +208,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 {
 	struct annotation *notes = symbol__annotation(sym);
 	struct objdump_line *objdump_line;
-	char *line = NULL, *tmp, *tmp2, *c;
+	char *line = NULL, *parsed_line, *tmp, *tmp2, *c;
 	size_t line_len;
 	s64 line_ip, offset = -1;
 
@@ -246,13 +253,17 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 		offset = line_ip - start;
 		if (offset < 0 || (u64)line_ip > end)
 			offset = -1;
-	}
+		else
+			parsed_line = tmp2 + 1;
+	} else
+		parsed_line = line;
 
-	objdump_line = objdump_line__new(offset, line, privsize);
-	if (objdump_line == NULL) {
-		free(line);
+	objdump_line = objdump_line__new(offset, parsed_line, privsize);
+	free(line);
+
+	if (objdump_line == NULL)
 		return -1;
-	}
+
 	objdump__add_line(&notes->src->source, objdump_line);
 
 	return 0;
@@ -493,6 +504,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
 	const char *filename = dso->long_name, *d_filename;
 	struct annotation *notes = symbol__annotation(sym);
 	struct objdump_line *pos, *queue = NULL;
+	u64 start = map__rip_2objdump(map, sym->start);
 	int printed = 2, queue_len = 0;
 	int more = 0;
 	u64 len;
@@ -516,8 +528,9 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
 			queue_len = 0;
 		}
 
-		switch (objdump_line__print(pos, sym, evidx, len, min_pcnt,
-					    printed, max_lines, queue)) {
+		switch (objdump_line__print(pos, sym, start, evidx, len,
+					    min_pcnt, printed, max_lines,
+					    queue)) {
 		case 0:
 			++printed;
 			if (context) {
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 076a5ff..a1b140c 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -506,6 +506,12 @@ static struct ui_browser__colorset {
 		.bg	  = "default",
 	},
 	{
+		.colorset = HE_COLORSET_ADDR,
+		.name	  = "addr",
+		.fg	  = "magenta",
+		.bg	  = "default",
+	},
+	{
 		.name = NULL,
 	}
 };
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 65b2592..2550277 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -10,6 +10,7 @@
 #define HE_COLORSET_NORMAL	52
 #define HE_COLORSET_SELECTED	53
 #define HE_COLORSET_CODE	54
+#define HE_COLORSET_ADDR	55
 
 struct ui_browser {
 	u64	      index, top_idx;
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 57a4c6e..7ac7dd0 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -16,6 +16,7 @@ struct annotate_browser {
 	struct rb_root	  entries;
 	struct rb_node	  *curr_hot;
 	struct objdump_line *selection;
+	u64		    start;
 	int		    nr_asm_entries;
 	int		    nr_entries;
 	bool		    hide_src_code;
@@ -51,6 +52,9 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 	struct annotate_browser *ab = container_of(self, struct annotate_browser, b);
 	struct objdump_line *ol = list_entry(entry, struct objdump_line, node);
 	bool current_entry = ui_browser__is_current_entry(self, row);
+	bool change_color = (!ab->hide_src_code &&
+			     (!current_entry || (self->use_navkeypressed &&
+					         !self->navkeypressed)));
 	int width = self->width;
 
 	if (ol->offset != -1) {
@@ -69,15 +73,26 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 	if (!self->navkeypressed)
 		width += 1;
 
-	if (!ab->hide_src_code && ol->offset != -1)
-		if (!current_entry || (self->use_navkeypressed &&
-				       !self->navkeypressed))
-			ui_browser__set_color(self, HE_COLORSET_CODE);
+	if (ol->offset != -1 && change_color)
+		ui_browser__set_color(self, HE_COLORSET_CODE);
 
 	if (!*ol->line)
 		slsmg_write_nstring(" ", width - 18);
-	else
+	else if (ol->offset == -1)
 		slsmg_write_nstring(ol->line, width - 18);
+	else {
+		char bf[64];
+		u64 addr = ab->start + ol->offset;
+		int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
+		int color = -1;
+
+		if (change_color)
+			color = ui_browser__set_color(self, HE_COLORSET_ADDR);
+		slsmg_write_nstring(bf, printed);
+		if (change_color)
+			ui_browser__set_color(self, color);
+		slsmg_write_nstring(ol->line, width - 18 - printed);
+	}
 
 	if (current_entry)
 		ab->selection = ol;
@@ -406,6 +421,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
 	ui_helpline__push("Press <- or ESC to exit");
 
 	notes = symbol__annotation(sym);
+	browser.start = map__rip_2objdump(map, sym->start);
 
 	list_for_each_entry(pos, &notes->src->source, node) {
 		struct objdump_line_rb_node *rbpos;
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/8] perf ui annotate browser: Allow toggling addr offset view
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 1/8] perf ui browser: Return the current color when setting a new one Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 2/8] perf annotate: Allow printing objdump line addr in different color Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 4/8] perf ui annotate browser: Move callq handling to separate function Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The lines in objdump have this format:

    ffffffff8126543f:       jne    ffffffff81265494 <__list_del_entry+0x84>
<SNIP>
    ffffffff81265494:       mov    %rdi,%rcx

Since we now have objdump_line allowing tools to print the offset
independently from the rest of the line, allow toggling a view where
just offsets from the start of the function are shown:

     2f:       jne    ffffffff81265494 <__list_del_entry+0x84>
<SNIP>
     84:       mov    %rdi,%rcx

The offset view will be the default as soon as operations that deal with
offsets in a function are handled accodringly, i.e. in offset view the
above will become:

     2f:       jne    __list_del_entry+0x84
<SNIP>
     84:       mov    %rdi,%rcx

And then a follow up patch will allow navigating thru jumps, just like
we handle callq instructions.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4zpgimmz8xv7b5c920el7s45@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 7ac7dd0..5cf9b78 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -20,6 +20,7 @@ struct annotate_browser {
 	int		    nr_asm_entries;
 	int		    nr_entries;
 	bool		    hide_src_code;
+	bool		    use_offset;
 };
 
 struct objdump_line_rb_node {
@@ -82,10 +83,13 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
 		slsmg_write_nstring(ol->line, width - 18);
 	else {
 		char bf[64];
-		u64 addr = ab->start + ol->offset;
-		int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
-		int color = -1;
+		u64 addr = ol->offset;
+		int printed, color = -1;
 
+		if (!ab->use_offset)
+			addr += ab->start;
+
+		printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
 		if (change_color)
 			color = ui_browser__set_color(self, HE_COLORSET_ADDR);
 		slsmg_write_nstring(bf, printed);
@@ -250,6 +254,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 	struct symbol *sym = ms->sym;
 	const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, "
 			   "H: Go to hottest line, ->/ENTER: Line action, "
+			   "O: Toggle offset view, "
 			   "S: Toggle source code view";
 	int key;
 
@@ -310,6 +315,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 			if (annotate_browser__toggle_source(self))
 				ui_helpline__puts(help);
 			continue;
+		case 'O':
+		case 'o':
+			self->use_offset = !self->use_offset;
+			continue;
 		case K_ENTER:
 		case K_RIGHT:
 			if (self->selection == NULL) {
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/8] perf ui annotate browser: Move callq handling to separate function
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 3/8] perf ui annotate browser: Allow toggling addr offset view Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 5/8] perf ui annotate browser: Add list based search for addr offset Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

So that we can as well handle jumps. Later we'll move this to a proper
intruction table, etc.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-i98elvmix2cw6t8stu1iagfd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |   94 ++++++++++++++++----------------
 1 file changed, 48 insertions(+), 46 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 5cf9b78..dbf8d3f 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -245,6 +245,50 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser)
 	return true;
 }
 
+static bool annotate_browser__callq(struct annotate_browser *browser,
+				    int evidx, void (*timer)(void *arg),
+				    void *arg, int delay_secs)
+{
+	struct map_symbol *ms = browser->b.priv;
+	struct symbol *sym = ms->sym;
+	struct annotation *notes;
+	struct symbol *target;
+	char *s = strstr(browser->selection->line, "callq ");
+	u64 ip;
+
+	if (s == NULL)
+		return false;
+
+	s = strchr(s, ' ');
+	if (s++ == NULL) {
+		ui_helpline__puts("Invallid callq instruction.");
+		return true;
+	}
+
+	ip = strtoull(s, NULL, 16);
+	ip = ms->map->map_ip(ms->map, ip);
+	target = map__find_symbol(ms->map, ip, NULL);
+	if (target == NULL) {
+		ui_helpline__puts("The called function was not found.");
+		return true;
+	}
+
+	notes = symbol__annotation(target);
+	pthread_mutex_lock(&notes->lock);
+
+	if (notes->src == NULL && symbol__alloc_hist(target) < 0) {
+		pthread_mutex_unlock(&notes->lock);
+		ui__warning("Not enough memory for annotating '%s' symbol!\n",
+			    target->name);
+		return true;
+	}
+
+	pthread_mutex_unlock(&notes->lock);
+	symbol__tui_annotate(target, ms->map, evidx, timer, arg, delay_secs);
+	ui_browser__show_title(&browser->b, sym->name);
+	return true;
+}
+
 static int annotate_browser__run(struct annotate_browser *self, int evidx,
 				 void(*timer)(void *arg),
 				 void *arg, int delay_secs)
@@ -321,54 +365,12 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 			continue;
 		case K_ENTER:
 		case K_RIGHT:
-			if (self->selection == NULL) {
+			if (self->selection == NULL)
 				ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
-				continue;
-			}
-
-			if (self->selection->offset == -1) {
+			else if (self->selection->offset == -1)
 				ui_helpline__puts("Actions are only available for assembly lines.");
-				continue;
-			} else {
-				char *s = strstr(self->selection->line, "callq ");
-				struct annotation *notes;
-				struct symbol *target;
-				u64 ip;
-
-				if (s == NULL) {
-					ui_helpline__puts("Actions are only available for the 'callq' instruction.");
-					continue;
-				}
-
-				s = strchr(s, ' ');
-				if (s++ == NULL) {
-					ui_helpline__puts("Invallid callq instruction.");
-					continue;
-				}
-
-				ip = strtoull(s, NULL, 16);
-				ip = ms->map->map_ip(ms->map, ip);
-				target = map__find_symbol(ms->map, ip, NULL);
-				if (target == NULL) {
-					ui_helpline__puts("The called function was not found.");
-					continue;
-				}
-
-				notes = symbol__annotation(target);
-				pthread_mutex_lock(&notes->lock);
-
-				if (notes->src == NULL && symbol__alloc_hist(target) < 0) {
-					pthread_mutex_unlock(&notes->lock);
-					ui__warning("Not enough memory for annotating '%s' symbol!\n",
-						    target->name);
-					continue;
-				}
-
-				pthread_mutex_unlock(&notes->lock);
-				symbol__tui_annotate(target, ms->map, evidx,
-						     timer, arg, delay_secs);
-				ui_browser__show_title(&self->b, sym->name);
-			}
+			else if (!annotate_browser__callq(self, evidx, timer, arg, delay_secs))
+				ui_helpline__puts("Actions are only available for the 'callq' instruction.");
 			continue;
 		case K_LEFT:
 		case K_ESC:
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/8] perf ui annotate browser: Add list based search for addr offset
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 4/8] perf ui annotate browser: Move callq handling to separate function Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

>From the hit sorted rb_tree, so that we can use it in the upcoming jump
instruction support.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-44a7kl2atf9jxlg9npmotzdg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index dbf8d3f..c52543c 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -157,17 +157,13 @@ static void objdump__insert_line(struct rb_root *self,
 }
 
 static void annotate_browser__set_top(struct annotate_browser *self,
-				      struct rb_node *nd)
+				      struct objdump_line *pos, u32 idx)
 {
-	struct objdump_line_rb_node *rbpos;
-	struct objdump_line *pos;
 	unsigned back;
 
 	ui_browser__refresh_dimensions(&self->b);
 	back = self->b.height / 2;
-	rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node);
-	pos = ((struct objdump_line *)rbpos) - 1;
-	self->b.top_idx = self->b.index = rbpos->idx;
+	self->b.top_idx = self->b.index = idx;
 
 	while (self->b.top_idx != 0 && back != 0) {
 		pos = list_entry(pos->node.prev, struct objdump_line, node);
@@ -177,7 +173,18 @@ static void annotate_browser__set_top(struct annotate_browser *self,
 	}
 
 	self->b.top = pos;
-	self->curr_hot = nd;
+}
+
+static void annotate_browser__set_rb_top(struct annotate_browser *browser,
+					 struct rb_node *nd)
+{
+	struct objdump_line_rb_node *rbpos;
+	struct objdump_line *pos;
+
+	rbpos = rb_entry(nd, struct objdump_line_rb_node, rb_node);
+	pos = ((struct objdump_line *)rbpos) - 1;
+	annotate_browser__set_top(browser, pos, rbpos->idx);
+	browser->curr_hot = nd;
 }
 
 static void annotate_browser__calc_percent(struct annotate_browser *browser,
@@ -308,7 +315,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 	annotate_browser__calc_percent(self, evidx);
 
 	if (self->curr_hot)
-		annotate_browser__set_top(self, self->curr_hot);
+		annotate_browser__set_rb_top(self, self->curr_hot);
 
 	nd = self->curr_hot;
 
@@ -382,7 +389,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 		}
 
 		if (nd != NULL)
-			annotate_browser__set_top(self, nd);
+			annotate_browser__set_rb_top(self, nd);
 	}
 out:
 	ui_browser__hide(&self->b);
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 5/8] perf ui annotate browser: Add list based search for addr offset Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-09  2:02   ` David Ahern
  2012-04-07 20:54 ` [PATCH 7/8] perf report: Correct display of samples and events in header Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Masami Hiramatsu, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Now it is possible to press ENTER or -> (right arrow) on jump
instructions to navigate to the offset it points to.

More work needed to support <- to go back, i.e. a jump history.

This is done just like the callq case, i.e. parsing objdump output
lines, but should move to use Masami's disassembler at some point.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-706qqe2xibeiocuabp39mby7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |   63 +++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index c52543c..752d8d0 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -168,6 +168,9 @@ static void annotate_browser__set_top(struct annotate_browser *self,
 	while (self->b.top_idx != 0 && back != 0) {
 		pos = list_entry(pos->node.prev, struct objdump_line, node);
 
+		if (objdump_line__filter(&self->b, &pos->node))
+			continue;
+
 		--self->b.top_idx;
 		--back;
 	}
@@ -296,6 +299,61 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
 	return true;
 }
 
+static struct objdump_line *
+	annotate_browser__find_offset(struct annotate_browser *browser,
+				      s64 offset, s64 *idx)
+{
+	struct map_symbol *ms = browser->b.priv;
+	struct symbol *sym = ms->sym;
+	struct annotation *notes = symbol__annotation(sym);
+	struct objdump_line *pos;
+
+	*idx = 0;
+	list_for_each_entry(pos, &notes->src->source, node) {
+		if (pos->offset == offset)
+			return pos;
+		if (!objdump_line__filter(&browser->b, &pos->node))
+			++*idx;
+	}
+
+	return NULL;
+}
+
+static bool annotate_browser__jump(struct annotate_browser *browser)
+{
+	const char *jumps[] = { "je ", "jne ", "ja ", "jmpq ", "js ", "jmp ", NULL };
+	struct objdump_line *line;
+	s64 idx, offset;
+	char *s = NULL;
+	int i = 0;
+
+	while (jumps[i]) {
+		s = strstr(browser->selection->line, jumps[i++]);
+		if (s)
+			break;
+	}
+
+	if (s == NULL)
+		return false;
+
+	s = strchr(s, '+');
+	if (s++ == NULL) {
+		ui_helpline__puts("Invallid jump instruction.");
+		return true;
+	}
+
+	offset = strtoll(s, NULL, 16);
+	line = annotate_browser__find_offset(browser, offset, &idx);
+	if (line == NULL) {
+		ui_helpline__puts("Invallid jump offset");
+		return true;
+	}
+
+	annotate_browser__set_top(browser, line, idx);
+	
+	return true;
+}
+
 static int annotate_browser__run(struct annotate_browser *self, int evidx,
 				 void(*timer)(void *arg),
 				 void *arg, int delay_secs)
@@ -376,8 +434,9 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 				ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
 			else if (self->selection->offset == -1)
 				ui_helpline__puts("Actions are only available for assembly lines.");
-			else if (!annotate_browser__callq(self, evidx, timer, arg, delay_secs))
-				ui_helpline__puts("Actions are only available for the 'callq' instruction.");
+			else if (!(annotate_browser__jump(self) ||
+				   annotate_browser__callq(self, evidx, timer, arg, delay_secs)))
+				ui_helpline__puts("Actions are only available for the 'callq' and jump instructions.");
 			continue;
 		case K_LEFT:
 		case K_ESC:
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/8] perf report: Correct display of samples and events in header
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-07 20:54 ` [PATCH 8/8] perf annotate browser: string search: /?n Arnaldo Carvalho de Melo
  2012-04-08 22:24 ` [GIT PULL 0/8] perf/urgent new features Namhyung Kim
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Ashay Rane, Arnaldo Carvalho de Melo

From: Ashay Rane <ashay.rane@tacc.utexas.edu>

This patch prints the number of samples and the count of performance
events separately.

This allows comparing performance of different applications with each
other.

Previously, the sample count was displayed against an 'Events:' heading.
With this patch, the header now reads (for example):

Samples: 5K of event 'instructions'
Event count (approx.): 2993026545

The patch covers both the stdio and the browser interface.

Signed-off-by: Ashay Rane <ashay.rane@tacc.utexas.edu>
[ committer note: Fixed wrt e7f01d1 ]
Link: http://lkml.kernel.org/n/tip-h4nfjm8msedlk8gxkzivfh5y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c         |   11 +++++++----
 tools/perf/util/ui/browsers/hists.c |   10 +++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2e31743..cec2b8c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -296,12 +296,15 @@ static size_t hists__fprintf_nr_sample_events(struct hists *self,
 {
 	size_t ret;
 	char unit;
-	unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
+	unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE];
+	u64 nr_events = self->stats.total_period;
 
-	nr_events = convert_unit(nr_events, &unit);
-	ret = fprintf(fp, "# Events: %lu%c", nr_events, unit);
+	nr_samples = convert_unit(nr_samples, &unit);
+	ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit);
 	if (evname != NULL)
-		ret += fprintf(fp, " %s", evname);
+		ret += fprintf(fp, " of event '%s'", evname);
+
+	ret += fprintf(fp, "\n# Event count (approx.): %lu", nr_events);
 	return ret + fprintf(fp, "\n#\n");
 }
 
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 2f83e5d..1b820ed 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -840,10 +840,14 @@ static int hists__browser_title(struct hists *self, char *bf, size_t size,
 	int printed;
 	const struct dso *dso = self->dso_filter;
 	const struct thread *thread = self->thread_filter;
-	unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE];
+	unsigned long nr_samples = self->stats.nr_events[PERF_RECORD_SAMPLE];
+	u64 nr_events = self->stats.total_period;
+
+	nr_samples = convert_unit(nr_samples, &unit);
+	printed = scnprintf(bf, size,
+			   "Samples: %lu%c of event '%s', Event count (approx.): %lu",
+			   nr_samples, unit, ev_name, nr_events);
 
-	nr_events = convert_unit(nr_events, &unit);
-	printed = scnprintf(bf, size, "Events: %lu%c %s", nr_events, unit, ev_name);
 
 	if (self->uid_filter_str)
 		printed += snprintf(bf + printed, size - printed,
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/8] perf annotate browser: string search: /?n
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 7/8] perf report: Correct display of samples and events in header Arnaldo Carvalho de Melo
@ 2012-04-07 20:54 ` Arnaldo Carvalho de Melo
  2012-04-08 22:24 ` [GIT PULL 0/8] perf/urgent new features Namhyung Kim
  8 siblings, 0 replies; 12+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-07 20:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen, David Ahern,
	Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Using the same keystrokes as vim:

/ = search forward
n = search next forward/backwards
? = search backwards

Still needs to continue from start/end when not found, use HOME + / or
END + ? for now.

At some point we need a keybindings file to support ones favourite mode,
erm, like EMACS, etc.

Also we now need a 'h' window with all these keybindings.

Requested-by: Andi Kleen <andi@firstfloor.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-rv30xj2i258n0gwkzlu0c0bc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/ui/browsers/annotate.c |  149 +++++++++++++++++++++++++++++++-
 1 file changed, 148 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 752d8d0..c2cfeed 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -21,6 +21,8 @@ struct annotate_browser {
 	int		    nr_entries;
 	bool		    hide_src_code;
 	bool		    use_offset;
+	bool		    searching_backwards;
+	char		    search_bf[128];
 };
 
 struct objdump_line_rb_node {
@@ -176,6 +178,7 @@ static void annotate_browser__set_top(struct annotate_browser *self,
 	}
 
 	self->b.top = pos;
+	self->b.navkeypressed = true;
 }
 
 static void annotate_browser__set_rb_top(struct annotate_browser *browser,
@@ -354,6 +357,132 @@ static bool annotate_browser__jump(struct annotate_browser *browser)
 	return true;
 }
 
+static struct objdump_line *
+	annotate_browser__find_string(struct annotate_browser *browser,
+				      char *s, s64 *idx)
+{
+	struct map_symbol *ms = browser->b.priv;
+	struct symbol *sym = ms->sym;
+	struct annotation *notes = symbol__annotation(sym);
+	struct objdump_line *pos = browser->selection;
+
+	*idx = browser->b.index;
+	list_for_each_entry_continue(pos, &notes->src->source, node) {
+		if (objdump_line__filter(&browser->b, &pos->node))
+			continue;
+
+		++*idx;
+
+		if (pos->line && strstr(pos->line, s) != NULL)
+			return pos;
+	}
+
+	return NULL;
+}
+
+static bool __annotate_browser__search(struct annotate_browser *browser)
+{
+	struct objdump_line *line;
+	s64 idx;
+
+	line = annotate_browser__find_string(browser, browser->search_bf, &idx);
+	if (line == NULL) {
+		ui_helpline__puts("String not found!");
+		return false;
+	}
+
+	annotate_browser__set_top(browser, line, idx);
+	browser->searching_backwards = false;
+	return true;
+}
+
+static struct objdump_line *
+	annotate_browser__find_string_reverse(struct annotate_browser *browser,
+					      char *s, s64 *idx)
+{
+	struct map_symbol *ms = browser->b.priv;
+	struct symbol *sym = ms->sym;
+	struct annotation *notes = symbol__annotation(sym);
+	struct objdump_line *pos = browser->selection;
+
+	*idx = browser->b.index;
+	list_for_each_entry_continue_reverse(pos, &notes->src->source, node) {
+		if (objdump_line__filter(&browser->b, &pos->node))
+			continue;
+
+		--*idx;
+
+		if (pos->line && strstr(pos->line, s) != NULL)
+			return pos;
+	}
+
+	return NULL;
+}
+
+static bool __annotate_browser__search_reverse(struct annotate_browser *browser)
+{
+	struct objdump_line *line;
+	s64 idx;
+
+	line = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx);
+	if (line == NULL) {
+		ui_helpline__puts("String not found!");
+		return false;
+	}
+
+	annotate_browser__set_top(browser, line, idx);
+	browser->searching_backwards = true;
+	return true;
+}
+
+static bool annotate_browser__search_window(struct annotate_browser *browser,
+					    int delay_secs)
+{
+	if (ui_browser__input_window("Search", "String: ", browser->search_bf,
+				     "ENTER: OK, ESC: Cancel",
+				     delay_secs * 2) != K_ENTER ||
+	    !*browser->search_bf)
+		return false;
+
+	return true;
+}
+
+static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs)
+{
+	if (annotate_browser__search_window(browser, delay_secs))
+		return __annotate_browser__search(browser);
+
+	return false;
+}
+
+static bool annotate_browser__continue_search(struct annotate_browser *browser,
+					      int delay_secs)
+{
+	if (!*browser->search_bf)
+		return annotate_browser__search(browser, delay_secs);
+
+	return __annotate_browser__search(browser);
+}
+
+static bool annotate_browser__search_reverse(struct annotate_browser *browser,
+					   int delay_secs)
+{
+	if (annotate_browser__search_window(browser, delay_secs))
+		return __annotate_browser__search_reverse(browser);
+
+	return false;
+}
+
+static
+bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,
+					       int delay_secs)
+{
+	if (!*browser->search_bf)
+		return annotate_browser__search_reverse(browser, delay_secs);
+
+	return __annotate_browser__search_reverse(browser);
+}
+
 static int annotate_browser__run(struct annotate_browser *self, int evidx,
 				 void(*timer)(void *arg),
 				 void *arg, int delay_secs)
@@ -372,8 +501,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 
 	annotate_browser__calc_percent(self, evidx);
 
-	if (self->curr_hot)
+	if (self->curr_hot) {
 		annotate_browser__set_rb_top(self, self->curr_hot);
+		self->b.navkeypressed = false;
+	}
 
 	nd = self->curr_hot;
 
@@ -428,6 +559,22 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
 		case 'o':
 			self->use_offset = !self->use_offset;
 			continue;
+		case '/':
+			if (annotate_browser__search(self, delay_secs)) {
+show_help:
+				ui_helpline__puts(help);
+			}
+			continue;
+		case 'n':
+			if (self->searching_backwards ?
+			    annotate_browser__continue_search_reverse(self, delay_secs) :
+			    annotate_browser__continue_search(self, delay_secs))
+				goto show_help;
+			continue;
+		case '?':
+			if (annotate_browser__search_reverse(self, delay_secs))
+				goto show_help;
+			continue;
 		case K_ENTER:
 		case K_RIGHT:
 			if (self->selection == NULL)
-- 
1.7.9.2.358.g22243


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [GIT PULL 0/8] perf/urgent new features
  2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2012-04-07 20:54 ` [PATCH 8/8] perf annotate browser: string search: /?n Arnaldo Carvalho de Melo
@ 2012-04-08 22:24 ` Namhyung Kim
  2012-04-13 18:19   ` [tip:perf/core] perf annotate: Fix a build error tip-bot for Namhyung Kim
  8 siblings, 1 reply; 12+ messages in thread
From: Namhyung Kim @ 2012-04-08 22:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, linux-kernel, Andi Kleen, Ashay Rane, David Ahern,
	Frederic Weisbecker, Linus Torvalds, Masami Hiramatsu,
	Mike Galbraith, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	arnaldo.melo, Arnaldo Carvalho de Melo

Hi, Arnaldo

This gave me a build failuire. You might need this also.



>From cacd1950b71bcd28a5d5115c573f2a0578058fcd Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung.kim@lge.com>
Date: Mon, 9 Apr 2012 07:19:50 +0900
Subject: [PATCH] perf annotate: Fix a build error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

    CC util/annotate.o
util/annotate.c: In function ‘symbol__annotate’:
util/annotate.c:87:16: error: ‘parsed_line’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
util/annotate.c:211:22: note: ‘parsed_line’ was declared here
cc1: all warnings being treated as errors
make: *** [util/annotate.o] Error 1
make: *** Waiting for unfinished jobs....

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 tools/perf/util/annotate.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9fc4126e54db..1e7fd52bd29d 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -226,6 +226,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 		*c = 0;
 
 	line_ip = -1;
+	parsed_line = line;
 
 	/*
 	 * Strip leading spaces:
@@ -255,8 +256,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 			offset = -1;
 		else
 			parsed_line = tmp2 + 1;
-	} else
-		parsed_line = line;
+	}
 
 	objdump_line = objdump_line__new(offset, parsed_line, privsize);
 	free(line);
-- 
1.7.9.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions
  2012-04-07 20:54 ` [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions Arnaldo Carvalho de Melo
@ 2012-04-09  2:02   ` David Ahern
  0 siblings, 0 replies; 12+ messages in thread
From: David Ahern @ 2012-04-09  2:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, linux-kernel, Arnaldo Carvalho de Melo,
	Frederic Weisbecker, Masami Hiramatsu, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On 4/7/12 2:54 PM, Arnaldo Carvalho de Melo wrote:
> +	s = strchr(s, '+');
> +	if (s++ == NULL) {
> +		ui_helpline__puts("Invallid jump instruction.");

s/Invallid/Invalid/

> +		return true;
> +	}
> +
> +	offset = strtoll(s, NULL, 16);
> +	line = annotate_browser__find_offset(browser, offset,&idx);
> +	if (line == NULL) {
> +		ui_helpline__puts("Invallid jump offset");

ditto

David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tip:perf/core] perf annotate: Fix a build error
  2012-04-08 22:24 ` [GIT PULL 0/8] perf/urgent new features Namhyung Kim
@ 2012-04-13 18:19   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-04-13 18:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, eranian, mingo, peterz, efault, namhyung.kim, fweisbec,
	dsahern, tglx, hpa, paulus, linux-kernel, andi, ashay.rane,
	namhyung, masami.hiramatsu.pt

Commit-ID:  a31b7cc083b1d3d15bd475729fc4471685ebc5f6
Gitweb:     http://git.kernel.org/tip/a31b7cc083b1d3d15bd475729fc4471685ebc5f6
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Wed, 11 Apr 2012 17:04:59 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 11 Apr 2012 17:07:18 -0300

perf annotate: Fix a build error

    CC util/annotate.o
util/annotate.c: In function symbol__annotate:
util/annotate.c:87:16: error: parsed_line may be used uninitialized in this function [-Werror=maybe-uninitialized]
util/annotate.c:211:22: note: parsed_line was declared here
cc1: all warnings being treated as errors
make: *** [util/annotate.o] Error 1
make: *** Waiting for unfinished jobs....

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ashay Rane <ashay.rane@tacc.utexas.edu>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/87ty0tlv4i.fsf@dasan.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9fc4126..1e7fd52 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -226,6 +226,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 		*c = 0;
 
 	line_ip = -1;
+	parsed_line = line;
 
 	/*
 	 * Strip leading spaces:
@@ -255,8 +256,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
 			offset = -1;
 		else
 			parsed_line = tmp2 + 1;
-	} else
-		parsed_line = line;
+	}
 
 	objdump_line = objdump_line__new(offset, parsed_line, privsize);
 	free(line);

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-04-13 18:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-07 20:54 [GIT PULL 0/8] perf/urgent new features Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 1/8] perf ui browser: Return the current color when setting a new one Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 2/8] perf annotate: Allow printing objdump line addr in different color Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 3/8] perf ui annotate browser: Allow toggling addr offset view Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 4/8] perf ui annotate browser: Move callq handling to separate function Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 5/8] perf ui annotate browser: Add list based search for addr offset Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 6/8] perf annotate browser: Initial support for navigating jump instructions Arnaldo Carvalho de Melo
2012-04-09  2:02   ` David Ahern
2012-04-07 20:54 ` [PATCH 7/8] perf report: Correct display of samples and events in header Arnaldo Carvalho de Melo
2012-04-07 20:54 ` [PATCH 8/8] perf annotate browser: string search: /?n Arnaldo Carvalho de Melo
2012-04-08 22:24 ` [GIT PULL 0/8] perf/urgent new features Namhyung Kim
2012-04-13 18:19   ` [tip:perf/core] perf annotate: Fix a build error tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).