aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-09 14:30:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 15:11:42 -0400
commit92221162875ec48913d3f9710046e48d599c9cf2 (patch)
tree891aeb2c50777478aaf0cd5a2537db65f6b7d2ae /tools/perf/util/hist.c
parent1e6dd077a880ba5570beb690523b7a78a91a7615 (diff)
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 <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 62ec9b0e4b9a..be22ae6ef055 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -983,9 +983,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip)
983 return 0; 983 return 0;
984} 984}
985 985
986static struct objdump_line *objdump_line__new(s64 offset, char *line) 986static struct objdump_line *objdump_line__new(s64 offset, char *line, size_t privsize)
987{ 987{
988 struct objdump_line *self = malloc(sizeof(*self)); 988 struct objdump_line *self = malloc(sizeof(*self) + privsize);
989 989
990 if (self != NULL) { 990 if (self != NULL) {
991 self->offset = offset; 991 self->offset = offset;
@@ -1017,7 +1017,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
1017} 1017}
1018 1018
1019static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file, 1019static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
1020 struct list_head *head) 1020 struct list_head *head, size_t privsize)
1021{ 1021{
1022 struct symbol *sym = self->ms.sym; 1022 struct symbol *sym = self->ms.sym;
1023 struct objdump_line *objdump_line; 1023 struct objdump_line *objdump_line;
@@ -1068,7 +1068,7 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
1068 offset = -1; 1068 offset = -1;
1069 } 1069 }
1070 1070
1071 objdump_line = objdump_line__new(offset, line); 1071 objdump_line = objdump_line__new(offset, line, privsize);
1072 if (objdump_line == NULL) { 1072 if (objdump_line == NULL) {
1073 free(line); 1073 free(line);
1074 return -1; 1074 return -1;
@@ -1078,7 +1078,8 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
1078 return 0; 1078 return 0;
1079} 1079}
1080 1080
1081int hist_entry__annotate(struct hist_entry *self, struct list_head *head) 1081int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
1082 size_t privsize)
1082{ 1083{
1083 struct symbol *sym = self->ms.sym; 1084 struct symbol *sym = self->ms.sym;
1084 struct map *map = self->ms.map; 1085 struct map *map = self->ms.map;
@@ -1143,7 +1144,7 @@ fallback:
1143 goto out_free_filename; 1144 goto out_free_filename;
1144 1145
1145 while (!feof(file)) 1146 while (!feof(file))
1146 if (hist_entry__parse_objdump_line(self, file, head) < 0) 1147 if (hist_entry__parse_objdump_line(self, file, head, privsize) < 0)
1147 break; 1148 break;
1148 1149
1149 pclose(file); 1150 pclose(file);