tools/perf/ui/gtk/annotate.c
Source file repositories/reference/linux-study-clean/tools/perf/ui/gtk/annotate.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/ui/gtk/annotate.c- Extension
.c- Size
- 6666 bytes
- Lines
- 279
- 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
gtk.hutil/sort.hutil/debug.hutil/annotate.hutil/evlist.hutil/evsel.hutil/map.hutil/dso.hutil/symbol.hui/helpline.hinttypes.hsignal.h
Detected Declarations
function perf_gtk__get_percentfunction perf_gtk__get_offsetfunction perf_gtk__get_linefunction perf_gtk__annotate_symbolfunction list_for_each_entryfunction for_each_group_evselfunction list_for_each_entry_safefunction symbol__gtk_annotatefunction hist_entry__gtk_annotatefunction perf_gtk__show_annotations
Annotated Snippet
if (evsel__is_group_event(evsel)) {
struct evsel *cur_evsel;
for_each_group_evsel(cur_evsel, evsel__leader(evsel)) {
ret += perf_gtk__get_percent(s + ret,
sizeof(s) - ret,
sym, pos,
cur_evsel);
ret += scnprintf(s + ret, sizeof(s) - ret, " ");
}
} else {
ret = perf_gtk__get_percent(s, sizeof(s), sym, pos, evsel);
}
if (ret)
gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1);
if (perf_gtk__get_offset(s, sizeof(s), ms, pos))
gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1);
if (perf_gtk__get_line(s, sizeof(s), pos))
gtk_list_store_set(store, &iter, ANN_COL__LINE, s, -1);
}
gtk_container_add(GTK_CONTAINER(window), view);
list_for_each_entry_safe(pos, n, ¬es->src->source, al.node) {
list_del_init(&pos->al.node);
disasm_line__free(pos);
}
return 0;
}
static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
struct hist_browser_timer *hbt)
{
struct dso *dso = map__dso(ms->map);
struct symbol *sym = ms->sym;
GtkWidget *window;
GtkWidget *notebook;
GtkWidget *scrolled_window;
GtkWidget *tab_label;
int err;
if (dso__annotate_warned(dso))
return -1;
err = symbol__annotate(ms, evsel, NULL);
if (err) {
char msg[BUFSIZ];
dso__set_annotate_warned(dso);
symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
ui__error("Couldn't annotate %s: %s\n", sym->name, msg);
return -1;
}
symbol__calc_percent(sym, evsel);
if (perf_gtk__is_active_context(pgctx)) {
window = pgctx->main_window;
notebook = pgctx->notebook;
} else {
GtkWidget *vbox;
GtkWidget *infobar;
GtkWidget *statbar;
signal(SIGSEGV, perf_gtk__signal);
signal(SIGFPE, perf_gtk__signal);
signal(SIGINT, perf_gtk__signal);
signal(SIGQUIT, perf_gtk__signal);
signal(SIGTERM, perf_gtk__signal);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "perf annotate");
g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
pgctx = perf_gtk__activate_context(window);
if (!pgctx)
return -1;
vbox = gtk_vbox_new(FALSE, 0);
notebook = gtk_notebook_new();
pgctx->notebook = notebook;
gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
infobar = perf_gtk__setup_info_bar();
if (infobar) {
gtk_box_pack_start(GTK_BOX(vbox), infobar,
Annotation
- Immediate include surface: `gtk.h`, `util/sort.h`, `util/debug.h`, `util/annotate.h`, `util/evlist.h`, `util/evsel.h`, `util/map.h`, `util/dso.h`.
- Detected declarations: `function perf_gtk__get_percent`, `function perf_gtk__get_offset`, `function perf_gtk__get_line`, `function perf_gtk__annotate_symbol`, `function list_for_each_entry`, `function for_each_group_evsel`, `function list_for_each_entry_safe`, `function symbol__gtk_annotate`, `function hist_entry__gtk_annotate`, `function perf_gtk__show_annotations`.
- 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.