struct annotation_line *selection;
struct arch *arch;
bool searching_backwards;
- u8 addr_width;
- u8 jumps_width;
- u8 target_width;
- u8 min_addr_width;
- u8 max_addr_width;
char search_bf[128];
};
else if (al->offset == -1) {
if (al->line_nr && notes->options->show_linenr)
printed = scnprintf(bf, sizeof(bf), "%-*d ",
- ab->addr_width + 1, al->line_nr);
+ notes->widths.addr + 1, al->line_nr);
else
printed = scnprintf(bf, sizeof(bf), "%*s ",
- ab->addr_width, " ");
+ notes->widths.addr, " ");
ui_browser__write_nstring(browser, bf, printed);
ui_browser__write_nstring(browser, al->line, width - printed - pcnt_width - cycles_width + 1);
} else {
if (notes->options->show_nr_jumps) {
int prev;
printed = scnprintf(bf, sizeof(bf), "%*d ",
- ab->jumps_width,
+ notes->widths.jumps,
al->jump_sources);
prev = ui_browser__set_jumps_percent_color(browser, al->jump_sources,
current_entry);
}
printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ",
- ab->target_width, addr);
+ notes->widths.target, addr);
} else {
printed = scnprintf(bf, sizeof(bf), "%*s ",
- ab->addr_width, " ");
+ notes->widths.addr, " ");
}
}
ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS);
__ui_browser__line_arrow(browser,
- pcnt_width + 2 + ab->addr_width + width,
+ pcnt_width + 2 + notes->widths.addr + width,
from, to);
if (is_fused(ab, cursor)) {
ui_browser__mark_fused(browser,
- pcnt_width + 3 + ab->addr_width + width,
+ pcnt_width + 3 + notes->widths.addr + width,
from - 1,
to > from ? true : false);
}
return __annotate_browser__search_reverse(browser);
}
-static void annotate_browser__update_addr_width(struct annotate_browser *browser)
+static void annotation__update_column_widths(struct annotation *notes)
{
- struct annotation *notes = browser__annotation(&browser->b);
-
if (notes->options->use_offset)
- browser->target_width = browser->min_addr_width;
+ notes->widths.target = notes->widths.min_addr;
else
- browser->target_width = browser->max_addr_width;
+ notes->widths.target = notes->widths.max_addr;
- browser->addr_width = browser->target_width;
+ notes->widths.addr = notes->widths.target;
if (notes->options->show_nr_jumps)
- browser->addr_width += browser->jumps_width + 1;
+ notes->widths.addr += notes->widths.jumps + 1;
}
static int annotate_browser__run(struct annotate_browser *browser,
continue;
case 'o':
notes->options->use_offset = !notes->options->use_offset;
- annotate_browser__update_addr_width(browser);
+ annotation__update_column_widths(notes);
continue;
case 'j':
notes->options->jump_arrows = !notes->options->jump_arrows;
continue;
case 'J':
notes->options->show_nr_jumps = !notes->options->show_nr_jumps;
- annotate_browser__update_addr_width(browser);
+ annotation__update_column_widths(notes);
continue;
case '/':
if (annotate_browser__search(browser, delay_secs)) {
notes->options->show_nr_samples = false;
else
notes->options->show_total_period = true;
- annotate_browser__update_addr_width(browser);
+ annotation__update_column_widths(notes);
continue;
case K_LEFT:
case K_ESC:
annotation__mark_jump_targets(notes, sym);
annotation__compute_ipc(notes, size);
- browser.addr_width = browser.target_width = browser.min_addr_width = hex_width(size);
- browser.max_addr_width = hex_width(sym->end);
- browser.jumps_width = width_jumps(notes->max_jump_sources);
+ notes->widths.addr = notes->widths.target = notes->widths.min_addr = hex_width(size);
+ notes->widths.max_addr = hex_width(sym->end);
+ notes->widths.jumps = width_jumps(notes->max_jump_sources);
notes->nr_events = nr_pcnt;
browser.b.nr_entries = notes->nr_entries;
browser.b.entries = ¬es->src->source,
if (notes->options->hide_src_code)
ui_browser__init_asm_mode(&browser.b);
- annotate_browser__update_addr_width(&browser);
+ annotation__update_column_widths(notes);
ret = annotate_browser__run(&browser, evsel, hbt);