linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/8] perf/core improvements and fixes
@ 2015-10-22 22:14 Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 1/8] tools lib traceevent: Support %ps/%pS Arnaldo Carvalho de Melo
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, Brendan Gregg, Chandler Carruth, Dave Chinner,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Martin Liška,
	Namhyung Kim, Peter Zijlstra, Scott Wood, Stephane Eranian,
	Steven Rostedt, Taeung Song, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 4ba792e303e278052bb0ee60cce15d6d7dc15c7c:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-22 09:33:46 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to f06cff7c59b6b252d667435d7baad48687b41002:

  perf annotate: Don't die() when finding an invalid config option (2015-10-22 18:10:52 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- The default for callchains is back to 'callee' when --children is not used,
  (Namhyung Kim)

- Move the 'use_offset' option to the right place where the annotate code
  expects it to be to be able to properly handle it (Namhyung Kim)

- Don't die when an unknown 'annotate' option is found in the perf config
  file (usually ~/.perfconfig), just warn the user (Arnaldo Carvalho de Melo)

Infrastructure:

- Support %ps/%pS in libtraceevent (Scott Wood)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
      perf ui tui: Register the error callbacks before initializing the widgets
      perf annotate: Don't die() when finding an invalid config option

Namhyung Kim (5):
      perf tools: Move callchain help messages to callchain.h
      perf top: Support call-graph display options also
      perf tools: Defaults to 'caller' callchain order only if --children is enabled
      perf tools: Improve call graph documents and help messages
      perf annotate: Fix 'annotate.use_offset' config variable usage

Scott Wood (1):
      tools lib traceevent: Support %ps/%pS

 tools/lib/traceevent/event-parse.c       |  4 +--
 tools/perf/Documentation/perf-record.txt |  9 +++++--
 tools/perf/Documentation/perf-report.txt | 38 ++++++++++++++++++-----------
 tools/perf/Documentation/perf-top.txt    |  5 ++--
 tools/perf/builtin-record.c              | 11 +++------
 tools/perf/builtin-report.c              | 17 ++++++++++---
 tools/perf/builtin-top.c                 | 30 +++++++++++++++++++----
 tools/perf/ui/browsers/annotate.c        |  8 +++---
 tools/perf/ui/tui/setup.c                |  8 +++---
 tools/perf/util/callchain.c              | 42 +++++++++++++++++++++++++++++---
 tools/perf/util/callchain.h              | 26 ++++++++++++++++++++
 tools/perf/util/util.c                   |  2 +-
 12 files changed, 151 insertions(+), 49 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/8] tools lib traceevent: Support %ps/%pS
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 2/8] perf tools: Move callchain help messages to callchain.h Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Scott Wood, Dave Chinner, Arnaldo Carvalho de Melo

From: Scott Wood <scottwood@freescale.com>

Commits such as 65dd297ac25565 ("xfs: %pF is only for function
pointers") caused a regression because pretty_print() didn't support
%ps/%pS.  The current %pf/%pF implementation in pretty_print() is what
%ps/%pS is supposed to do, so use the same code for %ps/%pS.

Addressing the incorrect %pf/%pF implementation is beyond the scope of
this patch.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Dave Chinner <david@fromorbit.com>
Link: http://lkml.kernel.org/r/20150831211637.GA12848@home.buserror.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 9aa107a0ce8c..2a912df6771b 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -4905,8 +4905,8 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 				else
 					ls = 2;
 
-				if (*(ptr+1) == 'F' ||
-				    *(ptr+1) == 'f') {
+				if (*(ptr+1) == 'F' || *(ptr+1) == 'f' ||
+				    *(ptr+1) == 'S' || *(ptr+1) == 's') {
 					ptr++;
 					show_func = *ptr;
 				} else if (*(ptr+1) == 'M' || *(ptr+1) == 'm') {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/8] perf tools: Move callchain help messages to callchain.h
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 1/8] tools lib traceevent: Support %ps/%pS Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 3/8] perf top: Support call-graph display options also Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Adrian Hunter, Borislav Petkov,
	Brendan Gregg, Chandler Carruth, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Stephane Eranian, Wang Nan,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

