Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234396
b: refs/heads/master
c: d040bd3
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Feb 5, 2011
1 parent f01b5f3 commit e14ebcf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f525d0148ef2734c8a172201e5e1e9167a8a5fd
refs/heads/master: d040bd363824f9f0ad6610b91ee6c65f292c066c
2 changes: 1 addition & 1 deletion trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int process_sample_event(union perf_event *event,
static int hist_entry__tty_annotate(struct hist_entry *he, int evidx)
{
return symbol__tty_annotate(he->ms.sym, he->ms.map, evidx,
print_line, full_paths);
print_line, full_paths, 0, 0);
}

static void hists__find_annotations(struct hists *self)
Expand Down
14 changes: 10 additions & 4 deletions trunk/tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct objdump_line *objdump__get_next_ip_line(struct list_head *head,

static void objdump_line__print(struct objdump_line *oline,
struct list_head *head, struct symbol *sym,
int evidx, u64 len)
int evidx, u64 len, int min_pcnt)
{
static const char *prev_line;
static const char *prev_color;
Expand Down Expand Up @@ -118,6 +118,9 @@ static void objdump_line__print(struct objdump_line *oline,
if (src_line == NULL && h->sum)
percent = 100.0 * hits / h->sum;

if (percent < min_pcnt)
return;

color = get_percent_color(percent);

/*
Expand Down Expand Up @@ -419,13 +422,15 @@ static void symbol__annotate_hits(struct symbol *sym, int evidx)
}

int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
bool print_lines, bool full_paths)
bool print_lines, bool full_paths, int min_pcnt,
int max_lines)
{
struct dso *dso = map->dso;
const char *filename = dso->long_name, *d_filename;
struct rb_root source_line = RB_ROOT;
struct objdump_line *pos, *n;
LIST_HEAD(head);
int printed = 2;
u64 len;

if (symbol__annotate(sym, map, &head, 0) < 0)
Expand All @@ -444,17 +449,18 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
print_summary(&source_line, filename);
}

printf("\n\n------------------------------------------------\n");
printf(" Percent | Source code & Disassembly of %s\n", d_filename);
printf("------------------------------------------------\n");

if (verbose)
symbol__annotate_hits(sym, evidx);

list_for_each_entry_safe(pos, n, &head, node) {
objdump_line__print(pos, &head, sym, evidx, len);
objdump_line__print(pos, &head, sym, evidx, len, min_pcnt);
list_del(&pos->node);
objdump_line__free(pos);
if (max_lines && ++printed >= max_lines)
break;
}

if (print_lines)
Expand Down
3 changes: 2 additions & 1 deletion trunk/tools/perf/util/annotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ int symbol__annotate(struct symbol *sym, struct map *map,
struct list_head *head, size_t privsize);

int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
bool print_lines, bool full_paths);
bool print_lines, bool full_paths, int min_pcnt,
int max_lines);

#ifdef NO_NEWT_SUPPORT
static inline int symbol__tui_annotate(symbol *sym __used,
Expand Down

0 comments on commit e14ebcf

Please sign in to comment.