aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-05 12:37:31 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-05 12:37:31 -0500
commitd040bd363824f9f0ad6610b91ee6c65f292c066c (patch)
treee0e4215e44e7971ea7901d57de5dce7369a87e6b /tools/perf/util/annotate.c
parent2f525d0148ef2734c8a172201e5e1e9167a8a5fd (diff)
perf annotate: Config options for symbol__tty_annotate
Max line# that should be printed, minimum percentage filter, just like 'perf top', alas, due to it :-) Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7488fe99502c..072bc8d91aa1 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -87,7 +87,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
87 87
88static void objdump_line__print(struct objdump_line *oline, 88static void objdump_line__print(struct objdump_line *oline,
89 struct list_head *head, struct symbol *sym, 89 struct list_head *head, struct symbol *sym,
90 int evidx, u64 len) 90 int evidx, u64 len, int min_pcnt)
91{ 91{
92 static const char *prev_line; 92 static const char *prev_line;
93 static const char *prev_color; 93 static const char *prev_color;
@@ -118,6 +118,9 @@ static void objdump_line__print(struct objdump_line *oline,
118 if (src_line == NULL && h->sum) 118 if (src_line == NULL && h->sum)
119 percent = 100.0 * hits / h->sum; 119 percent = 100.0 * hits / h->sum;
120 120
121 if (percent < min_pcnt)
122 return;
123
121 color = get_percent_color(percent); 124 color = get_percent_color(percent);
122 125
123 /* 126 /*
@@ -419,13 +422,15 @@ static void symbol__annotate_hits(struct symbol *sym, int evidx)
419} 422}
420 423
421int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, 424int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
422 bool print_lines, bool full_paths) 425 bool print_lines, bool full_paths, int min_pcnt,
426 int max_lines)
423{ 427{
424 struct dso *dso = map->dso; 428 struct dso *dso = map->dso;
425 const char *filename = dso->long_name, *d_filename; 429 const char *filename = dso->long_name, *d_filename;
426 struct rb_root source_line = RB_ROOT; 430 struct rb_root source_line = RB_ROOT;
427 struct objdump_line *pos, *n; 431 struct objdump_line *pos, *n;
428 LIST_HEAD(head); 432 LIST_HEAD(head);
433 int printed = 2;
429 u64 len; 434 u64 len;
430 435
431 if (symbol__annotate(sym, map, &head, 0) < 0) 436 if (symbol__annotate(sym, map, &head, 0) < 0)
@@ -444,7 +449,6 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
444 print_summary(&source_line, filename); 449 print_summary(&source_line, filename);
445 } 450 }
446 451
447 printf("\n\n------------------------------------------------\n");
448 printf(" Percent | Source code & Disassembly of %s\n", d_filename); 452 printf(" Percent | Source code & Disassembly of %s\n", d_filename);
449 printf("------------------------------------------------\n"); 453 printf("------------------------------------------------\n");
450 454
@@ -452,9 +456,11 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
452 symbol__annotate_hits(sym, evidx); 456 symbol__annotate_hits(sym, evidx);
453 457
454 list_for_each_entry_safe(pos, n, &head, node) { 458 list_for_each_entry_safe(pos, n, &head, node) {
455 objdump_line__print(pos, &head, sym, evidx, len); 459 objdump_line__print(pos, &head, sym, evidx, len, min_pcnt);
456 list_del(&pos->node); 460 list_del(&pos->node);
457 objdump_line__free(pos); 461 objdump_line__free(pos);
462 if (max_lines && ++printed >= max_lines)
463 break;
458 } 464 }
459 465
460 if (print_lines) 466 if (print_lines)