perf annotate: Add annotation_line__next function
Rename disasm__get_next_ip_line() to annotation_line__next() to make it work over a generic struct annotation_line. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20171011150158.11895-12-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
d03a686ea6
commit
c4c724364d
|
@ -440,7 +440,8 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
|
||||||
struct map_symbol *ms = browser->b.priv;
|
struct map_symbol *ms = browser->b.priv;
|
||||||
struct symbol *sym = ms->sym;
|
struct symbol *sym = ms->sym;
|
||||||
struct annotation *notes = symbol__annotation(sym);
|
struct annotation *notes = symbol__annotation(sym);
|
||||||
struct disasm_line *pos, *next;
|
struct annotation_line *next;
|
||||||
|
struct disasm_line *pos;
|
||||||
s64 len = symbol__size(sym);
|
s64 len = symbol__size(sym);
|
||||||
|
|
||||||
browser->entries = RB_ROOT;
|
browser->entries = RB_ROOT;
|
||||||
|
@ -458,7 +459,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = disasm__get_next_ip_line(¬es->src->source, pos);
|
next = annotation_line__next(&pos->al, ¬es->src->source);
|
||||||
|
|
||||||
for (i = 0; i < browser->nr_events; i++) {
|
for (i = 0; i < browser->nr_events; i++) {
|
||||||
struct sym_hist_entry sample;
|
struct sym_hist_entry sample;
|
||||||
|
@ -466,7 +467,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser,
|
||||||
bpos->samples[i].percent = disasm__calc_percent(notes,
|
bpos->samples[i].percent = disasm__calc_percent(notes,
|
||||||
evsel->idx + i,
|
evsel->idx + i,
|
||||||
pos->al.offset,
|
pos->al.offset,
|
||||||
next ? next->al.offset : len,
|
next ? next->offset : len,
|
||||||
&path, &sample);
|
&path, &sample);
|
||||||
bpos->samples[i].he = sample;
|
bpos->samples[i].he = sample;
|
||||||
|
|
||||||
|
|
|
@ -942,10 +942,11 @@ static void disasm__add(struct list_head *head, struct disasm_line *line)
|
||||||
list_add_tail(&line->al.node, head);
|
list_add_tail(&line->al.node, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos)
|
struct annotation_line *
|
||||||
|
annotation_line__next(struct annotation_line *pos, struct list_head *head)
|
||||||
{
|
{
|
||||||
list_for_each_entry_continue(pos, head, al.node)
|
list_for_each_entry_continue(pos, head, node)
|
||||||
if (pos->al.offset >= 0)
|
if (pos->offset >= 0)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1096,10 +1097,10 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
|
||||||
struct annotation *notes = symbol__annotation(sym);
|
struct annotation *notes = symbol__annotation(sym);
|
||||||
s64 offset = dl->al.offset;
|
s64 offset = dl->al.offset;
|
||||||
const u64 addr = start + offset;
|
const u64 addr = start + offset;
|
||||||
struct disasm_line *next;
|
struct annotation_line *next;
|
||||||
struct block_range *br;
|
struct block_range *br;
|
||||||
|
|
||||||
next = disasm__get_next_ip_line(¬es->src->source, dl);
|
next = annotation_line__next(&dl->al, ¬es->src->source);
|
||||||
|
|
||||||
if (perf_evsel__is_group_event(evsel)) {
|
if (perf_evsel__is_group_event(evsel)) {
|
||||||
nr_percent = evsel->nr_members;
|
nr_percent = evsel->nr_members;
|
||||||
|
@ -1114,7 +1115,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
|
||||||
percent = disasm__calc_percent(notes,
|
percent = disasm__calc_percent(notes,
|
||||||
notes->src->lines ? i : evsel->idx + i,
|
notes->src->lines ? i : evsel->idx + i,
|
||||||
offset,
|
offset,
|
||||||
next ? next->al.offset : (s64) len,
|
next ? next->offset : (s64) len,
|
||||||
&path, &sample);
|
&path, &sample);
|
||||||
|
|
||||||
ppercents[i] = percent;
|
ppercents[i] = percent;
|
||||||
|
|
|
@ -85,7 +85,8 @@ struct sym_hist_entry {
|
||||||
};
|
};
|
||||||
|
|
||||||
void disasm_line__free(struct disasm_line *dl);
|
void disasm_line__free(struct disasm_line *dl);
|
||||||
struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos);
|
struct annotation_line *
|
||||||
|
annotation_line__next(struct annotation_line *pos, struct list_head *head);
|
||||||
int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
|
int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
|
||||||
size_t disasm__fprintf(struct list_head *head, FILE *fp);
|
size_t disasm__fprintf(struct list_head *head, FILE *fp);
|
||||||
double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
|
double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
|
||||||
|
|
Loading…
Reference in New Issue