Lines Matching +full:report +full:- +full:error
1 // SPDX-License-Identifier: GPL-2.0
3 * builtin-report.c
5 * Builtin report command: Analyze the perf.data input file,
23 #include "util/mem-events.h"
38 #include <subcmd/parse-options.h>
39 #include <subcmd/exec-cmd.h>
40 #include "util/parse-events.h"
47 #include "util/time-utils.h"
53 #include "util/block-info.h"
70 struct report { struct
112 struct report *rep = cb; in report__config() argument
114 if (!strcmp(var, "report.group")) { in report__config()
118 if (!strcmp(var, "report.percent-limit")) { in report__config()
121 rep->min_percent = pcnt; in report__config()
125 if (!strcmp(var, "report.children")) { in report__config()
129 if (!strcmp(var, "report.queue-size")) in report__config()
130 return perf_config_u64(&rep->queue_size, var, value); in report__config()
132 if (!strcmp(var, "report.sort_order")) { in report__config()
145 struct report *rep = arg; in hist_iter__report_callback()
146 struct hist_entry *he = iter->he; in hist_iter__report_callback()
147 struct evsel *evsel = iter->evsel; in hist_iter__report_callback()
148 struct perf_sample *sample = iter->sample; in hist_iter__report_callback()
152 if (!ui__has_annotation() && !rep->symbol_ipc) in hist_iter__report_callback()
156 bi = he->branch_info; in hist_iter__report_callback()
157 err = addr_map_symbol__inc_samples(&bi->from, sample, evsel); in hist_iter__report_callback()
161 err = addr_map_symbol__inc_samples(&bi->to, sample, evsel); in hist_iter__report_callback()
163 } else if (rep->mem_mode) { in hist_iter__report_callback()
164 mi = he->mem_info; in hist_iter__report_callback()
165 err = addr_map_symbol__inc_samples(&mi->daddr, sample, evsel); in hist_iter__report_callback()
169 err = hist_entry__inc_addr_samples(he, sample, evsel, al->addr); in hist_iter__report_callback()
173 err = hist_entry__inc_addr_samples(he, sample, evsel, al->addr); in hist_iter__report_callback()
175 err = hist_entry__inc_addr_samples(he, sample, evsel, al->addr); in hist_iter__report_callback()
187 struct hist_entry *he = iter->he; in hist_iter__branch_callback()
188 struct report *rep = arg; in hist_iter__branch_callback()
189 struct branch_info *bi = he->branch_info; in hist_iter__branch_callback()
190 struct perf_sample *sample = iter->sample; in hist_iter__branch_callback()
191 struct evsel *evsel = iter->evsel; in hist_iter__branch_callback()
194 branch_type_count(&rep->brtype_stat, &bi->flags, in hist_iter__branch_callback()
195 bi->from.addr, bi->to.addr); in hist_iter__branch_callback()
197 if (!ui__has_annotation() && !rep->symbol_ipc) in hist_iter__branch_callback()
200 err = addr_map_symbol__inc_samples(&bi->from, sample, evsel); in hist_iter__branch_callback()
204 err = addr_map_symbol__inc_samples(&bi->to, sample, evsel); in hist_iter__branch_callback()
210 static void setup_forced_leader(struct report *report, in setup_forced_leader() argument
213 if (report->group_set) in setup_forced_leader()
220 struct report *rep = container_of(session->tool, struct report, tool); in process_feature_event()
222 if (event->feat.feat_id < HEADER_LAST_FEATURE) in process_feature_event()
225 if (event->feat.feat_id != HEADER_LAST_FEATURE) { in process_feature_event()
227 event->feat.feat_id); in process_feature_event()
228 return -1; in process_feature_event()
236 setup_forced_leader(rep, session->evlist); in process_feature_event()
246 struct report *rep = container_of(tool, struct report, tool); in process_sample_event()
256 if (perf_time__ranges_skip_sample(rep->ptime_range, rep->range_num, in process_sample_event()
257 sample->time)) { in process_sample_event()
261 if (evswitch__discard(&rep->evswitch, evsel)) in process_sample_event()
266 event->header.type); in process_sample_event()
267 return -1; in process_sample_event()
270 if (rep->stitch_lbr) in process_sample_event()
271 al.thread->lbr_stitch_enable = true; in process_sample_event()
276 if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) in process_sample_event()
281 * A non-synthesized event might not have a branch stack if in process_sample_event()
284 if (!sample->branch_stack) in process_sample_event()
289 } else if (rep->mem_mode) { in process_sample_event()
298 al.map->dso->hit = 1; in process_sample_event()
300 if (ui__has_annotation() || rep->symbol_ipc || rep->total_cycles_mode) { in process_sample_event()
301 hist__account_cycles(sample->branch_stack, &al, sample, in process_sample_event()
302 rep->nonany_branch_mode, in process_sample_event()
303 &rep->total_cycles); in process_sample_event()
306 ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep); in process_sample_event()
320 struct report *rep = container_of(tool, struct report, tool); in process_read_event()
322 if (rep->show_threads) { in process_read_event()
324 int err = perf_read_values_add_value(&rep->show_threads_values, in process_read_event()
325 event->read.pid, event->read.tid, in process_read_event()
326 evsel->idx, in process_read_event()
328 event->read.value); in process_read_event()
338 static int report__setup_sample_type(struct report *rep) in report__setup_sample_type()
340 struct perf_session *session = rep->session; in report__setup_sample_type()
341 u64 sample_type = evlist__combined_sample_type(session->evlist); in report__setup_sample_type()
342 bool is_pipe = perf_data__is_pipe(session->data); in report__setup_sample_type()
345 if (session->itrace_synth_opts->callchain || in report__setup_sample_type()
346 session->itrace_synth_opts->add_callchain || in report__setup_sample_type()
348 perf_header__has_feat(&session->header, HEADER_AUXTRACE) && in report__setup_sample_type()
349 !session->itrace_synth_opts->set)) in report__setup_sample_type()
352 if (session->itrace_synth_opts->last_branch || in report__setup_sample_type()
353 session->itrace_synth_opts->add_last_branch) in report__setup_sample_type()
358 ui__error("Selected --sort parent, but no " in report__setup_sample_type()
360 "'perf record' without -g?\n"); in report__setup_sample_type()
361 return -EINVAL; in report__setup_sample_type()
365 ui__error("Selected -g or --branch-history.\n" in report__setup_sample_type()
367 "Did you call 'perf record' without -g or -b?\n"); in report__setup_sample_type()
368 return -1; in report__setup_sample_type()
376 return -EINVAL; in report__setup_sample_type()
391 ui__error("Selected -b but no branch data. " in report__setup_sample_type()
392 "Did you call perf record without -b?\n"); in report__setup_sample_type()
393 return -1; in report__setup_sample_type()
403 evlist__for_each_entry(session->evlist, evsel) { in report__setup_sample_type()
404 if (strstr(evsel->name, "arm_spe") && in report__setup_sample_type()
406 evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC; in report__setup_sample_type()
412 ui__error("Selected --mem-mode but no mem data. " in report__setup_sample_type()
413 "Did you call perf record without -d?\n"); in report__setup_sample_type()
414 return -1; in report__setup_sample_type()
420 if (rep->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) { in report__setup_sample_type()
421 ui__warning("Can't find LBR callchain. Switch off --stitch-lbr.\n" in report__setup_sample_type()
422 "Please apply --call-graph lbr when recording.\n"); in report__setup_sample_type()
423 rep->stitch_lbr = false; in report__setup_sample_type()
427 if (!(evlist__combined_branch_type(session->evlist) & PERF_SAMPLE_BRANCH_ANY)) in report__setup_sample_type()
428 rep->nonany_branch_mode = true; in report__setup_sample_type()
445 static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report *rep, in hists__fprintf_nr_sample_events()
450 unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; in hists__fprintf_nr_sample_events()
451 u64 nr_events = hists->stats.total_period; in hists__fprintf_nr_sample_events()
455 int socked_id = hists->socket_filter; in hists__fprintf_nr_sample_events()
461 nr_samples = hists->stats.nr_non_filtered_samples; in hists__fprintf_nr_sample_events()
462 nr_events = hists->stats.total_non_filtered_period; in hists__fprintf_nr_sample_events()
475 nr_samples += pos_hists->stats.nr_non_filtered_samples; in hists__fprintf_nr_sample_events()
476 nr_events += pos_hists->stats.total_non_filtered_period; in hists__fprintf_nr_sample_events()
478 nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE]; in hists__fprintf_nr_sample_events()
479 nr_events += pos_hists->stats.total_period; in hists__fprintf_nr_sample_events()
488 evsel->core.nr_members > 1 ? "s" : "", evname); in hists__fprintf_nr_sample_events()
491 if (rep->time_str) in hists__fprintf_nr_sample_events()
492 ret += fprintf(fp, " (time slices: %s)", rep->time_str); in hists__fprintf_nr_sample_events()
494 if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) { in hists__fprintf_nr_sample_events()
498 if (rep->mem_mode) { in hists__fprintf_nr_sample_events()
504 if (socked_id > -1) in hists__fprintf_nr_sample_events()
511 struct report *rep) in perf_evlist__tui_block_hists_browse()
517 ret = report__browse_block_hists(&rep->block_reports[i++].hist, in perf_evlist__tui_block_hists_browse()
518 rep->min_percent, pos, in perf_evlist__tui_block_hists_browse()
519 &rep->session->header.env, in perf_evlist__tui_block_hists_browse()
520 &rep->annotation_opts); in perf_evlist__tui_block_hists_browse()
529 struct report *rep, in perf_evlist__tty_browse_hists()
537 evlist->stats.total_lost_samples); in perf_evlist__tty_browse_hists()
549 if (rep->total_cycles_mode) { in perf_evlist__tty_browse_hists()
550 report__browse_block_hists(&rep->block_reports[i++].hist, in perf_evlist__tty_browse_hists()
551 rep->min_percent, pos, in perf_evlist__tty_browse_hists()
556 hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout, in perf_evlist__tty_browse_hists()
565 if (rep->show_threads) { in perf_evlist__tty_browse_hists()
566 bool style = !strcmp(rep->pretty_printing_style, "raw"); in perf_evlist__tty_browse_hists()
567 perf_read_values_display(stdout, &rep->show_threads_values, in perf_evlist__tty_browse_hists()
569 perf_read_values_destroy(&rep->show_threads_values); in perf_evlist__tty_browse_hists()
573 branch_type_stat_display(stdout, &rep->brtype_stat); in perf_evlist__tty_browse_hists()
578 static void report__warn_kptr_restrict(const struct report *rep) in report__warn_kptr_restrict()
580 struct map *kernel_map = machine__kernel_map(&rep->session->machines.host); in report__warn_kptr_restrict()
583 if (perf_evlist__exclude_kernel(rep->session->evlist)) in report__warn_kptr_restrict()
587 (kernel_map->dso->hit && in report__warn_kptr_restrict()
588 (kernel_kmap->ref_reloc_sym == NULL || in report__warn_kptr_restrict()
589 kernel_kmap->ref_reloc_sym->addr == 0))) { in report__warn_kptr_restrict()
607 static int report__gtk_browse_hists(struct report *rep, const char *help) in report__gtk_browse_hists()
616 return -1; in report__gtk_browse_hists()
619 return hist_browser(rep->session->evlist, help, NULL, rep->min_percent); in report__gtk_browse_hists()
622 static int report__browse_hists(struct report *rep) in report__browse_hists()
625 struct perf_session *session = rep->session; in report__browse_hists()
626 struct evlist *evlist = session->evlist; in report__browse_hists()
631 /* fallback for people who don't install perf ;-) */ in report__browse_hists()
641 if (rep->total_cycles_mode) { in report__browse_hists()
647 rep->min_percent, in report__browse_hists()
648 &session->header.env, in report__browse_hists()
649 true, &rep->annotation_opts); in report__browse_hists()
668 static int report__collapse_hists(struct report *rep) in report__collapse_hists()
674 ui_progress__init(&prog, rep->nr_entries, "Merging related events..."); in report__collapse_hists()
676 evlist__for_each_entry(rep->session->evlist, pos) { in report__collapse_hists()
679 if (pos->idx == 0) in report__collapse_hists()
680 hists->symbol_filter_str = rep->symbol_filter_str; in report__collapse_hists()
682 hists->socket_filter = rep->socket_filter; in report__collapse_hists()
688 /* Non-group events are considered as leader */ in report__collapse_hists()
690 struct hists *leader_hists = evsel__hists(pos->leader); in report__collapse_hists()
703 struct report *rep = arg; in hists__resort_cb()
704 struct symbol *sym = he->ms.sym; in hists__resort_cb()
706 if (rep->symbol_ipc && sym && !sym->annotate2) { in hists__resort_cb()
707 struct evsel *evsel = hists_to_evsel(he->hists); in hists__resort_cb()
709 symbol__annotate2(&he->ms, evsel, in hists__resort_cb()
716 static void report__output_resort(struct report *rep) in report__output_resort()
721 ui_progress__init(&prog, rep->nr_entries, "Sorting events for output..."); in report__output_resort()
723 evlist__for_each_entry(rep->session->evlist, pos) { in report__output_resort()
730 static void stats_setup(struct report *rep) in stats_setup()
732 memset(&rep->tool, 0, sizeof(rep->tool)); in stats_setup()
733 rep->tool.no_warn = true; in stats_setup()
736 static int stats_print(struct report *rep) in stats_print()
738 struct perf_session *session = rep->session; in stats_print()
744 static void tasks_setup(struct report *rep) in tasks_setup()
746 memset(&rep->tool, 0, sizeof(rep->tool)); in tasks_setup()
747 rep->tool.ordered_events = true; in tasks_setup()
748 if (rep->mmaps_mode) { in tasks_setup()
749 rep->tool.mmap = perf_event__process_mmap; in tasks_setup()
750 rep->tool.mmap2 = perf_event__process_mmap2; in tasks_setup()
752 rep->tool.comm = perf_event__process_comm; in tasks_setup()
753 rep->tool.exit = perf_event__process_exit; in tasks_setup()
754 rep->tool.fork = perf_event__process_fork; in tasks_setup()
755 rep->tool.no_warn = true; in tasks_setup()
766 struct thread *parent_thread, *thread = task->thread; in tasks_list()
770 if (!list_empty(&task->list)) in tasks_list()
774 if (thread->ppid == -1) in tasks_list()
777 parent_thread = machine__find_thread(machine, -1, thread->ppid); in tasks_list()
779 return ERR_PTR(-ENOENT); in tasks_list()
782 list_add_tail(&task->list, &parent_task->children); in tasks_list()
792 printed += fprintf(fp, "%*s %" PRIx64 "-%" PRIx64 " %c%c%c%c %08" PRIx64 " %" PRIu64 " %s\n", in maps__fprintf_task()
793 indent, "", map->start, map->end, in maps__fprintf_task()
794 map->prot & PROT_READ ? 'r' : '-', in maps__fprintf_task()
795 map->prot & PROT_WRITE ? 'w' : '-', in maps__fprintf_task()
796 map->prot & PROT_EXEC ? 'x' : '-', in maps__fprintf_task()
797 map->flags & MAP_SHARED ? 's' : 'p', in maps__fprintf_task()
798 map->pgoff, in maps__fprintf_task()
799 map->dso->id.ino, map->dso->name); in maps__fprintf_task()
807 struct thread *thread = task->thread; in task__print_level()
810 thread->pid_, thread->tid, thread->ppid, in task__print_level()
815 maps__fprintf_task(thread->maps, comm_indent, fp); in task__print_level()
817 if (!list_empty(&task->children)) { in task__print_level()
818 list_for_each_entry(child, &task->children, list) in task__print_level()
823 static int tasks_print(struct report *rep, FILE *fp) in tasks_print()
825 struct perf_session *session = rep->session; in tasks_print()
826 struct machine *machine = &session->machines.host; in tasks_print()
833 * No locking needed while accessing machine->threads, in tasks_print()
834 * because --tasks is single threaded command. in tasks_print()
839 nr += machine->threads[i].nr; in tasks_print()
843 return -ENOMEM; in tasks_print()
846 struct threads *threads = &machine->threads[i]; in tasks_print()
848 for (nd = rb_first_cached(&threads->entries); nd; in tasks_print()
852 task->thread = rb_entry(nd, struct thread, rb_node); in tasks_print()
853 INIT_LIST_HEAD(&task->children); in tasks_print()
854 INIT_LIST_HEAD(&task->list); in tasks_print()
855 thread__set_priv(task->thread, task); in tasks_print()
867 if (!list_empty(&task->list)) in tasks_print()
872 pr_err("Error: failed to process tasks\n"); in tasks_print()
878 list_add_tail(&task->list, &list); in tasks_print()
890 static int __cmd_report(struct report *rep) in __cmd_report()
893 struct perf_session *session = rep->session; in __cmd_report()
895 struct perf_data *data = session->data; in __cmd_report()
899 if (rep->cpu_list) { in __cmd_report()
900 ret = perf_session__cpu_bitmap(session, rep->cpu_list, in __cmd_report()
901 rep->cpu_bitmap); in __cmd_report()
906 session->itrace_synth_opts->cpu_bitmap = rep->cpu_bitmap; in __cmd_report()
909 if (rep->show_threads) { in __cmd_report()
910 ret = perf_read_values_init(&rep->show_threads_values); in __cmd_report()
917 /* report__setup_sample_type() already showed error message */ in __cmd_report()
921 if (rep->stats_mode) in __cmd_report()
924 if (rep->tasks_mode) in __cmd_report()
933 if (rep->stats_mode) in __cmd_report()
936 if (rep->tasks_mode) in __cmd_report()
941 evlist__for_each_entry(session->evlist, pos) in __cmd_report()
942 rep->nr_entries += evsel__hists(pos)->nr_entries; in __cmd_report()
953 perf_evlist__fprintf_nr_events(session->evlist, stdout); in __cmd_report()
971 rep->nr_entries = 0; in __cmd_report()
972 evlist__for_each_entry(session->evlist, pos) in __cmd_report()
973 rep->nr_entries += evsel__hists(pos)->nr_entries; in __cmd_report()
975 if (rep->nr_entries == 0) { in __cmd_report()
976 ui__error("The %s data has no samples!\n", data->path); in __cmd_report()
982 if (rep->total_cycles_mode) { in __cmd_report()
992 rep->block_reports = block_info__create_report(session->evlist, in __cmd_report()
993 rep->total_cycles, in __cmd_report()
995 &rep->nr_block_reports); in __cmd_report()
996 if (!rep->block_reports) in __cmd_report()
997 return -1; in __cmd_report()
1006 struct callchain_param *callchain = opt->value; in report_parse_callchain_opt()
1008 callchain->enabled = !unset; in report_parse_callchain_opt()
1010 * --no-call-graph in report_parse_callchain_opt()
1014 callchain->mode = CHAIN_NONE; in report_parse_callchain_opt()
1025 unsigned long *time_q = opt->value; in parse_time_quantum()
1033 return -1; in parse_time_quantum()
1054 return -1; in parse_time_quantum()
1066 pr_err("Invalid --ignore-callees regex: %s\n%s", arg, buf); in report_parse_ignore_callees_opt()
1067 return -1; in report_parse_ignore_callees_opt()
1079 int *branch_mode = opt->value; in parse_branch_mode()
1089 struct report *rep = opt->value; in parse_percent_limit()
1092 rep->min_percent = pcnt; in parse_percent_limit()
1123 int branch_mode = -1; in cmd_report()
1132 "perf report [<options>]", in cmd_report()
1135 struct report report = { in cmd_report() local
1160 .socket_filter = -1, in cmd_report()
1171 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, in cmd_report()
1173 OPT_BOOLEAN(0, "stats", &report.stats_mode, "Display event stats"), in cmd_report()
1174 OPT_BOOLEAN(0, "tasks", &report.tasks_mode, "Display recorded tasks"), in cmd_report()
1175 OPT_BOOLEAN(0, "mmaps", &report.mmaps_mode, "Display recorded tasks memory maps"), in cmd_report()
1178 OPT_BOOLEAN(0, "ignore-vmlinux", &symbol_conf.ignore_vmlinux, in cmd_report()
1184 "load module symbols - WARNING: use only with -k and LIVE kernel"), in cmd_report()
1185 OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, in cmd_report()
1187 OPT_BOOLEAN('T', "threads", &report.show_threads, in cmd_report()
1188 "Show per-thread event counters"), in cmd_report()
1189 OPT_STRING(0, "pretty", &report.pretty_printing_style, "key", in cmd_report()
1191 OPT_BOOLEAN(0, "tui", &report.use_tui, "Use the TUI interface"), in cmd_report()
1192 OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"), in cmd_report()
1193 OPT_BOOLEAN(0, "stdio", &report.use_stdio, in cmd_report()
1195 OPT_BOOLEAN(0, "header", &report.header, "Show data header."), in cmd_report()
1196 OPT_BOOLEAN(0, "header-only", &report.header_only, in cmd_report()
1202 OPT_BOOLEAN(0, "show-cpu-utilization", &symbol_conf.show_cpu_utilization, in cmd_report()
1207 "regex filter to identify parent, see: '--sort parent'"), in cmd_report()
1208 OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other, in cmd_report()
1209 "Only display entries with parent-match"), in cmd_report()
1210 OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param, in cmd_report()
1216 "Enabled by default, use --no-children to disable."), in cmd_report()
1217 OPT_INTEGER(0, "max-stack", &report.max_stack, in cmd_report()
1221 OPT_BOOLEAN('G', "inverted", &report.inverted_callchain, in cmd_report()
1223 OPT_CALLBACK(0, "ignore-callees", NULL, "regex", in cmd_report()
1236 OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter", in cmd_report()
1238 OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str, in cmd_report()
1241 OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator", in cmd_report()
1244 OPT_BOOLEAN('U', "hide-unresolved", &symbol_conf.hide_unresolved, in cmd_report()
1249 OPT_STRING('C', "cpu", &report.cpu_list, "cpu", in cmd_report()
1251 OPT_BOOLEAN('I', "show-info", &report.show_full_info, in cmd_report()
1253 OPT_BOOLEAN(0, "source", &report.annotation_opts.annotate_src, in cmd_report()
1255 OPT_BOOLEAN(0, "asm-raw", &report.annotation_opts.show_asm_raw, in cmd_report()
1257 …OPT_STRING('M', "disassembler-style", &report.annotation_opts.disassembler_style, "disassembler st… in cmd_report()
1258 "Specify disassembler style (e.g. -M intel for intel syntax)"), in cmd_report()
1259 OPT_STRING(0, "prefix", &report.annotation_opts.prefix, "prefix", in cmd_report()
1260 "Add prefix to source file path names in programs (with --prefix-strip)"), in cmd_report()
1261 OPT_STRING(0, "prefix-strip", &report.annotation_opts.prefix_strip, "N", in cmd_report()
1262 "Strip first N entries of source file path name in programs (with --prefix)"), in cmd_report()
1263 OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, in cmd_report()
1265 OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &report.group_set, in cmd_report()
1267 OPT_INTEGER(0, "group-sort-idx", &symbol_conf.group_sort_idx, in cmd_report()
1271 OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "", in cmd_report()
1274 OPT_BOOLEAN(0, "branch-history", &branch_call_mode, in cmd_report()
1276 OPT_STRING(0, "objdump", &report.annotation_opts.objdump_path, "path", in cmd_report()
1280 OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, in cmd_report()
1282 OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"), in cmd_report()
1285 OPT_CALLBACK(0, "percent-limit", &report, "percent", in cmd_report()
1292 OPT_BOOLEAN(0, "full-source-path", &srcline_full_filename, in cmd_report()
1294 OPT_BOOLEAN(0, "show-ref-call-graph", &symbol_conf.show_ref_callgraph, in cmd_report()
1296 OPT_BOOLEAN(0, "stitch-lbr", &report.stitch_lbr, in cmd_report()
1298 OPT_INTEGER(0, "socket-filter", &report.socket_filter, in cmd_report()
1300 OPT_BOOLEAN(0, "raw-trace", &symbol_conf.raw_trace, in cmd_report()
1304 OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", in cmd_report()
1305 "'always' (default), 'never' or 'auto' only applicable to --stdio mode", in cmd_report()
1307 OPT_STRING(0, "time", &report.time_str, "str", in cmd_report()
1311 OPT_CALLBACK(0, "percent-type", &report.annotation_opts, "local-period", in cmd_report()
1312 "Set percent type local/global-period/hits", in cmd_report()
1315 OPT_CALLBACK(0, "time-quantum", &symbol_conf.time_quantum, "time (ms|us|ns|s)", in cmd_report()
1318 OPTS_EVSWITCH(&report.evswitch), in cmd_report()
1319 OPT_BOOLEAN(0, "total-cycles", &report.total_cycles_mode, in cmd_report()
1332 ret = perf_config(report__config, &report); in cmd_report()
1345 report.symbol_filter_str = argv[0]; in cmd_report()
1348 if (annotate_check_args(&report.annotation_opts) < 0) { in cmd_report()
1349 ret = -EINVAL; in cmd_report()
1353 if (report.mmaps_mode) in cmd_report()
1354 report.tasks_mode = true; in cmd_report()
1357 report.tool.ordered_events = false; in cmd_report()
1365 ret = -EINVAL; in cmd_report()
1371 ret = -EINVAL; in cmd_report()
1375 if (report.inverted_callchain) in cmd_report()
1381 (int)itrace_synth_opts.callchain_sz > report.max_stack) in cmd_report()
1382 report.max_stack = itrace_synth_opts.callchain_sz; in cmd_report()
1386 input_name = "-"; in cmd_report()
1395 session = perf_session__new(&data, false, &report.tool); in cmd_report()
1401 ret = evswitch__init(&report.evswitch, session->evlist, stderr); in cmd_report()
1405 if (zstd_init(&(session->zstd_data), 0) < 0) in cmd_report()
1408 if (report.queue_size) { in cmd_report()
1409 ordered_events__set_alloc_size(&session->ordered_events, in cmd_report()
1410 report.queue_size); in cmd_report()
1413 session->itrace_synth_opts = &itrace_synth_opts; in cmd_report()
1415 report.session = session; in cmd_report()
1417 has_br_stack = perf_header__has_feat(&session->header, in cmd_report()
1419 if (evlist__combined_sample_type(session->evlist) & PERF_SAMPLE_STACK_USER) in cmd_report()
1422 setup_forced_leader(&report, session->evlist); in cmd_report()
1424 if (symbol_conf.group_sort_idx && !session->evlist->nr_groups) { in cmd_report()
1425 parse_options_usage(NULL, options, "group-sort-idx", 0); in cmd_report()
1426 ret = -EINVAL; in cmd_report()
1427 goto error; in cmd_report()
1436 memset(&report.brtype_stat, 0, sizeof(struct branch_type_stat)); in cmd_report()
1440 * -1 means default, so decide based on the file having branch data. in cmd_report()
1443 if (((branch_mode == -1 && has_br_stack) || branch_mode == 1) && in cmd_report()
1457 if (report.mem_mode) { in cmd_report()
1460 goto error; in cmd_report()
1471 pr_err("Error: --hierarchy and --fields options cannot be used together\n"); in cmd_report()
1474 goto error; in cmd_report()
1480 if (report.use_stdio) in cmd_report()
1482 else if (report.use_tui) in cmd_report()
1484 else if (report.use_gtk) in cmd_report()
1487 /* Force tty output for header output and per-thread stat. */ in cmd_report()
1488 if (report.header || report.header_only || report.show_threads) in cmd_report()
1490 if (report.header || report.header_only) in cmd_report()
1491 report.tool.show_feat_hdr = SHOW_FEAT_HEADER; in cmd_report()
1492 if (report.show_full_info) in cmd_report()
1493 report.tool.show_feat_hdr = SHOW_FEAT_HEADER_FULL_INFO; in cmd_report()
1494 if (report.stats_mode || report.tasks_mode) in cmd_report()
1496 if (report.stats_mode && report.tasks_mode) { in cmd_report()
1497 pr_err("Error: --tasks and --mmaps can't be used together with --stats\n"); in cmd_report()
1498 goto error; in cmd_report()
1501 if (report.total_cycles_mode) { in cmd_report()
1503 report.total_cycles_mode = false; in cmd_report()
1508 if (strcmp(input_name, "-") != 0) in cmd_report()
1515 goto error; in cmd_report()
1522 report.symbol_ipc = true; in cmd_report()
1532 (setup_sorting(session->evlist) < 0)) { in cmd_report()
1538 goto error; in cmd_report()
1541 if ((report.header || report.header_only) && !quiet) { in cmd_report()
1543 report.show_full_info); in cmd_report()
1544 if (report.header_only) { in cmd_report()
1546 goto error; in cmd_report()
1549 !report.stats_mode && !report.tasks_mode) { in cmd_report()
1550 fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", in cmd_report()
1559 if (ui__has_annotation() || report.symbol_ipc || in cmd_report()
1560 report.total_cycles_mode) { in cmd_report()
1563 goto error; in cmd_report()
1579 annotation_config__init(&report.annotation_opts); in cmd_report()
1582 if (symbol__init(&session->header.env) < 0) in cmd_report()
1583 goto error; in cmd_report()
1585 if (report.time_str) { in cmd_report()
1586 ret = perf_time__parse_for_ranges(report.time_str, session, in cmd_report()
1587 &report.ptime_range, in cmd_report()
1588 &report.range_size, in cmd_report()
1589 &report.range_num); in cmd_report()
1591 goto error; in cmd_report()
1594 report.ptime_range, in cmd_report()
1595 report.range_num); in cmd_report()
1598 if (session->tevent.pevent && in cmd_report()
1599 tep_set_function_resolver(session->tevent.pevent, in cmd_report()
1601 &session->machines.host) < 0) { in cmd_report()
1604 return -1; in cmd_report()
1609 ret = __cmd_report(&report); in cmd_report()
1617 error: in cmd_report()
1618 if (report.ptime_range) { in cmd_report()
1620 zfree(&report.ptime_range); in cmd_report()
1623 if (report.block_reports) { in cmd_report()
1624 block_info__free_report(report.block_reports, in cmd_report()
1625 report.nr_block_reports); in cmd_report()
1626 report.block_reports = NULL; in cmd_report()
1629 zstd_fini(&(session->zstd_data)); in cmd_report()