Lines Matching +full:up +full:- +full:samples

1 // SPDX-License-Identifier: GPL-2.0
3 * builtin-annotate.c
6 * look up and read DSOs and symbol information and display
25 #include <subcmd/parse-options.h>
26 #include "util/parse-events.h"
36 #include "util/block-range.h"
62 * * ----> *
66 * * ----> *
79 * @acme: once we parse the objdump output _before_ processing the samples,
86 struct symbol *sym = start->ms.sym; in process_basic_block()
94 if (!start->addr || start->addr > end->addr) in process_basic_block()
97 iter = block_range__create(start->addr, end->addr); in process_basic_block()
105 assert(entry->is_target); in process_basic_block()
106 entry->entry++; in process_basic_block()
111 entry->coverage++; in process_basic_block()
112 entry->sym = sym; in process_basic_block()
115 notes->max_coverage = max(notes->max_coverage, entry->coverage); in process_basic_block()
123 assert(entry->is_branch); in process_basic_block()
124 entry->taken++; in process_basic_block()
125 if (flags->predicted) in process_basic_block()
126 entry->pred++; in process_basic_block()
136 if (!bs || !bs->nr) in process_branch_stack()
143 for (i = bs->nr - 1; i >= 0; i--) { in process_branch_stack()
160 struct hist_entry *he = iter->he; in hist_iter__branch_callback()
162 struct perf_sample *sample = iter->sample; in hist_iter__branch_callback()
163 struct evsel *evsel = iter->evsel; in hist_iter__branch_callback()
166 bi = he->branch_info; in hist_iter__branch_callback()
167 err = addr_map_symbol__inc_samples(&bi->from, sample, evsel); in hist_iter__branch_callback()
172 err = addr_map_symbol__inc_samples(&bi->to, sample, evsel); in hist_iter__branch_callback()
196 return -1; in process_branch_callback()
202 a.map->dso->hit = 1; in process_branch_callback()
204 hist__account_cycles(sample->branch_stack, al, sample, false, NULL); in process_branch_callback()
212 return ui__has_annotation() || ann->use_stdio2; in has_annotation()
223 if ((!ann->has_br_stack || !has_annotation(ann)) && in evsel__add_sample()
224 ann->sym_hist_filter != NULL && in evsel__add_sample()
225 (al->sym == NULL || in evsel__add_sample()
226 strcmp(ann->sym_hist_filter, al->sym->name) != 0)) { in evsel__add_sample()
232 if (al->sym != NULL) { in evsel__add_sample()
233 rb_erase_cached(&al->sym->rb_node, in evsel__add_sample()
234 &al->map->dso->symbols); in evsel__add_sample()
235 symbol__delete(al->sym); in evsel__add_sample()
236 dso__reset_find_symbol_cache(al->map->dso); in evsel__add_sample()
242 * XXX filtered samples can still have branch entires pointing into our in evsel__add_sample()
245 process_branch_stack(sample->branch_stack, al, sample); in evsel__add_sample()
247 if (ann->has_br_stack && has_annotation(ann)) in evsel__add_sample()
252 return -ENOMEM; in evsel__add_sample()
254 ret = hist_entry__inc_addr_samples(he, sample, evsel, al->addr); in evsel__add_sample()
271 event->header.type); in process_sample_event()
272 return -1; in process_sample_event()
275 if (ann->cpu_list && !test_bit(sample->cpu, ann->cpu_bitmap)) in process_sample_event()
282 ret = -1; in process_sample_event()
292 if (event->feat.feat_id < HEADER_LAST_FEATURE) in process_feature_event()
301 if (!ann->use_stdio2) in hist_entry__tty_annotate()
302 return symbol__tty_annotate(&he->ms, evsel, &ann->opts); in hist_entry__tty_annotate()
304 return symbol__tty_annotate2(&he->ms, evsel, &ann->opts); in hist_entry__tty_annotate()
311 struct rb_node *nd = rb_first_cached(&hists->entries), *next; in hists__find_annotations()
318 if (he->ms.sym == NULL || he->ms.map->dso->annotate_warned) in hists__find_annotations()
321 if (ann->sym_hist_filter && in hists__find_annotations()
322 (strcmp(he->ms.sym->name, ann->sym_hist_filter) != 0)) in hists__find_annotations()
325 notes = symbol__annotation(he->ms.sym); in hists__find_annotations()
326 if (notes->src == NULL) { in hists__find_annotations()
349 if (!ret || !ann->skip_missing) in hists__find_annotations()
355 key = hist_entry__tui_annotate(he, evsel, NULL, &ann->opts); in hists__find_annotations()
358 case -1: in hists__find_annotations()
359 if (!ann->skip_missing) in hists__find_annotations()
379 * symbol, free he->ms.sym->src to signal we already in hists__find_annotations()
382 zfree(&notes->src->cycles_hist); in hists__find_annotations()
383 zfree(&notes->src); in hists__find_annotations()
391 struct perf_session *session = ann->session; in __cmd_annotate()
395 if (ann->cpu_list) { in __cmd_annotate()
396 ret = perf_session__cpu_bitmap(session, ann->cpu_list, in __cmd_annotate()
397 ann->cpu_bitmap); in __cmd_annotate()
402 if (!ann->opts.objdump_path) { in __cmd_annotate()
403 ret = perf_env__lookup_objdump(&session->header.env, in __cmd_annotate()
404 &ann->opts.objdump_path); in __cmd_annotate()
415 perf_evlist__fprintf_nr_events(session->evlist, stdout); in __cmd_annotate()
426 evlist__for_each_entry(session->evlist, pos) { in __cmd_annotate()
428 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; in __cmd_annotate()
445 ui__error("The %s data has no samples!\n", session->data->path); in __cmd_annotate()
504 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, in cmd_annotate()
510 OPT_BOOLEAN(0, "ignore-vmlinux", &symbol_conf.ignore_vmlinux, in cmd_annotate()
515 "load module symbols - WARNING: use only with -k and LIVE kernel"), in cmd_annotate()
516 OPT_BOOLEAN('l', "print-line", &annotate.opts.print_lines, in cmd_annotate()
518 OPT_BOOLEAN('P', "full-paths", &annotate.opts.full_path, in cmd_annotate()
520 OPT_BOOLEAN(0, "skip-missing", &annotate.skip_missing, in cmd_annotate()
531 OPT_BOOLEAN(0, "asm-raw", &annotate.opts.show_asm_raw, in cmd_annotate()
533 OPT_STRING('M', "disassembler-style", &annotate.opts.disassembler_style, "disassembler style", in cmd_annotate()
534 "Specify disassembler style (e.g. -M intel for intel syntax)"), in cmd_annotate()
536 "Add prefix to source file path names in programs (with --prefix-strip)"), in cmd_annotate()
537 OPT_STRING(0, "prefix-strip", &annotate.opts.prefix_strip, "N", in cmd_annotate()
538 "Strip first N entries of source file path name in programs (with --prefix)"), in cmd_annotate()
543 OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, in cmd_annotate()
545 OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, in cmd_annotate()
546 "Show a column with the number of samples"), in cmd_annotate()
547 OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", in cmd_annotate()
548 "'always' (default), 'never' or 'auto' only applicable to --stdio mode", in cmd_annotate()
550 OPT_CALLBACK(0, "percent-type", &annotate.opts, "local-period", in cmd_annotate()
551 "Set percent type local/global-period/hits", in cmd_annotate()
558 set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE); in cmd_annotate()
559 set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE); in cmd_annotate()
581 return -EINVAL; in cmd_annotate()
584 pr_err("--show-nr-samples is not available in --gtk mode at this time\n"); in cmd_annotate()
597 annotate.has_br_stack = perf_header__has_feat(&annotate.session->header, in cmd_annotate()
601 perf_evlist__force_leader(annotate.session->evlist); in cmd_annotate()
609 ret = symbol__init(&annotate.session->header.env); in cmd_annotate()
624 if (setup_sorting(annotate.session->evlist) < 0) in cmd_annotate()
635 * Speed up the exit process, for large files this can in cmd_annotate()
642 * up we'll get here. in cmd_annotate()