aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2017-07-07 01:06:35 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-07-18 22:13:49 -0400
commit7e63a13a266da652f82731b845b5c35dd866ec7e (patch)
tree150f53051878fb91e9660a15d67e05d7cb6da252 /tools/perf/ui/browsers/annotate.c
parent69fb09f6ccdb2f070557fd1f4c56c4d646694c8e (diff)
perf annotate: Implement visual marker for macro fusion
For marking fused instructions clearly this patch adds a line before the first instruction of pair and joins it with the arrow of the jump to its target. For example, when "je" is selected in annotate view, the line before cmpl is displayed and joins the arrow of "je". │ ┌──cmpl $0x0,argp_program_version_hook 81.93 │ ├──je 20 │ │ lock cmpxchg %esi,0x38a9a4(%rip) │ │↓ jne 29 │ │↓ jmp 43 11.47 │20:└─→cmpxch %esi,0x38a999(%rip) That means the cmpl+je is a fused instruction pair and they should be considered together. Changelog: v3: Use Arnaldo's fix to improve the arrow origin rendering. To get the evsel->evlist->env->cpuid, save the evsel in annotate_browser. v2: new function "ins__is_fused" to check if the instructions are fused. Signed-off-by: Yao Jin <yao.jin@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1499403995-19857-3-git-send-email-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index c4336138b673..8d3f6f53c122 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -273,6 +273,25 @@ static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sy
273 return true; 273 return true;
274} 274}
275 275
276static bool is_fused(struct annotate_browser *ab, struct disasm_line *cursor)
277{
278 struct disasm_line *pos = list_prev_entry(cursor, node);
279 const char *name;
280
281 if (!pos)
282 return false;
283
284 if (ins__is_lock(&pos->ins))
285 name = pos->ops.locked.ins.name;
286 else
287 name = pos->ins.name;
288
289 if (!name || !cursor->ins.name)
290 return false;
291
292 return ins__is_fused(ab->arch, name, cursor->ins.name);
293}
294
276static void annotate_browser__draw_current_jump(struct ui_browser *browser) 295static void annotate_browser__draw_current_jump(struct ui_browser *browser)
277{ 296{
278 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); 297 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
@@ -308,6 +327,13 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
308 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); 327 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS);
309 __ui_browser__line_arrow(browser, pcnt_width + 2 + ab->addr_width, 328 __ui_browser__line_arrow(browser, pcnt_width + 2 + ab->addr_width,
310 from, to); 329 from, to);
330
331 if (is_fused(ab, cursor)) {
332 ui_browser__mark_fused(browser,
333 pcnt_width + 3 + ab->addr_width,
334 from - 1,
335 to > from ? true : false);
336 }
311} 337}
312 338
313static unsigned int annotate_browser__refresh(struct ui_browser *browser) 339static unsigned int annotate_browser__refresh(struct ui_browser *browser)