lkml.org 
[lkml]   [2017]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/35] perf annotate: Add annotated_source__purge function
Date
Moving disasm__purge into annotated_source__purge to
make it work over generic struct annotation_line.

Link: http://lkml.kernel.org/n/tip-hsd1l53pu9kplllt84q93sux@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/annotate.c | 8 +++-----
tools/perf/util/annotate.c | 12 ++++++------
tools/perf/util/annotate.h | 2 +-
3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 9cd9987188b4..b122d0a4e1ad 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -1083,7 +1083,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel,
struct hist_browser_timer *hbt)
{
- struct disasm_line *pos, *n;
+ struct disasm_line *pos;
struct annotation *notes;
size_t size;
struct map_symbol ms = {
@@ -1179,10 +1179,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
annotate_browser__update_addr_width(&browser);

ret = annotate_browser__run(&browser, evsel, hbt);
- list_for_each_entry_safe(pos, n, &notes->src->source, al.node) {
- list_del(&pos->al.node);
- disasm_line__free(pos);
- }
+
+ annotated_source__purge(notes->src);

out_free_offsets:
free(browser.offsets);
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index f5d0f4feac78..8e1e88aab45a 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1975,13 +1975,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_del(&pos->al.node);
- disasm_line__free(pos);
+ list_for_each_entry_safe(al, n, &as->source, node) {
+ list_del(&al->node);
+ disasm_line__free(disasm_line(al));
}
}

@@ -2037,7 +2037,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
if (print_lines)
symbol__free_source_line(sym, len);

- disasm__purge(&symbol__annotation(sym)->src->source);
+ annotated_source__purge(symbol__annotation(sym)->src);

return 0;
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 225708719c29..a02a2bf4f2ab 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -211,7 +211,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
int min_pcnt, int max_lines, int context);
void symbol__annotate_zero_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);

--
2.13.6
\
 
 \ /
  Last update: 2017-10-11 17:07    [W:2.013 / U:0.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site