perf annotate: Move cycles/IPC formatting width constants outside TUI

These will be used in --stdio2 so lets move it first to reduce noise in
the following patches.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-fisud7pcak3prk7uwsvs3g2e@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 98bc80b0
...@@ -22,9 +22,6 @@ struct disasm_line_samples { ...@@ -22,9 +22,6 @@ struct disasm_line_samples {
struct sym_hist_entry he; struct sym_hist_entry he;
}; };
#define IPC_WIDTH 6
#define CYCLES_WIDTH 6
struct browser_line { struct browser_line {
u32 idx; u32 idx;
int idx_asm; int idx_asm;
...@@ -107,7 +104,7 @@ static int annotate_browser__pcnt_width(struct annotate_browser *ab) ...@@ -107,7 +104,7 @@ static int annotate_browser__pcnt_width(struct annotate_browser *ab)
static int annotate_browser__cycles_width(struct annotate_browser *ab) static int annotate_browser__cycles_width(struct annotate_browser *ab)
{ {
return ab->have_cycles ? IPC_WIDTH + CYCLES_WIDTH : 0; return ab->have_cycles ? ANNOTATION__IPC_WIDTH + ANNOTATION__CYCLES_WIDTH : 0;
} }
static void disasm_line__write(struct disasm_line *dl, struct ui_browser *browser, static void disasm_line__write(struct disasm_line *dl, struct ui_browser *browser,
...@@ -194,19 +191,19 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int ...@@ -194,19 +191,19 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
} }
if (ab->have_cycles) { if (ab->have_cycles) {
if (al->ipc) if (al->ipc)
ui_browser__printf(browser, "%*.2f ", IPC_WIDTH - 1, al->ipc); ui_browser__printf(browser, "%*.2f ", ANNOTATION__IPC_WIDTH - 1, al->ipc);
else if (!show_title) else if (!show_title)
ui_browser__write_nstring(browser, " ", IPC_WIDTH); ui_browser__write_nstring(browser, " ", ANNOTATION__IPC_WIDTH);
else else
ui_browser__printf(browser, "%*s ", IPC_WIDTH - 1, "IPC"); ui_browser__printf(browser, "%*s ", ANNOTATION__IPC_WIDTH - 1, "IPC");
if (al->cycles) if (al->cycles)
ui_browser__printf(browser, "%*" PRIu64 " ", ui_browser__printf(browser, "%*" PRIu64 " ",
CYCLES_WIDTH - 1, al->cycles); ANNOTATION__CYCLES_WIDTH - 1, al->cycles);
else if (!show_title) else if (!show_title)
ui_browser__write_nstring(browser, " ", CYCLES_WIDTH); ui_browser__write_nstring(browser, " ", ANNOTATION__CYCLES_WIDTH);
else else
ui_browser__printf(browser, "%*s ", CYCLES_WIDTH - 1, "Cycle"); ui_browser__printf(browser, "%*s ", ANNOTATION__CYCLES_WIDTH - 1, "Cycle");
} }
SLsmg_write_char(' '); SLsmg_write_char(' ');
...@@ -359,7 +356,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) ...@@ -359,7 +356,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
} }
if (ab->have_cycles) if (ab->have_cycles)
width = IPC_WIDTH + CYCLES_WIDTH; width = ANNOTATION__IPC_WIDTH + ANNOTATION__CYCLES_WIDTH;
ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS);
__ui_browser__line_arrow(browser, __ui_browser__line_arrow(browser,
......
...@@ -58,6 +58,9 @@ bool ins__is_lock(const struct ins *ins); ...@@ -58,6 +58,9 @@ bool ins__is_lock(const struct ins *ins);
int ins__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops); int ins__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops);
bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2); bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2);
#define ANNOTATION__IPC_WIDTH 6
#define ANNOTATION__CYCLES_WIDTH 6
struct annotation_options { struct annotation_options {
bool hide_src_code, bool hide_src_code,
use_offset, use_offset,
......
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