aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 13:28:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 13:28:49 -0400
commit7e92daaefa68e5ef1e1732e45231e73adbb724e7 (patch)
tree8e7f8ac9d82654df4c65939c6682f95510e22977 /tools/perf/builtin-report.c
parent7a68294278ae714ce2632a54f0f46916dca64f56 (diff)
parent1d787d37c8ff6612b8151c6dff15bfa7347bcbdf (diff)
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf update from Ingo Molnar: "Lots of changes in this cycle as well, with hundreds of commits from over 30 contributors. Most of the activity was on the tooling side. Higher level changes: - New 'perf kvm' analysis tool, from Xiao Guangrong. - New 'perf trace' system-wide tracing tool - uprobes fixes + cleanups from Oleg Nesterov. - Lots of patches to make perf build on Android out of box, from Irina Tirdea - Extend ftrace function tracing utility to be more dynamic for its users. It allows for data passing to the callback functions, as well as reading regs as if a breakpoint were to trigger at function entry. The main goal of this patch series was to allow kprobes to use ftrace as an optimized probe point when a probe is placed on an ftrace nop. With lots of help from Masami Hiramatsu, and going through lots of iterations, we finally came up with a good solution. - Add cpumask for uncore pmu, use it in 'stat', from Yan, Zheng. - Various tracing updates from Steve Rostedt - Clean up and improve 'perf sched' performance by elliminating lots of needless calls to libtraceevent. - Event group parsing support, from Jiri Olsa - UI/gtk refactorings and improvements from Namhyung Kim - Add support for non-tracepoint events in perf script python, from Feng Tang - Add --symbols to 'script', similar to the one in 'report', from Feng Tang. Infrastructure enhancements and fixes: - Convert the trace builtins to use the growing evsel/evlist tracepoint infrastructure, removing several open coded constructs like switch like series of strcmp to dispatch events, etc. Basically what had already been showcased in 'perf sched'. - Add evsel constructor for tracepoints, that uses libtraceevent just to parse the /format events file, use it in a new 'perf test' to make sure the libtraceevent format parsing regressions can be more readily caught. - Some strange errors were happening in some builds, but not on the next, reported by several people, problem was some parser related files, generated during the build, didn't had proper make deps, fix from Eric Sandeen. - Introduce struct and cache information about the environment where a perf.data file was captured, from Namhyung Kim. - Fix handling of unresolved samples when --symbols is used in 'report', from Feng Tang. - Add union member access support to 'probe', from Hyeoncheol Lee. - Fixups to die() removal, from Namhyung Kim. - Render fixes for the TUI, from Namhyung Kim. - Don't enable annotation in non symbolic view, from Namhyung Kim. - Fix pipe mode in 'report', from Namhyung Kim. - Move related stats code from stat to util/, will be used by the 'stat' kvm tool, from Xiao Guangrong. - Remove die()/exit() calls from several tools. - Resolve vdso callchains, from Jiri Olsa - Don't pass const char pointers to basename, so that we can unconditionally use libgen.h and thus avoid ifdef BIONIC lines, from David Ahern - Refactor hist formatting so that it can be reused with the GTK browser, From Namhyung Kim - Fix build for another rbtree.c change, from Adrian Hunter. - Make 'perf diff' command work with evsel hists, from Jiri Olsa. - Use the only field_sep var that is set up: symbol_conf.field_sep, fix from Jiri Olsa. - .gitignore compiled python binaries, from Namhyung Kim. - Get rid of die() in more libtraceevent places, from Namhyung Kim. - Rename libtraceevent 'private' struct member to 'priv' so that it works in C++, from Steven Rostedt - Remove lots of exit()/die() calls from tools so that the main perf exit routine can take place, from David Ahern - Fix x86 build on x86-64, from David Ahern. - {int,str,rb}list fixes from Suzuki K Poulose - perf.data header fixes from Namhyung Kim - Allow user to indicate objdump path, needed in cross environments, from Maciek Borzecki - Fix hardware cache event name generation, fix from Jiri Olsa - Add round trip test for sw, hw and cache event names, catching the problem Jiri fixed, after Jiri's patch, the test passes successfully. - Clean target should do clean for lib/traceevent too, fix from David Ahern - Check the right variable for allocation failure, fix from Namhyung Kim - Set up evsel->tp_format regardless of evsel->name being set already, fix from Namhyung Kim - Oprofile fixes from Robert Richter. - Remove perf_event_attr needless version inflation, from Jiri Olsa - Introduce libtraceevent strerror like error reporting facility, from Namhyung Kim - Add pmu mappings to perf.data header and use event names from cmd line, from Robert Richter - Fix include order for bison/flex-generated C files, from Ben Hutchings - Build fixes and documentation corrections from David Ahern - Assorted cleanups from Robert Richter - Let O= makes handle relative paths, from Steven Rostedt - perf script python fixes, from Feng Tang. - Initial bash completion support, from Frederic Weisbecker - Allow building without libelf, from Namhyung Kim. - Support DWARF CFI based unwind to have callchains when %bp based unwinding is not possible, from Jiri Olsa. - Symbol resolution fixes, while fixing support PPC64 files with an .opt ELF section was the end goal, several fixes for code that handles all architectures and cleanups are included, from Cody Schafer. - Assorted fixes for Documentation and build in 32 bit, from Robert Richter - Cache the libtraceevent event_format associated to each evsel early, so that we avoid relookups, i.e. calling pevent_find_event repeatedly when processing tracepoint events. [ This is to reduce the surface contact with libtraceevents and make clear what is that the perf tools needs from that lib: so far parsing the common and per event fields. ] - Don't stop the build if the audit libraries are not installed, fix from Namhyung Kim. - Fix bfd.h/libbfd detection with recent binutils, from Markus Trippelsdorf. - Improve warning message when libunwind devel packages not present, from Jiri Olsa" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (282 commits) perf trace: Add aliases for some syscalls perf probe: Print an enum type variable in "enum variable-name" format when showing accessible variables perf tools: Check libaudit availability for perf-trace builtin perf hists: Add missing period_* fields when collapsing a hist entry perf trace: New tool perf evsel: Export the event_format constructor perf evsel: Introduce rawptr() method perf tools: Use perf_evsel__newtp in the event parser perf evsel: The tracepoint constructor should store sys:name perf evlist: Introduce set_filter() method perf evlist: Renane set_filters method to apply_filters perf test: Add test to check we correctly parse and match syscall open parms perf evsel: Handle endianity in intval method perf evsel: Know if byte swap is needed perf tools: Allow handling a NULL cpu_map as meaning "all cpus" perf evsel: Improve tracepoint constructor setup tools lib traceevent: Fix error path on pevent_parse_event perf test: Fix build failure trace: Move trace event enable from fs_initcall to core_initcall tracing: Add an option for disabling markers ...
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7c88a243b5db..1da243dfbc3e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -69,8 +69,8 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool,
69 69
70 if ((sort__has_parent || symbol_conf.use_callchain) 70 if ((sort__has_parent || symbol_conf.use_callchain)
71 && sample->callchain) { 71 && sample->callchain) {
72 err = machine__resolve_callchain(machine, al->thread, 72 err = machine__resolve_callchain(machine, evsel, al->thread,
73 sample->callchain, &parent); 73 sample, &parent);
74 if (err) 74 if (err)
75 return err; 75 return err;
76 } 76 }
@@ -93,7 +93,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool,
93 struct annotation *notes; 93 struct annotation *notes;
94 err = -ENOMEM; 94 err = -ENOMEM;
95 bx = he->branch_info; 95 bx = he->branch_info;
96 if (bx->from.sym && use_browser > 0) { 96 if (bx->from.sym && use_browser == 1 && sort__has_sym) {
97 notes = symbol__annotation(bx->from.sym); 97 notes = symbol__annotation(bx->from.sym);
98 if (!notes->src 98 if (!notes->src
99 && symbol__alloc_hist(bx->from.sym) < 0) 99 && symbol__alloc_hist(bx->from.sym) < 0)
@@ -107,7 +107,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool,
107 goto out; 107 goto out;
108 } 108 }
109 109
110 if (bx->to.sym && use_browser > 0) { 110 if (bx->to.sym && use_browser == 1 && sort__has_sym) {
111 notes = symbol__annotation(bx->to.sym); 111 notes = symbol__annotation(bx->to.sym);
112 if (!notes->src 112 if (!notes->src
113 && symbol__alloc_hist(bx->to.sym) < 0) 113 && symbol__alloc_hist(bx->to.sym) < 0)
@@ -140,8 +140,8 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel,
140 struct hist_entry *he; 140 struct hist_entry *he;
141 141
142 if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { 142 if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) {
143 err = machine__resolve_callchain(machine, al->thread, 143 err = machine__resolve_callchain(machine, evsel, al->thread,
144 sample->callchain, &parent); 144 sample, &parent);
145 if (err) 145 if (err)
146 return err; 146 return err;
147 } 147 }
@@ -162,7 +162,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel,
162 * so we don't allocated the extra space needed because the stdio 162 * so we don't allocated the extra space needed because the stdio
163 * code will not use it. 163 * code will not use it.
164 */ 164 */
165 if (he->ms.sym != NULL && use_browser > 0) { 165 if (he->ms.sym != NULL && use_browser == 1 && sort__has_sym) {
166 struct annotation *notes = symbol__annotation(he->ms.sym); 166 struct annotation *notes = symbol__annotation(he->ms.sym);
167 167
168 assert(evsel != NULL); 168 assert(evsel != NULL);
@@ -223,9 +223,9 @@ static int process_sample_event(struct perf_tool *tool,
223 223
224static int process_read_event(struct perf_tool *tool, 224static int process_read_event(struct perf_tool *tool,
225 union perf_event *event, 225 union perf_event *event,
226 struct perf_sample *sample __used, 226 struct perf_sample *sample __maybe_unused,
227 struct perf_evsel *evsel, 227 struct perf_evsel *evsel,
228 struct machine *machine __used) 228 struct machine *machine __maybe_unused)
229{ 229{
230 struct perf_report *rep = container_of(tool, struct perf_report, tool); 230 struct perf_report *rep = container_of(tool, struct perf_report, tool);
231 231
@@ -287,7 +287,7 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
287 287
288extern volatile int session_done; 288extern volatile int session_done;
289 289
290static void sig_handler(int sig __used) 290static void sig_handler(int sig __maybe_unused)
291{ 291{
292 session_done = 1; 292 session_done = 1;
293} 293}
@@ -397,17 +397,17 @@ static int __cmd_report(struct perf_report *rep)
397 desc); 397 desc);
398 } 398 }
399 399
400 if (dump_trace) {
401 perf_session__fprintf_nr_events(session, stdout);
402 goto out_delete;
403 }
404
405 if (verbose > 3) 400 if (verbose > 3)
406 perf_session__fprintf(session, stdout); 401 perf_session__fprintf(session, stdout);
407 402
408 if (verbose > 2) 403 if (verbose > 2)
409 perf_session__fprintf_dsos(session, stdout); 404 perf_session__fprintf_dsos(session, stdout);
410 405
406 if (dump_trace) {
407 perf_session__fprintf_nr_events(session, stdout);
408 goto out_delete;
409 }
410
411 nr_samples = 0; 411 nr_samples = 0;
412 list_for_each_entry(pos, &session->evlist->entries, node) { 412 list_for_each_entry(pos, &session->evlist->entries, node) {
413 struct hists *hists = &pos->hists; 413 struct hists *hists = &pos->hists;
@@ -533,13 +533,14 @@ setup:
533} 533}
534 534
535static int 535static int
536parse_branch_mode(const struct option *opt __used, const char *str __used, int unset) 536parse_branch_mode(const struct option *opt __maybe_unused,
537 const char *str __maybe_unused, int unset)
537{ 538{
538 sort__branch_mode = !unset; 539 sort__branch_mode = !unset;
539 return 0; 540 return 0;
540} 541}
541 542
542int cmd_report(int argc, const char **argv, const char *prefix __used) 543int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
543{ 544{
544 struct perf_session *session; 545 struct perf_session *session;
545 struct stat st; 546 struct stat st;
@@ -638,6 +639,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
638 "Show a column with the sum of periods"), 639 "Show a column with the sum of periods"),
639 OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "", 640 OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "",
640 "use branch records for histogram filling", parse_branch_mode), 641 "use branch records for histogram filling", parse_branch_mode),
642 OPT_STRING(0, "objdump", &objdump_path, "path",
643 "objdump binary to use for disassembly and annotations"),
641 OPT_END() 644 OPT_END()
642 }; 645 };
643 646
@@ -686,15 +689,19 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
686 689
687 if (strcmp(report.input_name, "-") != 0) 690 if (strcmp(report.input_name, "-") != 0)
688 setup_browser(true); 691 setup_browser(true);
689 else 692 else {
690 use_browser = 0; 693 use_browser = 0;
694 perf_hpp__init(false, false);
695 }
696
697 setup_sorting(report_usage, options);
691 698
692 /* 699 /*
693 * Only in the newt browser we are doing integrated annotation, 700 * Only in the newt browser we are doing integrated annotation,
694 * so don't allocate extra space that won't be used in the stdio 701 * so don't allocate extra space that won't be used in the stdio
695 * implementation. 702 * implementation.
696 */ 703 */
697 if (use_browser > 0) { 704 if (use_browser == 1 && sort__has_sym) {
698 symbol_conf.priv_size = sizeof(struct annotation); 705 symbol_conf.priv_size = sizeof(struct annotation);
699 report.annotate_init = symbol__annotate_init; 706 report.annotate_init = symbol__annotate_init;
700 /* 707 /*
@@ -717,8 +724,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
717 if (symbol__init() < 0) 724 if (symbol__init() < 0)
718 goto error; 725 goto error;
719 726
720 setup_sorting(report_usage, options);
721
722 if (parent_pattern != default_parent_pattern) { 727 if (parent_pattern != default_parent_pattern) {
723 if (sort_dimension__add("parent") < 0) 728 if (sort_dimension__add("parent") < 0)
724 goto error; 729 goto error;