From: Ingo Molnar Date: Tue, 29 Oct 2013 10:23:32 +0000 (+0100) Subject: Merge branch 'perf/urgent' into perf/core X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=aac898548d04c7bff179b79f805874b0d6f87571;p=openwrt%2Fstaging%2Fblogic.git Merge branch 'perf/urgent' into perf/core Conflicts: tools/perf/builtin-record.c tools/perf/builtin-top.c tools/perf/util/hist.h --- aac898548d04c7bff179b79f805874b0d6f87571 diff --cc tools/perf/Documentation/perf-record.txt index f10ab63576d7,ca0d3d9f4bac..052f7c4dc00c --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@@ -87,13 -87,23 +87,25 @@@ OPTION -m:: --mmap-pages=:: - Number of mmap data pages. Must be a power of two. + Number of mmap data pages (must be a power of two) or size + specification with appended unit character - B/K/M/G. The + size is rounded up to have nearest pages power of two value. -g:: + Enables call-graph (stack chain/backtrace) recording. + --call-graph:: - Do call-graph (stack chain/backtrace) recording. + Setup and enable call-graph (stack chain/backtrace) recording, + implies -g. + + Allows specifying "fp" (frame pointer) or "dwarf" + (DWARF's CFI - Call Frame Information) as the method to collect + the information used to show the call graphs. + + In some systems, where binaries are build with gcc + --fomit-frame-pointer, using the "fp" method will produce bogus + call graphs, using "dwarf", if available (perf tools linked to + the libunwind library) should be used instead. -q:: --quiet:: diff --cc tools/perf/Documentation/perf-top.txt index c16a09e2f182,6a118e71d003..7de01dd79688 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt @@@ -143,29 -140,13 +143,21 @@@ Default is to monitor all CPUS --asm-raw:: Show raw instruction encoding of assembly instructions. - -G [type,min,order]:: + -G:: + Enables call-graph (stack chain/backtrace) recording. + --call-graph:: - Display call chains using type, min percent threshold and order. - type can be either: - - flat: single column, linear exposure of call chains. - - graph: use a graph tree, displaying absolute overhead rates. - - fractal: like graph, but displays relative rates. Each branch of - the tree is considered as a new profiled object. - - order can be either: - - callee: callee based call graph. - - caller: inverted caller based call graph. - - Default: fractal,0.5,callee. + Setup and enable call-graph (stack chain/backtrace) recording, + implies -G. +--max-stack:: + Set the stack depth limit when parsing the callchain, anything + beyond the specified depth will be ignored. This is a trade-off + between information loss and faster processing especially for + workloads that can have a very long callchain stack. + + Default: 127 + --ignore-callees=:: Ignore callees of the function(s) matching the given regex. This has the effect of collecting the callers of each such diff --cc tools/perf/builtin-record.c index ab8d15e6e8cc,d04651484640..8b45fcead5f6 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@@ -676,12 -710,10 +676,10 @@@ static int get_stack_size(char *str, un max_size, str); return -1; } -#endif /* LIBUNWIND_SUPPORT */ +#endif /* HAVE_LIBUNWIND_SUPPORT */ - int record_parse_callchain_opt(const struct option *opt, - const char *arg, int unset) + int record_parse_callchain(const char *arg, struct perf_record_opts *opts) { - struct perf_record_opts *opts = opt->value; char *tok, *name, *saveptr = NULL; char *buf; int ret = -1; @@@ -730,13 -755,9 +721,9 @@@ ret = get_stack_size(tok, &size); opts->stack_dump_size = size; } - - if (!ret) - pr_debug("callchain: stack dump size %d\n", - opts->stack_dump_size); -#endif /* LIBUNWIND_SUPPORT */ +#endif /* HAVE_LIBUNWIND_SUPPORT */ } else { - pr_err("callchain: Unknown -g option " + pr_err("callchain: Unknown --call-graph option " "value: %s\n", arg); break; } @@@ -779,12 -839,12 +805,12 @@@ static struct perf_record record = }, }; - #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " + #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " -#ifdef LIBUNWIND_SUPPORT +#ifdef HAVE_LIBUNWIND_SUPPORT - const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; + const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf"; #else - const char record_callchain_help[] = CALLCHAIN_HELP "[fp]"; + const char record_callchain_help[] = CALLCHAIN_HELP "fp"; #endif /* @@@ -820,14 -880,16 +846,17 @@@ const struct option record_options[] = OPT_BOOLEAN('i', "no-inherit", &record.opts.no_inherit, "child tasks do not inherit counters"), OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"), - OPT_UINTEGER('m', "mmap-pages", &record.opts.mmap_pages, - "number of mmap data pages"), + OPT_CALLBACK('m', "mmap-pages", &record.opts.mmap_pages, "pages", + "number of mmap data pages", + perf_evlist__parse_mmap_pages), OPT_BOOLEAN(0, "group", &record.opts.group, "put the counters into a counter group"), - OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, - "mode[,dump_size]", record_callchain_help, - &record_parse_callchain_opt, "fp"), + OPT_CALLBACK_NOOPT('g', NULL, &record.opts, + NULL, "enables call-graph recording" , + &record_callchain_opt), + OPT_CALLBACK(0, "call-graph", &record.opts, + "mode[,dump_size]", record_callchain_help, + &record_parse_callchain_opt), OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"), OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), diff --cc tools/perf/builtin-top.c index 76c9264ed070,5a11f13e56f9..a6ea956a533e --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@@ -1104,16 -1105,15 +1106,19 @@@ int cmd_top(int argc, const char **argv OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"), OPT_STRING('s', "sort", &sort_order, "key[,key2...]", - "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"), + "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight," + " abort, in_tx, transaction"), OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, "Show a column with the number of samples"), - OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, - "mode[,dump_size]", record_callchain_help, - &parse_callchain_opt, "fp"), + OPT_CALLBACK_NOOPT('G', NULL, &top.record_opts, + NULL, "enables call-graph recording", + &callchain_opt), + OPT_CALLBACK(0, "call-graph", &top.record_opts, + "mode[,dump_size]", record_callchain_help, + &parse_callchain_opt), + OPT_INTEGER(0, "max-stack", &top.max_stack, + "Set the maximum stack depth when parsing the callchain. " + "Default: " __stringify(PERF_MAX_STACK_DEPTH)), OPT_CALLBACK(0, "ignore-callees", NULL, "regex", "ignore callees of these functions in call graphs", report_parse_ignore_callees_opt), diff --cc tools/perf/builtin-trace.c index fa620bc1db69,99c8d9ad6729..dc3da654ff12 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@@ -1744,10 -987,10 +1744,10 @@@ again err = perf_evlist__parse_sample(evlist, event, &sample); if (err) { fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); - continue; + goto next_event; } - if (trace->base_time == 0) + if (!trace->full_time && trace->base_time == 0) trace->base_time = sample.time; if (type != PERF_RECORD_SAMPLE) { @@@ -1770,9 -1013,11 +1770,11 @@@ handler = evsel->handler.func; handler(trace, evsel, &sample); + next_event: + perf_evlist__mmap_consume(evlist, i); - if (done) - goto out_unmap_evlist; + if (interrupted) + goto out_disable; } } diff --cc tools/perf/util/evsel.c index ec0cc1e21c62,9f1ef9bee2d0..3a334f001997 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@@ -678,12 -678,8 +678,11 @@@ void perf_evsel__config(struct perf_evs attr->sample_type |= PERF_SAMPLE_WEIGHT; attr->mmap = track; - attr->mmap2 = track && !perf_missing_features.mmap2; attr->comm = track; + if (opts->sample_transaction) + attr->sample_type |= PERF_SAMPLE_TRANSACTION; + /* * XXX see the function comment above * diff --cc tools/perf/util/hist.h index 0c7ce8bb8eba,ce8dc61ce2c3..9d2d022cdb79 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@@ -5,7 -5,7 +5,8 @@@ #include #include "callchain.h" #include "header.h" + #include "color.h" +#include "ui/progress.h" extern struct callchain_param callchain_param;