Skip to contentSkip to conversation

perf annotate: Sort by hottest lines in the TUI

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Aug 11, 2010 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  92221162875ec48913d3f9710046e48d599c9cf2
Gitweb:     http://git.kernel.org/tip/92221162875ec48913d3f9710046e48d599c9cf2
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 9 Aug 2010 15:30:40 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 10 Aug 2010 16:11:42 -0300

perf annotate: Sort by hottest lines in the TUI

Right now it will just sort and position at the hottest line, i.e. the one where more samples were taken.

It will be at the center of the screen and later TAB/shift-TAB will cycle thru the hottest lines.

Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>

---
 tools/perf/builtin-annotate.c          |    2 +-
 tools/perf/util/hist.c                 |   13 ++--
 tools/perf/util/hist.h                 |    3 +-
 tools/perf/util/ui/browsers/annotate.c |  153 ++++++++++++++++++++++++--------
 4 files changed, 125 insertions(+), 46 deletions(-)
tools/perf/builtin-annotate.c +1 -1
index fd20670..1478dc6 100644
@@ -285,7 +285,7 @@ static int hist_entry__tty_annotate(struct hist_entry *he)
 	LIST_HEAD(head);
 	struct objdump_line *pos, *n;
 
-	if (hist_entry__annotate(he, &head) < 0)
+	if (hist_entry__annotate(he, &head, 0) < 0)
 		return -1;
 
 	if (full_paths)
tools/perf/util/hist.c +7 -6
index 62ec9b0..be22ae6 100644
@@ -983,9 +983,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip)
 	return 0;
 }
 
-static struct objdump_line *objdump_line__new(s64 offset, char *line)
+static struct objdump_line *objdump_line__new(s64 offset, char *line, size_t privsize)
 {
-	struct objdump_line *self = malloc(sizeof(*self));
+	struct objdump_line *self = malloc(sizeof(*self) + privsize);
 
 	if (self != NULL) {
 		self->offset = offset;
@@ -1017,7 +1017,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
 }
 
 static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
-					  struct list_head *head)
+					  struct list_head *head, size_t privsize)
 {
 	struct symbol *sym = self->ms.sym;
 	struct objdump_line *objdump_line;
@@ -1068,7 +1068,7 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
 			offset = -1;
 	}
 
-	objdump_line = objdump_line__new(offset, line);
+	objdump_line = objdump_line__new(offset, line, privsize);
 	if (objdump_line == NULL) {
 		free(line);
 		return -1;
@@ -1078,7 +1078,8 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
 	return 0;
 }
 
-int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
+int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
+			 size_t privsize)
 {
 	struct symbol *sym = self->ms.sym;
 	struct map *map = self->ms.map;
@@ -1143,7 +1144,7 @@ fallback:
 		goto out_free_filename;
 
 	while (!feof(file))
-		if (hist_entry__parse_objdump_line(self, file, head) < 0)
+		if (hist_entry__parse_objdump_line(self, file, head, privsize) < 0)
 			break;
 
 	pclose(file);
tools/perf/util/hist.h +2 -1
index 65a48db..587d375 100644
@@ -101,7 +101,8 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 		      bool show_displacement, FILE *fp);
 
 int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip);
-int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
+int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
+			 size_t privsize);
 
 void hists__filter_by_dso(struct hists *self, const struct dso *dso);
 void hists__filter_by_thread(struct hists *self, const struct thread *thread);
tools/perf/util/ui/browsers/annotate.c +115 -38

198 lines not on this page · raw message