tools/perf/ui/browsers/annotate.c
Source file repositories/reference/linux-study-clean/tools/perf/ui/browsers/annotate.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/ui/browsers/annotate.c- Extension
.c- Size
- 35106 bytes
- Lines
- 1270
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../browser.h../helpline.h../ui.h../../util/annotate.h../../util/debug.h../../util/debuginfo.h../../util/dso.h../../util/hashmap.h../../util/hist.h../../util/sort.h../../util/map.h../../util/mutex.h../../util/symbol.h../../util/evsel.h../../util/evlist.h../../util/thread.hinttypes.hlinux/err.hlinux/kernel.hlinux/string.hlinux/zalloc.hsys/ttydefaults.hasm/bug.h
Detected Declarations
struct archstruct annotate_browserfunction type_hashfunction type_equalfunction disasm_line__filterfunction ui_browser__jumps_percent_colorfunction ui_browser__set_jumps_percent_colorfunction annotate_browser__set_colorfunction annotate_browser__write_graphfunction annotate_browser__set_percent_colorfunction annotate_browser__printffunction annotate_browser__writefunction is_fusedfunction annotate_browser__draw_current_jumpfunction annotate_browser__refreshfunction disasm__cmpfunction disasm_rb_tree__insertfunction annotate_browser__set_topfunction annotate_browser__set_rb_topfunction annotate_browser__calc_percentfunction list_for_each_entryfunction annotation__has_sourcefunction annotate_browser__toggle_sourcefunction annotate_browser__show_full_locationfunction ui_browser__init_asm_modefunction sym_titlefunction annotate_browser__show_function_titlefunction swapgs_restore_regs_and_return_to_usermodefunction annotate_browser__jumpfunction __annotate_browser__searchfunction __annotate_browser__search_reversefunction annotate_browser__search_windowfunction annotate_browser__searchfunction annotate_browser__continue_searchfunction annotate_browser__search_reversefunction annotate_browser__continue_search_reversefunction annotate_browser__showfunction switch_percent_typefunction annotate__scnprintf_titlefunction annotate_browser__debuginfo_warningfunction annotate_browser__curr_hot_offsetfunction annotate_browser__symbol_annotate_errorfunction annotate_browser__runfunction hist_entry__tui_annotatefunction __hist_entry__tui_annotate
Annotated Snippet
struct annotate_browser {
struct ui_browser b;
struct rb_root entries;
struct rb_node *curr_hot;
struct annotation_line *selection;
const struct arch *arch;
/*
* perf top can delete hist_entry anytime. Callers should make sure
* its lifetime.
*/
struct hist_entry *he;
struct debuginfo *dbg;
struct evsel *evsel;
struct hashmap *type_hash;
bool searching_backwards;
char search_bf[128];
};
/* A copy of target hist_entry for perf top. */
static struct hist_entry annotate_he;
static size_t type_hash(long key, void *ctx __maybe_unused)
{
return key;
}
static bool type_equal(long key1, long key2, void *ctx __maybe_unused)
{
return key1 == key2;
}
static inline struct annotation *browser__annotation(struct ui_browser *browser)
{
struct map_symbol *ms = browser->priv;
return symbol__annotation(ms->sym);
}
static bool disasm_line__filter(struct ui_browser *browser __maybe_unused, void *entry)
{
struct annotation_line *al = list_entry(entry, struct annotation_line, node);
return annotation_line__filter(al);
}
static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, bool current)
{
struct annotation *notes = browser__annotation(browser);
if (current && (!browser->use_navkeypressed || browser->navkeypressed))
return HE_COLORSET_SELECTED;
if (nr == notes->src->max_jump_sources)
return HE_COLORSET_TOP;
if (nr > 1)
return HE_COLORSET_MEDIUM;
return HE_COLORSET_NORMAL;
}
static int ui_browser__set_jumps_percent_color(void *browser, int nr, bool current)
{
int color = ui_browser__jumps_percent_color(browser, nr, current);
return ui_browser__set_color(browser, color);
}
static int annotate_browser__set_color(void *browser, int color)
{
return ui_browser__set_color(browser, color);
}
static void annotate_browser__write_graph(void *browser, int graph)
{
ui_browser__write_graph(browser, graph);
}
static void annotate_browser__set_percent_color(void *browser, double percent, bool current)
{
ui_browser__set_percent_color(browser, percent, current);
}
static void annotate_browser__printf(void *browser, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
ui_browser__vprintf(browser, fmt, args);
va_end(args);
}
static void annotate_browser__write(struct ui_browser *browser, void *entry, int row)
{
struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
struct annotation *notes = browser__annotation(browser);
Annotation
- Immediate include surface: `../browser.h`, `../helpline.h`, `../ui.h`, `../../util/annotate.h`, `../../util/debug.h`, `../../util/debuginfo.h`, `../../util/dso.h`, `../../util/hashmap.h`.
- Detected declarations: `struct arch`, `struct annotate_browser`, `function type_hash`, `function type_equal`, `function disasm_line__filter`, `function ui_browser__jumps_percent_color`, `function ui_browser__set_jumps_percent_color`, `function annotate_browser__set_color`, `function annotate_browser__write_graph`, `function annotate_browser__set_percent_color`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.