These messages will be used by 'perf top' in the next patch.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445495330-25416-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |  8 +-------
 tools/perf/builtin-report.c | 10 +++++++---
 tools/perf/util/callchain.h | 12 ++++++++++++
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 24ace2f318c1..1a117623d396 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1010,13 +1010,7 @@ static struct record record = {
 	},
 };
 
-#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
-
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
-const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf lbr";
-#else
-const char record_callchain_help[] = CALLCHAIN_HELP "fp lbr";
-#endif
+const char record_callchain_help[] = CALLCHAIN_RECORD_HELP;
 
 /*
  * XXX Will stay a global variable till we fix builtin-script.c to stop messing
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 3b23b25d1589..18a8c52d921e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -625,6 +625,9 @@ parse_percent_limit(const struct option *opt, const char *str,
 	return 0;
 }
 
+const char report_callchain_help[] = "Display callchains using " CALLCHAIN_REPORT_HELP ". "
+				     "Default: graph,0.5,caller";
+
 int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct perf_session *session;
@@ -699,9 +702,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 		   "regex filter to identify parent, see: '--sort parent'"),
 	OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
 		    "Only display entries with parent-match"),
-	OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order[,branch]",
-		     "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit, callchain order, key (function or address), add branches. "
-		     "Default: graph,0.5,caller", &report_parse_callchain_opt, callchain_default_opt),
+	OPT_CALLBACK_DEFAULT('g', "call-graph", &report,
+			     "output_type,min_percent[,print_limit],call_order[,branch]",
+			     report_callchain_help, &report_parse_callchain_opt,
+			     callchain_default_opt),
 	OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
 		    "Accumulate callchains of children and show total overhead as well"),
 	OPT_INTEGER(0, "max-stack", &report.max_stack,
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index acee2b3cd801..c9e3a2e85a72 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -7,6 +7,18 @@
 #include "event.h"
 #include "symbol.h"
 
+#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
+
+#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#define CALLCHAIN_RECORD_HELP  CALLCHAIN_HELP "fp dwarf lbr"
+#else
+#define CALLCHAIN_RECORD_HELP  CALLCHAIN_HELP "fp lbr"
+#endif
+
+#define CALLCHAIN_REPORT_HELP  "output_type (graph, flat, fractal, or none), " \
+	"min percent threshold, optional print limit, callchain order, " \
+	"key (function or address), add branches"
+
 enum perf_call_graph_mode {
 	CALLCHAIN_NONE,
 	CALLCHAIN_FP,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/8] perf top: Support call-graph display options also
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 1/8] tools lib traceevent: Support %ps/%pS Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 2/8] perf tools: Move callchain help messages to callchain.h Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 4/8] perf tools: Defaults to 'caller' callchain order only if --children is enabled Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Adrian Hunter, Borislav Petkov,
	Brendan Gregg, Chandler Carruth, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Stephane Eranian, Wang Nan,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Currently 'perf top --call-graph' option is same as 'perf record'.  But
'perf top' also need to receive display options in 'perf report'.  To do
that, change parse_callchain_report_opt() to allow record options too.

Now perf top can receive display options like below:

  $ perf top --call-graph
    Error: option `call-graph' requires a value

   Usage: perf top [<options>]

        --call-graph
          <mode[,dump_size],output_type,min_percent[,print_limit],call_order[,branch]>
                     setup and enables call-graph (stack chain/backtrace)
                     recording: fp dwarf lbr, output_type (graph, flat,
		     fractal, or none), min percent threshold, optional
		     print limit, callchain order, key (function or
		     address), add branches

  $ perf top --call-graph callee,graph,fp

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445495330-25416-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-top.txt |  5 +++--
 tools/perf/builtin-top.c              | 26 ++++++++++++++++++-----
 tools/perf/util/callchain.c           | 40 ++++++++++++++++++++++++++++++++---
 tools/perf/util/callchain.h           |  1 +
 4 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index f6a23eb294e7..556cec09bf50 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -160,9 +160,10 @@ Default is to monitor all CPUS.
 -g::
 	Enables call-graph (stack chain/backtrace) recording.
 
---call-graph::
+--call-graph [mode,type,min[,limit],order[,key][,branch]]::
 	Setup and enable call-graph (stack chain/backtrace) recording,
-	implies -g.
+	implies -g.  See `--call-graph` section in perf-record and
+	perf-report man pages for details.
 
 --children::
 	Accumulate callchain of children to parent entry so that then can
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6f641fd68296..1de381d3f29f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1053,8 +1053,22 @@ callchain_opt(const struct option *opt, const char *arg, int unset)
 static int
 parse_callchain_opt(const struct option *opt, const char *arg, int unset)
 {
-	symbol_conf.use_callchain = true;
-	return record_parse_callchain_opt(opt, arg, unset);
+	struct record_opts *record = (struct record_opts *)opt->value;
+
+	record->callgraph_set = true;
+	callchain_param.enabled = !unset;
+	callchain_param.record_mode = CALLCHAIN_FP;
+
+	/*
+	 * --no-call-graph
+	 */
+	if (unset) {
+		symbol_conf.use_callchain = false;
+		callchain_param.record_mode = CALLCHAIN_NONE;
+		return 0;
+	}
+
+	return parse_callchain_top_opt(arg);
 }
 
 static int perf_top_config(const char *var, const char *value, void *cb)
