Commit f8eb37bd authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf annotate: Add annotated_source__purge function

Mov disasm__purge() to annotated_source__purge() to make it work over a
generic struct annotation_line.
Signed-off-by: default avatarJiri 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-16-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c835e191
...@@ -1084,7 +1084,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, ...@@ -1084,7 +1084,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct hist_browser_timer *hbt) struct hist_browser_timer *hbt)
{ {
struct disasm_line *pos, *n; struct disasm_line *pos;
struct annotation *notes; struct annotation *notes;
size_t size; size_t size;
struct map_symbol ms = { struct map_symbol ms = {
...@@ -1180,10 +1180,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, ...@@ -1180,10 +1180,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
annotate_browser__update_addr_width(&browser); annotate_browser__update_addr_width(&browser);
ret = annotate_browser__run(&browser, evsel, hbt); ret = annotate_browser__run(&browser, evsel, hbt);
list_for_each_entry_safe(pos, n, &notes->src->source, al.node) {
list_del(&pos->al.node); annotated_source__purge(notes->src);
disasm_line__free(pos);
}
out_free_offsets: out_free_offsets:
free(browser.offsets); free(browser.offsets);
......
...@@ -1985,13 +1985,13 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx) ...@@ -1985,13 +1985,13 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
} }
} }
void disasm__purge(struct list_head *head) void annotated_source__purge(struct annotated_source *as)
{ {
struct disasm_line *pos, *n; struct annotation_line *al, *n;
list_for_each_entry_safe(pos, n, head, al.node) { list_for_each_entry_safe(al, n, &as->source, node) {
list_del(&pos->al.node); list_del(&al->node);
disasm_line__free(pos); disasm_line__free(disasm_line(al));
} }
} }
...@@ -2047,7 +2047,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, ...@@ -2047,7 +2047,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
if (print_lines) if (print_lines)
symbol__free_source_line(sym, len); symbol__free_source_line(sym, len);
disasm__purge(&symbol__annotation(sym)->src->source); annotated_source__purge(symbol__annotation(sym)->src);
return 0; return 0;
} }
......
...@@ -212,7 +212,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, ...@@ -212,7 +212,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
int min_pcnt, int max_lines, int context); int min_pcnt, int max_lines, int context);
void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); void symbol__annotate_zero_histogram(struct symbol *sym, int evidx);
void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); void symbol__annotate_decay_histogram(struct symbol *sym, int evidx);
void disasm__purge(struct list_head *head); void annotated_source__purge(struct annotated_source *as);
bool ui__has_annotation(void); bool ui__has_annotation(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment