From 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 25 Mar 2016 03:53:42 -0300 Subject: Linux-libre 4.5-gnu --- tools/perf/builtin-report.c | 60 ++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 23 deletions(-) (limited to 'tools/perf/builtin-report.c') diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index f256fac1e..2bf537f19 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -27,7 +27,8 @@ #include "util/session.h" #include "util/tool.h" -#include "util/parse-options.h" +#include +#include #include "util/parse-events.h" #include "util/thread.h" @@ -45,7 +46,6 @@ struct report { struct perf_tool tool; struct perf_session *session; bool use_tui, use_gtk, use_stdio; - bool hide_unresolved; bool dont_use_callchains; bool show_full_info; bool show_threads; @@ -146,7 +146,7 @@ static int process_sample_event(struct perf_tool *tool, struct hist_entry_iter iter = { .evsel = evsel, .sample = sample, - .hide_unresolved = rep->hide_unresolved, + .hide_unresolved = symbol_conf.hide_unresolved, .add_entry_cb = hist_iter__report_callback, }; int ret = 0; @@ -157,7 +157,7 @@ static int process_sample_event(struct perf_tool *tool, return -1; } - if (rep->hide_unresolved && al.sym == NULL) + if (symbol_conf.hide_unresolved && al.sym == NULL) goto out_put; if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) @@ -434,7 +434,14 @@ static int report__browse_hists(struct report *rep) int ret; struct perf_session *session = rep->session; struct perf_evlist *evlist = session->evlist; - const char *help = "For a higher level overview, try: perf report --sort comm,dso"; + const char *help = perf_tip(system_path(TIPDIR)); + + if (help == NULL) { + /* fallback for people who don't install perf ;-) */ + help = perf_tip(DOCDIR); + if (help == NULL) + help = "Cannot load tips.txt file, please install perf!"; + } switch (use_browser) { case 1: @@ -514,20 +521,26 @@ static int __cmd_report(struct report *rep) if (rep->cpu_list) { ret = perf_session__cpu_bitmap(session, rep->cpu_list, rep->cpu_bitmap); - if (ret) + if (ret) { + ui__error("failed to set cpu bitmap\n"); return ret; + } } if (rep->show_threads) perf_read_values_init(&rep->show_threads_values); ret = report__setup_sample_type(rep); - if (ret) + if (ret) { + /* report__setup_sample_type() already showed error message */ return ret; + } ret = perf_session__process_events(session); - if (ret) + if (ret) { + ui__error("failed to process sample\n"); return ret; + } report__warn_kptr_restrict(rep); @@ -625,7 +638,7 @@ parse_percent_limit(const struct option *opt, const char *str, return 0; } -#define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function" +#define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent" const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n" CALLCHAIN_REPORT_HELP @@ -708,7 +721,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other, "Only display entries with parent-match"), OPT_CALLBACK_DEFAULT('g', "call-graph", &report, - "print_type,threshold[,print_limit],order,sort_key[,branch]", + "print_type,threshold[,print_limit],order,sort_key[,branch],value", report_callchain_help, &report_parse_callchain_opt, callchain_default_opt), OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain, @@ -740,7 +753,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator", "separator for columns, no spaces will be added between " "columns '.' is reserved."), - OPT_BOOLEAN('U', "hide-unresolved", &report.hide_unresolved, + OPT_BOOLEAN('U', "hide-unresolved", &symbol_conf.hide_unresolved, "Only display entries resolved to a symbol"), OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", "Look for files with symbols relative to this directory"), @@ -783,6 +796,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "Show callgraph from reference event"), OPT_INTEGER(0, "socket-filter", &report.socket_filter, "only show processor socket that match with this filter"), + OPT_BOOLEAN(0, "raw-trace", &symbol_conf.raw_trace, + "Show raw trace event output (do not use print fmt or plugins)"), OPT_END() }; struct perf_data_file file = { @@ -796,6 +811,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) perf_config(report__config, &report); argc = parse_options(argc, argv, options, report_usage, 0); + if (argc) { + /* + * Special case: if there's an argument left then assume that + * it's a symbol filter: + */ + if (argc > 1) + usage_with_options(report_usage, options); + + report.symbol_filter_str = argv[0]; + } if (symbol_conf.vmlinux_name && access(symbol_conf.vmlinux_name, R_OK)) { @@ -882,7 +907,7 @@ repeat: symbol_conf.cumulate_callchain = false; } - if (setup_sorting() < 0) { + if (setup_sorting(session->evlist) < 0) { if (sort_order) parse_options_usage(report_usage, options, "s", 1); if (field_order) @@ -941,17 +966,6 @@ repeat: if (symbol__init(&session->header.env) < 0) goto error; - if (argc) { - /* - * Special case: if there's an argument left then assume that - * it's a symbol filter: - */ - if (argc > 1) - usage_with_options(report_usage, options); - - report.symbol_filter_str = argv[0]; - } - sort__setup_elide(stdout); ret = __cmd_report(&report); -- cgit v1.2.3-54-g00ecf