@@ -1079,6 +1093,8 @@ parse_percent_limit(const struct option *opt, const char *arg,
 	return 0;
 }
 
+const char top_callchain_help[] = CALLCHAIN_RECORD_HELP ", " CALLCHAIN_REPORT_HELP;
+
 int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	char errbuf[BUFSIZ];
@@ -1154,11 +1170,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
 		    "Show a column with the number of samples"),
 	OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts,
-			   NULL, "enables call-graph recording",
+			   NULL, "enables call-graph recording and display",
 			   &callchain_opt),
 	OPT_CALLBACK(0, "call-graph", &top.record_opts,
-		     "mode[,dump_size]", record_callchain_help,
-		     &parse_callchain_opt),
+		     "mode[,dump_size],output_type,min_percent[,print_limit],call_order[,branch]",
+		     top_callchain_help, &parse_callchain_opt),
 	OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
 		    "Accumulate callchains of children and show total overhead as well"),
 	OPT_INTEGER(0, "max-stack", &top.max_stack,
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 773fe13ce627..842be32899ee 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -77,12 +77,14 @@ static int parse_callchain_sort_key(const char *value)
 	return -1;
 }
 
-int
-parse_callchain_report_opt(const char *arg)
+static int
+__parse_callchain_report_opt(const char *arg, bool allow_record_opt)
 {
 	char *tok;
 	char *endptr;
 	bool minpcnt_set = false;
+	bool record_opt_set = false;
+	bool try_stack_size = false;
 
 	symbol_conf.use_callchain = true;
 
@@ -100,6 +102,28 @@ parse_callchain_report_opt(const char *arg)
 		    !parse_callchain_order(tok) ||
 		    !parse_callchain_sort_key(tok)) {
 			/* parsing ok - move on to the next */
+			try_stack_size = false;
+			goto next;
+		} else if (allow_record_opt && !record_opt_set) {
+			if (parse_callchain_record(tok, &callchain_param))
+				goto try_numbers;
+
+			/* assume that number followed by 'dwarf' is stack size */
+			if (callchain_param.record_mode == CALLCHAIN_DWARF)
+				try_stack_size = true;
+
+			record_opt_set = true;
+			goto next;
+		}
+
+try_numbers:
+		if (try_stack_size) {
+			unsigned long size = 0;
+
+			if (get_stack_size(tok, &size) < 0)
+				return -1;
+			callchain_param.dump_size = size;
+			try_stack_size = false;
 		} else if (!minpcnt_set) {
 			/* try to get the min percent */
 			callchain_param.min_percent = strtod(tok, &endptr);
@@ -112,7 +136,7 @@ parse_callchain_report_opt(const char *arg)
 			if (tok == endptr)
 				return -1;
 		}
-
+next:
 		arg = NULL;
 	}
 
@@ -123,6 +147,16 @@ parse_callchain_report_opt(const char *arg)
 	return 0;
 }
 
