mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
perf ui browser: Introduce ui_browser__write_nstring()
To remove direct access to libslang functions, with the immediate goal of implementing horizontal scrolling at the ui_browser level, but also because we may at some point want to implement ui_browser with other UIs in addition to the current libslang implementation. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-437ineavoejzou727mr9bxpi@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
b62bee1bde
commit
26270a0082
@ -46,6 +46,12 @@ void ui_browser__gotorc(struct ui_browser *browser, int y, int x)
|
||||
SLsmg_gotorc(browser->y + y, browser->x + x);
|
||||
}
|
||||
|
||||
void ui_browser__write_nstring(struct ui_browser *browser __maybe_unused, const char *msg,
|
||||
unsigned int width)
|
||||
{
|
||||
slsmg_write_nstring(msg, width);
|
||||
}
|
||||
|
||||
static struct list_head *
|
||||
ui_browser__list_head_filter_entries(struct ui_browser *browser,
|
||||
struct list_head *pos)
|
||||
@ -234,7 +240,7 @@ void __ui_browser__show_title(struct ui_browser *browser, const char *title)
|
||||
{
|
||||
SLsmg_gotorc(0, 0);
|
||||
ui_browser__set_color(browser, HE_COLORSET_ROOT);
|
||||
slsmg_write_nstring(title, browser->width + 1);
|
||||
ui_browser__write_nstring(browser, title, browser->width + 1);
|
||||
}
|
||||
|
||||
void ui_browser__show_title(struct ui_browser *browser, const char *title)
|
||||
|
@ -37,6 +37,8 @@ void ui_browser__refresh_dimensions(struct ui_browser *browser);
|
||||
void ui_browser__reset_index(struct ui_browser *browser);
|
||||
|
||||
void ui_browser__gotorc(struct ui_browser *browser, int y, int x);
|
||||
void ui_browser__write_nstring(struct ui_browser *browser, const char *msg,
|
||||
unsigned int width);
|
||||
void ui_browser__write_graph(struct ui_browser *browser, int graph);
|
||||
void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
|
||||
u64 start, u64 end);
|
||||
|
@ -141,22 +141,22 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
slsmg_printf("%6.2f ", bdl->samples[i].percent);
|
||||
}
|
||||
} else {
|
||||
slsmg_write_nstring(" ", 7 * ab->nr_events);
|
||||
ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
|
||||
}
|
||||
} else {
|
||||
ui_browser__set_percent_color(browser, 0, current_entry);
|
||||
slsmg_write_nstring(" ", 7 * ab->nr_events);
|
||||
ui_browser__write_nstring(browser, " ", 7 * ab->nr_events);
|
||||
}
|
||||
if (ab->have_cycles) {
|
||||
if (dl->ipc)
|
||||
slsmg_printf("%*.2f ", IPC_WIDTH - 1, dl->ipc);
|
||||
else
|
||||
slsmg_write_nstring(" ", IPC_WIDTH);
|
||||
ui_browser__write_nstring(browser, " ", IPC_WIDTH);
|
||||
if (dl->cycles)
|
||||
slsmg_printf("%*" PRIu64 " ",
|
||||
CYCLES_WIDTH - 1, dl->cycles);
|
||||
else
|
||||
slsmg_write_nstring(" ", CYCLES_WIDTH);
|
||||
ui_browser__write_nstring(browser, " ", CYCLES_WIDTH);
|
||||
}
|
||||
|
||||
SLsmg_write_char(' ');
|
||||
@ -166,7 +166,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
width += 1;
|
||||
|
||||
if (!*dl->line)
|
||||
slsmg_write_nstring(" ", width - pcnt_width);
|
||||
ui_browser__write_nstring(browser, " ", width - pcnt_width);
|
||||
else if (dl->offset == -1) {
|
||||
if (dl->line_nr && annotate_browser__opts.show_linenr)
|
||||
printed = scnprintf(bf, sizeof(bf), "%-*d ",
|
||||
@ -174,8 +174,8 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
else
|
||||
printed = scnprintf(bf, sizeof(bf), "%*s ",
|
||||
ab->addr_width, " ");
|
||||
slsmg_write_nstring(bf, printed);
|
||||
slsmg_write_nstring(dl->line, width - printed - pcnt_width + 1);
|
||||
ui_browser__write_nstring(browser, bf, printed);
|
||||
ui_browser__write_nstring(browser, dl->line, width - printed - pcnt_width + 1);
|
||||
} else {
|
||||
u64 addr = dl->offset;
|
||||
int color = -1;
|
||||
@ -194,7 +194,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
bdl->jump_sources);
|
||||
prev = annotate_browser__set_jumps_percent_color(ab, bdl->jump_sources,
|
||||
current_entry);
|
||||
slsmg_write_nstring(bf, printed);
|
||||
ui_browser__write_nstring(browser, bf, printed);
|
||||
ui_browser__set_color(browser, prev);
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
|
||||
if (change_color)
|
||||
color = ui_browser__set_color(browser, HE_COLORSET_ADDR);
|
||||
slsmg_write_nstring(bf, printed);
|
||||
ui_browser__write_nstring(browser, bf, printed);
|
||||
if (change_color)
|
||||
ui_browser__set_color(browser, color);
|
||||
if (dl->ins && dl->ins->ops->scnprintf) {
|
||||
@ -222,11 +222,11 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
ui_browser__write_graph(browser, SLSMG_RARROW_CHAR);
|
||||
SLsmg_write_char(' ');
|
||||
} else {
|
||||
slsmg_write_nstring(" ", 2);
|
||||
ui_browser__write_nstring(browser, " ", 2);
|
||||
}
|
||||
} else {
|
||||
if (strcmp(dl->name, "retq")) {
|
||||
slsmg_write_nstring(" ", 2);
|
||||
ui_browser__write_nstring(browser, " ", 2);
|
||||
} else {
|
||||
ui_browser__write_graph(browser, SLSMG_LARROW_CHAR);
|
||||
SLsmg_write_char(' ');
|
||||
@ -234,7 +234,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
|
||||
}
|
||||
|
||||
disasm_line__scnprintf(dl, bf, sizeof(bf), !annotate_browser__opts.use_offset);
|
||||
slsmg_write_nstring(bf, width - pcnt_width - 3 - printed);
|
||||
ui_browser__write_nstring(browser, bf, width - pcnt_width - 3 - printed);
|
||||
}
|
||||
|
||||
if (current_entry)
|
||||
|
@ -25,7 +25,7 @@ static void ui_browser__argv_write(struct ui_browser *browser,
|
||||
ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED :
|
||||
HE_COLORSET_NORMAL);
|
||||
|
||||
slsmg_write_nstring(str, browser->width);
|
||||
ui_browser__write_nstring(browser, str, browser->width);
|
||||
}
|
||||
|
||||
static int list_menu__run(struct ui_browser *menu)
|
||||
|
@ -540,10 +540,10 @@ static void hist_browser__show_callchain_entry(struct hist_browser *browser,
|
||||
|
||||
ui_browser__set_color(&browser->b, color);
|
||||
hist_browser__gotorc(browser, row, 0);
|
||||
slsmg_write_nstring(" ", offset);
|
||||
ui_browser__write_nstring(&browser->b, " ", offset);
|
||||
slsmg_printf("%c", folded_sign);
|
||||
ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' ');
|
||||
slsmg_write_nstring(str, width);
|
||||
ui_browser__write_nstring(&browser->b, str, width);
|
||||
}
|
||||
|
||||
static void hist_browser__fprintf_callchain_entry(struct hist_browser *b __maybe_unused,
|
||||
@ -822,7 +822,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
|
||||
if (!browser->b.navkeypressed)
|
||||
width += 1;
|
||||
|
||||
slsmg_write_nstring("", width);
|
||||
ui_browser__write_nstring(&browser->b, "", width);
|
||||
|
||||
++row;
|
||||
++printed;
|
||||
@ -899,7 +899,7 @@ static void hist_browser__show_headers(struct hist_browser *browser)
|
||||
hists__scnprintf_headers(headers, sizeof(headers), browser->hists);
|
||||
ui_browser__gotorc(&browser->b, 0, 0);
|
||||
ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
|
||||
slsmg_write_nstring(headers, browser->b.width + 1);
|
||||
ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
|
||||
}
|
||||
|
||||
static void ui_browser__hists_init_top(struct ui_browser *browser)
|
||||
@ -2057,7 +2057,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
|
||||
warn = bf;
|
||||
}
|
||||
|
||||
slsmg_write_nstring(warn, browser->width - printed);
|
||||
ui_browser__write_nstring(browser, warn, browser->width - printed);
|
||||
|
||||
if (current_entry)
|
||||
menu->selection = evsel;
|
||||
|
@ -32,7 +32,7 @@ static void map_browser__write(struct ui_browser *browser, void *nd, int row)
|
||||
sym->binding == STB_LOCAL ? 'l' : 'w');
|
||||
width = browser->width - ((mb->addrlen * 2) + 4);
|
||||
if (width > 0)
|
||||
slsmg_write_nstring(sym->name, width);
|
||||
ui_browser__write_nstring(browser, sym->name, width);
|
||||
}
|
||||
|
||||
/* FIXME uber-kludgy, see comment on cmd_report... */
|
||||
|
@ -81,7 +81,7 @@ static void script_browser__write(struct ui_browser *browser,
|
||||
ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED :
|
||||
HE_COLORSET_NORMAL);
|
||||
|
||||
slsmg_write_nstring(sline->line, browser->width);
|
||||
ui_browser__write_nstring(browser, sline->line, browser->width);
|
||||
}
|
||||
|
||||
static int script_browser__run(struct perf_script_browser *browser)
|
||||
|
@ -21,7 +21,7 @@ static void ui_browser__argv_write(struct ui_browser *browser,
|
||||
|
||||
ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED :
|
||||
HE_COLORSET_NORMAL);
|
||||
slsmg_write_nstring(*arg, browser->width);
|
||||
ui_browser__write_nstring(browser, *arg, browser->width);
|
||||
}
|
||||
|
||||
static int popup_menu__run(struct ui_browser *menu)
|
||||
|
Loading…
Reference in New Issue
Block a user