12 #include <linux/list.h>
14 #include <linux/rbtree.h>
32 #include <linux/bitmap.h>
45 static int perf_evsel__add_sample(
struct perf_evsel *evsel,
59 &al->
map->dso->symbols[al->
map->type]);
71 struct annotation *notes = symbol__annotation(he->
ms.sym);
83 static int process_sample_event(
struct perf_tool *tool,
94 pr_warning(
"problem processing %d event, skipping it.\n",
102 if (!al.
filtered && perf_evsel__add_sample(evsel, sample, &al, ann)) {
103 pr_warning(
"problem incrementing symbol count, "
111 static int hist_entry__tty_annotate(
struct hist_entry *he,
int evidx,
118 static void hists__find_annotations(
struct hists *
self,
int evidx,
128 if (he->
ms.sym ==
NULL || he->
ms.map->dso->annotate_warned)
131 notes = symbol__annotation(he->
ms.sym);
157 hist_entry__tty_annotate(he, evidx, ann);
175 u64 total_nr_samples;
204 total_nr_samples = 0;
209 if (nr_samples > 0) {
210 total_nr_samples += nr_samples;
213 hists__find_annotations(hists, pos->
idx, ann);
217 if (total_nr_samples == 0) {
237 static const char *
const annotate_usage[] = {
238 "perf annotate [<options>]",
246 .sample = process_sample_event,
250 .ordered_samples =
true,
251 .ordering_requires_timestamps =
true,
254 const struct option options[] = {
258 "only consider symbols in these dsos"),
260 "symbol to annotate"),
263 "be more verbose (show symbol address, etc)"),
265 "dump raw trace in ASCII"),
269 "file",
"vmlinux pathname"),
271 "load module symbols - WARNING: use only with -k and LIVE kernel"),
273 "print matching source lines (may be slow)"),
275 "Don't shorten the displayed pathnames"),
278 "Look for files with symbols relative to this directory"),
280 "Interleave source code with assembly code (default)"),
282 "Display raw encoding of assembly instructions (default)"),
284 "Specify disassembler style (e.g. -M intel for intel syntax)"),
286 "objdump binary to use for disassembly and annotations"),
290 argc =
parse_options(argc, argv, options, annotate_usage, 0);
318 return __cmd_annotate(&annotate);