+int parse_callchain_report_opt(const char *arg)
+{
+	return __parse_callchain_report_opt(arg, false);
+}
+
+int parse_callchain_top_opt(const char *arg)
+{
+	return __parse_callchain_report_opt(arg, true);
+}
+
 int perf_callchain_config(const char *var, const char *value)
 {
 	char *endptr;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index c9e3a2e85a72..836d59a001bc 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -192,6 +192,7 @@ extern const char record_callchain_help[];
 extern int parse_callchain_record(const char *arg, struct callchain_param *param);
 int parse_callchain_record_opt(const char *arg, struct callchain_param *param);
 int parse_callchain_report_opt(const char *arg);
+int parse_callchain_top_opt(const char *arg);
 int perf_callchain_config(const char *var, const char *value);
 
 static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/8] perf tools: Defaults to 'caller' callchain order only if --children is enabled
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 3/8] perf top: Support call-graph display options also Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 5/8] perf tools: Improve call graph documents and help messages Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Adrian Hunter, Borislav Petkov,
	Chandler Carruth, David Ahern, Jiri Olsa, Peter Zijlstra,
	Stephane Eranian, Wang Nan, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The caller callchain order is useful with --children option since it can
show 'overview' style output, but other commands which don't use
--children feature like 'perf script' or even 'perf report/top' without
--children are better to keep callee order.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445499946-29817-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 2 ++
 tools/perf/builtin-top.c    | 3 +++
 tools/perf/util/callchain.c | 2 ++
 tools/perf/util/callchain.h | 1 +
 tools/perf/util/util.c      | 2 +-
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 18a8c52d921e..545c51cef7f7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -812,6 +812,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	if (report.inverted_callchain)
 		callchain_param.order = ORDER_CALLER;
+	if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
+		callchain_param.order = ORDER_CALLER;
 
 	if (itrace_synth_opts.callchain &&
 	    (int)itrace_synth_opts.callchain_sz > report.max_stack)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1de381d3f29f..af849b1d7389 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1304,6 +1304,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		perf_hpp__cancel_cumulate();
 	}
 
+	if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
+		callchain_param.order = ORDER_CALLER;
+
 	symbol_conf.priv_size = sizeof(struct annotation);
 
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 842be32899ee..735ad48e1858 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -51,10 +51,12 @@ static int parse_callchain_order(const char *value)
 {
 	if (!strncmp(value, "caller", strlen(value))) {
 		callchain_param.order = ORDER_CALLER;
+		callchain_param.order_set = true;
 		return 0;
 	}
 	if (!strncmp(value, "callee", strlen(value))) {
 		callchain_param.order = ORDER_CALLEE;
+		callchain_param.order_set = true;
 		return 0;
 	}
 	return -1;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 836d59a001bc..aaf467c9ef2b 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -75,6 +75,7 @@ struct callchain_param {
 	double			min_percent;
 	sort_chain_func_t	sort;
 	enum chain_order	order;
+	bool			order_set;
 	enum chain_key		key;
 	bool			branch_callstack;
 };
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index c1bf9ff210b0..cd12c25e4ea4 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -19,7 +19,7 @@
 struct callchain_param	callchain_param = {
 	.mode	= CHAIN_GRAPH_ABS,
 	.min_percent = 0.5,
-	.order  = ORDER_CALLER,
+	.order  = ORDER_CALLEE,
 	.key	= CCKEY_FUNCTION
 };
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/8] perf tools: Improve call graph documents and help messages
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 4/8] perf tools: Defaults to 'caller' callchain order only if --children is enabled Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 6/8] perf annotate: Fix 'annotate.use_offset' config variable usage Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Adrian Hunter, Borislav Petkov,
	Brendan Gregg, Chandler Carruth, David Ahern, Jiri Olsa,
	Peter Zijlstra, Stephane Eranian, Wang Nan,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The --call-graph option is complex so we should provide better guide for
