tools/perf/ui/browser.c
Source file repositories/reference/linux-study-clean/tools/perf/ui/browser.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/ui/browser.c- Extension
.c- Size
- 18875 bytes
- Lines
- 826
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../util/string2.h../util/config.hlibslang.hui.hutil.hlinux/compiler.hlinux/list.hlinux/rbtree.hlinux/string.hstdlib.hsys/ttydefaults.hbrowser.hhelpline.hkeysyms.h../util/color.hlinux/ctype.hlinux/zalloc.h
Detected Declarations
function ui_browser__percent_colorfunction ui_browser__set_colorfunction ui_browser__set_percent_colorfunction ui_browser__gotorc_titlefunction ui_browser__gotorcfunction ui_browser__write_nstringfunction ui_browser__vprintffunction ui_browser__printffunction ui_browser__list_head_filter_entriesfunction ui_browser__list_head_filter_prev_entriesfunction ui_browser__list_head_seekfunction ui_browser__rb_tree_seekfunction ui_browser__rb_tree_refreshfunction ui_browser__is_current_entryfunction ui_browser__refresh_dimensionsfunction ui_browser__handle_resizefunction ui_browser__warningfunction ui_browser__warn_unhandled_hotkeyfunction ui_browser__help_windowfunction ui_browser__dialog_yesnofunction ui_browser__reset_indexfunction __ui_browser__show_titlefunction ui_browser__show_titlefunction ui_browser__showfunction ui_browser__hidefunction ui_browser__scrollbar_setfunction __ui_browser__refreshfunction ui_browser__refreshfunction ui_browser__update_nr_entriesfunction ui_browser__runfunction ui_browser__list_head_refreshfunction list_for_each_fromfunction ui_browser__color_configfunction ui_browser__argv_seekfunction ui_browser__argv_refreshfunction __ui_browser__vlinefunction ui_browser__write_graphfunction __ui_browser__line_arrow_upfunction __ui_browser__line_arrow_downfunction __ui_browser__line_arrowfunction ui_browser__mark_fusedfunction ui_browser__init
Annotated Snippet
if (key == K_RESIZE) {
ui__refresh_dimensions(false);
browser->refresh_dimensions(browser);
__ui_browser__show_title(browser, browser->title);
ui_helpline__puts(browser->helpline);
continue;
}
if (browser->use_navkeypressed && !browser->navkeypressed) {
if (key == K_DOWN || key == K_UP ||
(browser->columns && (key == K_LEFT || key == K_RIGHT)) ||
key == K_PGDN || key == K_PGUP ||
key == K_HOME || key == K_END ||
key == ' ') {
browser->navkeypressed = true;
continue;
} else
return key;
}
switch (key) {
case K_DOWN:
if (browser->index == browser->nr_entries - 1)
break;
++browser->index;
if (browser->index == browser->top_idx + browser->rows) {
++browser->top_idx;
browser->seek(browser, +1, SEEK_CUR);
}
break;
case K_UP:
if (browser->index == 0)
break;
--browser->index;
if (browser->index < browser->top_idx) {
--browser->top_idx;
browser->seek(browser, -1, SEEK_CUR);
}
break;
case K_RIGHT:
if (!browser->columns)
goto out;
if (browser->horiz_scroll < browser->columns - 1)
++browser->horiz_scroll;
break;
case K_LEFT:
if (!browser->columns)
goto out;
if (browser->horiz_scroll != 0)
--browser->horiz_scroll;
else
goto out;
break;
case K_PGDN:
case ' ':
if (browser->top_idx + browser->rows > browser->nr_entries - 1)
break;
offset = browser->rows;
if (browser->index + offset > browser->nr_entries - 1)
offset = browser->nr_entries - 1 - browser->index;
browser->index += offset;
browser->top_idx += offset;
browser->seek(browser, +offset, SEEK_CUR);
break;
case K_PGUP:
if (browser->top_idx == 0)
break;
if (browser->top_idx < browser->rows)
offset = browser->top_idx;
else
offset = browser->rows;
browser->index -= offset;
browser->top_idx -= offset;
browser->seek(browser, -offset, SEEK_CUR);
break;
case K_HOME:
ui_browser__reset_index(browser);
break;
case K_END:
offset = browser->rows - 1;
if (offset >= browser->nr_entries)
offset = browser->nr_entries - 1;
browser->index = browser->nr_entries - 1;
browser->top_idx = browser->index - offset;
browser->seek(browser, -offset, SEEK_END);
break;
Annotation
- Immediate include surface: `../util/string2.h`, `../util/config.h`, `libslang.h`, `ui.h`, `util.h`, `linux/compiler.h`, `linux/list.h`, `linux/rbtree.h`.
- Detected declarations: `function ui_browser__percent_color`, `function ui_browser__set_color`, `function ui_browser__set_percent_color`, `function ui_browser__gotorc_title`, `function ui_browser__gotorc`, `function ui_browser__write_nstring`, `function ui_browser__vprintf`, `function ui_browser__printf`, `function ui_browser__list_head_filter_entries`, `function ui_browser__list_head_filter_prev_entries`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.