users.  Also change help message to be consistent with config option
names.  Now perf top will show help like below:

  $ perf top --call-graph
    Error: option `call-graph' requires a value

   Usage: perf top [<options>]

      --call-graph <record_mode[,record_size],print_type,threshold[,print_limit],order,sort_key[,branch]>
           setup and enables call-graph (stack chain/backtrace):

		record_mode:	call graph recording mode (fp|dwarf|lbr)
		record_size:	if record_mode is 'dwarf', max size of stack recording (<bytes>)
				default: 8192 (bytes)
		print_type:	call graph printing style (graph|flat|fractal|none)
		threshold:	minimum call graph inclusion threshold (<percent>)
		print_limit:	maximum number of call graph entry (<number>)
		order:		call graph order (caller|callee)
		sort_key:	call graph sort key (function|address)
		branch:		include last branch info to call graph (branch)

		Default: fp,graph,0.5,caller,function

Requested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445524112-5201-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt |  9 ++++++--
 tools/perf/Documentation/perf-report.txt | 38 ++++++++++++++++++++------------
 tools/perf/builtin-record.c              |  5 +++--
 tools/perf/builtin-report.c              | 11 +++++----
 tools/perf/builtin-top.c                 |  5 +++--
 tools/perf/util/callchain.h              | 24 +++++++++++++++-----
 6 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index b027d28658f2..7ff6a9d0ea0d 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -144,7 +144,7 @@ OPTIONS
 
 --call-graph::
 	Setup and enable call-graph (stack chain/backtrace) recording,
-	implies -g.
+	implies -g.  Default is "fp".
 
 	Allows specifying "fp" (frame pointer) or "dwarf"
 	(DWARF's CFI - Call Frame Information) or "lbr"
@@ -154,13 +154,18 @@ OPTIONS
 	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.
+	the libunwind or libdw library) should be used instead.
 	Using the "lbr" method doesn't require any compiler options. It
 	will produce call graphs from the hardware LBR registers. The
 	main limition is that it is only available on new Intel
 	platforms, such as Haswell. It can only get user call chain. It
 	doesn't work with branch stack sampling at the same time.
 
+	When "dwarf" recording is used, perf also records (user) stack dump
+	when sampled.  Default size of the stack dump is 8192 (bytes).
+	User can change the size by passing the size after comma like
+	"--call-graph dwarf,4096".
+
 -q::
 --quiet::
 	Don't print any message, useful for scripting.
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index e4fdeeb51123..ab1fd64e3627 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -169,30 +169,40 @@ OPTIONS
 --dump-raw-trace::
         Dump raw trace in ASCII.
 
--g [type,min[,limit],order[,key][,branch]]::
---call-graph::
-        Display call chains using type, min percent threshold, optional print
-	limit and order.
-	type can be either:
+-g::
+--call-graph=<print_type,threshold[,print_limit],order,sort_key,branch>::
+        Display call chains using type, min percent threshold, print limit,
+	call order, sort key and branch.  Note that ordering of parameters is not
+	fixed so any parement can be given in an arbitraty order.  One exception
+	is the print_limit which should be preceded by threshold.
+
+	print_type can be either:
 	- flat: single column, linear exposure of call chains.
-	- graph: use a graph tree, displaying absolute overhead rates.
+	- graph: use a graph tree, displaying absolute overhead rates. (default)
 	- fractal: like graph, but displays relative rates. Each branch of
-		 the tree is considered as a new profiled object. +
+		 the tree is considered as a new profiled object.
+	- none: disable call chain display.
+
+	threshold is a percentage value which specifies a minimum percent to be
+	included in the output call graph.  Default is 0.5 (%).
+
+	print_limit is only applied when stdio interface is used.  It's to limit
+	number of call graph entries in a single hist entry.  Note that it needs
+	to be given after threshold (but not necessarily consecutive).
+	Default is 0 (unlimited).
 
 	order can be either:
 	- callee: callee based call graph.
 	- caller: inverted caller based call graph.
+	Default is 'caller' when --children is used, otherwise 'callee'.
 
-	key can be:
-	- function: compare on functions
+	sort_key can be:
+	- function: compare on functions (default)
 	- address: compare on individual code addresses
 
 	branch can be:
-	- branch: include last branch information in callgraph
-	when available. Usually more convenient to use --branch-history
-	for this.
-
-	Default: graph,0.5,caller
+	- branch: include last branch information in callgraph when available.
+	          Usually more convenient to use --branch-history for this.
 
 --children::
 	Accumulate callchain of children to parent entry so that then can
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 1a117623d396..2740d7a82ae8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1010,7 +1010,8 @@ static struct record record = {
 	},
 };
 
-const char record_callchain_help[] = CALLCHAIN_RECORD_HELP;
+const char record_callchain_help[] = CALLCHAIN_RECORD_HELP
+	"\n\t\t\t\tDefault: fp";
 
 /*
  * XXX Will stay a global variable till we fix builtin-script.c to stop messing
@@ -1058,7 +1059,7 @@ struct option __record_options[] = {
 			   NULL, "enables call-graph recording" ,
 			   &record_callchain_opt),
 	OPT_CALLBACK(0, "call-graph", &record.opts,
-		     "mode[,dump_size]", record_callchain_help,
+		     "record_mode[,record_size]", record_callchain_help,
 		     &record_parse_callchain_opt),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 545c51cef7f7..50dd4d3d8667 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -625,8 +625,11 @@ parse_percent_limit(const struct option *opt, const char *str,
 	return 0;
 }
 
-const char report_callchain_help[] = "Display callchains using " CALLCHAIN_REPORT_HELP ". "
-				     "Default: graph,0.5,caller";
+#define CALLCHAIN_DEFAULT_OPT  "graph,0.5,caller,function"
+
+const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
+				     CALLCHAIN_REPORT_HELP
+				     "\n\t\t\t\tDefault: " CALLCHAIN_DEFAULT_OPT;
 
 int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 {
@@ -636,7 +639,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	bool has_br_stack = false;
 	int branch_mode = -1;
 	bool branch_call_mode = false;
-	char callchain_default_opt[] = "graph,0.5,caller";
+	char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT;
 	const char * const report_usage[] = {
 		"perf report [<options>]",
 		NULL
@@ -703,7 +706,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,
-			     "output_type,min_percent[,print_limit],call_order[,branch]",
+			     "print_type,threshold[,print_limit],order,sort_key[,branch]",
 			     report_callchain_help, &report_parse_callchain_opt,
 			     callchain_default_opt),
 	OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index af849b1d7389..7e2e72e6d9d1 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1093,7 +1093,8 @@ parse_percent_limit(const struct option *opt, const char *arg,
 	return 0;
 }
 
-const char top_callchain_help[] = CALLCHAIN_RECORD_HELP ", " CALLCHAIN_REPORT_HELP;
+const char top_callchain_help[] = CALLCHAIN_RECORD_HELP CALLCHAIN_REPORT_HELP
+	"\n\t\t\t\tDefault: fp,graph,0.5,caller,function";
 
 int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 {
@@ -1173,7 +1174,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 			   NULL, "enables call-graph recording and display",
 			   &callchain_opt),
 	OPT_CALLBACK(0, "call-graph", &top.record_opts,
-		     "mode[,dump_size],output_type,min_percent[,print_limit],call_order[,branch]",
+		     "record_mode[,record_size],print_type,threshold[,print_limit],order,sort_key[,branch]",
 		     top_callchain_help, &parse_callchain_opt),
 	OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
 		    "Accumulate callchains of children and show total overhead as well"),
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index aaf467c9ef2b..fce8161e54db 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -7,17 +7,29 @@
 #include "event.h"
 #include "symbol.h"
 
-#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
+#define HELP_PAD "\t\t\t\t"
+
+#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace):\n\n"
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-#define CALLCHAIN_RECORD_HELP  CALLCHAIN_HELP "fp dwarf lbr"
+# define RECORD_MODE_HELP  HELP_PAD "record_mode:\tcall graph recording mode (fp|dwarf|lbr)\n"
 #else
-#define CALLCHAIN_RECORD_HELP  CALLCHAIN_HELP "fp lbr"
+# define RECORD_MODE_HELP  HELP_PAD "record_mode:\tcall graph recording mode (fp|lbr)\n"
 #endif
 
-#define CALLCHAIN_REPORT_HELP  "output_type (graph, flat, fractal, or none), " \
-	"min percent threshold, optional print limit, callchain order, " \
-	"key (function or address), add branches"
+#define RECORD_SIZE_HELP						\
+	HELP_PAD "record_size:\tif record_mode is 'dwarf', max size of stack recording (<bytes>)\n" \
+	HELP_PAD "\t\tdefault: 8192 (bytes)\n"
+
+#define CALLCHAIN_RECORD_HELP  CALLCHAIN_HELP RECORD_MODE_HELP RECORD_SIZE_HELP
+
+#define CALLCHAIN_REPORT_HELP						\
+	HELP_PAD "print_type:\tcall graph printing style (graph|flat|fractal|none)\n" \
+	HELP_PAD "threshold:\tminimum call graph inclusion threshold (<percent>)\n" \
+	HELP_PAD "print_limit:\tmaximum number of call graph entry (<number>)\n" \
+	HELP_PAD "order:\t\tcall graph order (caller|callee)\n" \
+	HELP_PAD "sort_key:\tcall graph sort key (function|address)\n"	\
+	HELP_PAD "branch:\t\tinclude last branch info to call graph (branch)\n"
 
 enum perf_call_graph_mode {
 	CALLCHAIN_NONE,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/8] perf annotate: Fix 'annotate.use_offset' config variable usage
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 5/8] perf tools: Improve call graph documents and help messages Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 7/8] perf ui tui: Register the error callbacks before initializing the widgets Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, David Ahern, Jiri Olsa,
	Martin Liška, Peter Zijlstra, Taeung Song,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The annotate__configs should be sorted so that it can use bsearch(3).

However commit 0c4a5bcea460 ("perf annotate: Display total number of
samples with --show-total-period") added a new config item at the end.
This resulted in the 'annotate.use_offset' config variable cannot be
found and perf terminated like below:

  $ perf report
  bad config file line 6 in ~/.perfconfig

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Fixes: 0c4a5bcea460 ("perf annotate: Display total number of samples with --show-total-period")
Link: http://lkml.kernel.org/r/1445396240-3428-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index bec0b62d8e38..ba72e018e99a 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -1125,8 +1125,8 @@ static struct annotate_config {
 	ANNOTATE_CFG(jump_arrows),
 	ANNOTATE_CFG(show_linenr),
 	ANNOTATE_CFG(show_nr_jumps),
-	ANNOTATE_CFG(use_offset),
 	ANNOTATE_CFG(show_total_period),
+	ANNOTATE_CFG(use_offset),
 };
 
 #undef ANNOTATE_CFG
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/8] perf ui tui: Register the error callbacks before initializing the widgets
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 6/8] perf annotate: Fix 'annotate.use_offset' config variable usage Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-22 22:14 ` [PATCH 8/8] perf annotate: Don't die() when finding an invalid config option Arnaldo Carvalho de Melo
  2015-10-23  8:28 ` [GIT PULL 0/8] perf/core improvements and fixes Ingo Molnar
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

I.e. we want to tell the user about errors found during, for instance,
the ui_browser initialization, so that a call to ui__warning() appears
as a window waiting for a key to be pressed.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ederrwizcl6mfz10vfobl5qq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/tui/setup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index 60d1f29b4b50..7dfeba0a91f3 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -141,10 +141,6 @@ int ui__init(void)
 
 	SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
 
-	ui_helpline__init();
-	ui_browser__init();
-	tui_progress__init();
-
 	signal(SIGSEGV, ui__signal_backtrace);
 	signal(SIGFPE, ui__signal_backtrace);
 	signal(SIGINT, ui__signal);
@@ -153,6 +149,10 @@ int ui__init(void)
 
 	perf_error__register(&perf_tui_eops);
 
+	ui_helpline__init();
+	ui_browser__init();
+	tui_progress__init();
+
 	hist_browser__init_hpp();
 out:
 	return err;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/8] perf annotate: Don't die() when finding an invalid config option
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 7/8] perf ui tui: Register the error callbacks before initializing the widgets Arnaldo Carvalho de Melo
@ 2015-10-22 22:14 ` Arnaldo Carvalho de Melo
  2015-10-23  8:28 ` [GIT PULL 0/8] perf/core improvements and fixes Ingo Molnar
  8 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-22 22:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The perf_config() infrastructure we inherited from git calls die() when
the provided config callback returns -1, meaning some key in a config
section is unexpected, that seems ok for a stdio based tool, but in
--tui we end up messing up the output, so just tell the user about the
error, wait for a keystroke and return 0, being more resilient and
proceeding with what we managed to parse.

That die() needs to die, tho :-)

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-pqtsffh2kwr5mwm4qg9kgotu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/annotate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index ba72e018e99a..d4d7cc27252f 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -1152,9 +1152,9 @@ static int annotate__config(const char *var, const char *value,
 		      sizeof(struct annotate_config), annotate_config__cmp);
 
 	if (cfg == NULL)
-		return -1;
-
-	*cfg->value = perf_config_bool(name, value);
+		ui__warning("%s variable unknown, ignoring...", var);
+	else
+		*cfg->value = perf_config_bool(name, value);
 	return 0;
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [GIT PULL 0/8] perf/core improvements and fixes
  2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2015-10-22 22:14 ` [PATCH 8/8] perf annotate: Don't die() when finding an invalid config option Arnaldo Carvalho de Melo
@ 2015-10-23  8:28 ` Ingo Molnar
  8 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2015-10-23  8:28 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, Brendan Gregg,
	Chandler Carruth, Dave Chinner, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Martin Liška, Namhyung Kim, Peter Zijlstra,
	Scott Wood, Stephane Eranian, Steven Rostedt, Taeung Song,
	Wang Nan, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 4ba792e303e278052bb0ee60cce15d6d7dc15c7c:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-22 09:33:46 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to f06cff7c59b6b252d667435d7baad48687b41002:
> 
>   perf annotate: Don't die() when finding an invalid config option (2015-10-22 18:10:52 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - The default for callchains is back to 'callee' when --children is not used,
>   (Namhyung Kim)
> 
> - Move the 'use_offset' option to the right place where the annotate code
>   expects it to be to be able to properly handle it (Namhyung Kim)
> 
> - Don't die when an unknown 'annotate' option is found in the perf config
>   file (usually ~/.perfconfig), just warn the user (Arnaldo Carvalho de Melo)
> 
> Infrastructure:
> 
> - Support %ps/%pS in libtraceevent (Scott Wood)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (2):
>       perf ui tui: Register the error callbacks before initializing the widgets
>       perf annotate: Don't die() when finding an invalid config option
> 
> Namhyung Kim (5):
>       perf tools: Move callchain help messages to callchain.h
>       perf top: Support call-graph display options also
>       perf tools: Defaults to 'caller' callchain order only if --children is enabled
>       perf tools: Improve call graph documents and help messages
>       perf annotate: Fix 'annotate.use_offset' config variable usage
> 
> Scott Wood (1):
>       tools lib traceevent: Support %ps/%pS
> 
>  tools/lib/traceevent/event-parse.c       |  4 +--
>  tools/perf/Documentation/perf-record.txt |  9 +++++--
>  tools/perf/Documentation/perf-report.txt | 38 ++++++++++++++++++-----------
>  tools/perf/Documentation/perf-top.txt    |  5 ++--
>  tools/perf/builtin-record.c              | 11 +++------
>  tools/perf/builtin-report.c              | 17 ++++++++++---
>  tools/perf/builtin-top.c                 | 30 +++++++++++++++++++----
>  tools/perf/ui/browsers/annotate.c        |  8 +++---
>  tools/perf/ui/tui/setup.c                |  8 +++---
>  tools/perf/util/callchain.c              | 42 +++++++++++++++++++++++++++++---
>  tools/perf/util/callchain.h              | 26 ++++++++++++++++++++
>  tools/perf/util/util.c                   |  2 +-
>  12 files changed, 151 insertions(+), 49 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-23  8:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 22:14 [GIT PULL 0/8] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 1/8] tools lib traceevent: Support %ps/%pS Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 2/8] perf tools: Move callchain help messages to callchain.h Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 3/8] perf top: Support call-graph display options also Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 4/8] perf tools: Defaults to 'caller' callchain order only if --children is enabled Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 5/8] perf tools: Improve call graph documents and help messages Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 6/8] perf annotate: Fix 'annotate.use_offset' config variable usage Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 7/8] perf ui tui: Register the error callbacks before initializing the widgets Arnaldo Carvalho de Melo
2015-10-22 22:14 ` [PATCH 8/8] perf annotate: Don't die() when finding an invalid config option Arnaldo Carvalho de Melo
2015-10-23  8:28 ` [GIT PULL 0/8] perf/core improvements and fixes Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).