mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Taeung Song <treeze.taeung@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Taeung Song <treeze.taeung@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH v11 20/24] perf config: Add --verbose option for showing config description
Date: Tue, 17 Nov 2015 22:53:40 +0900	[thread overview]
Message-ID: <1447768424-17327-20-git-send-email-treeze.taeung@gmail.com> (raw)
In-Reply-To: <1447768424-17327-1-git-send-email-treeze.taeung@gmail.com>

To explain what each of variable options configures,
this option can be used with --skel option, i.e.

    print the possible config variables with comments over each of them.
    # perf config -k -v | --skel --verbose

Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/builtin-config.c | 161 ++++++++++++++++++++++++++++----------------
 1 file changed, 104 insertions(+), 57 deletions(-)

diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 2f8be59..c84ea7d 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -35,6 +35,8 @@ static struct option config_options[] = {
 	OPT_SET_UINT('k', "skel", &actions,
 		     "produce an skeleton with the possible"
 		     " config variables", ACTION_SKEL),
+	OPT_INCR('v', "verbose", &verbose, "Be more verbose"
+		 " (show config description)"),
 	OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
 	OPT_BOOLEAN(0, "user", &use_user_config, "use user config file"),
 	OPT_END()
@@ -108,68 +110,111 @@ struct config_item {
 		const char *s;
 	} value;
 	enum config_type type;
+	const char *desc;
 };
 
-#define CONF_VAR(_sec, _name, _field, _val, _type) \
-	{ .section = _sec, .name = _name, .value._field = _val, .type = _type }
-
-#define CONF_BOOL_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, b, _val, CONFIG_TYPE_BOOL)
-#define CONF_INT_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, i, _val, CONFIG_TYPE_INT)
-#define CONF_LONG_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, l, _val, CONFIG_TYPE_LONG)
-#define CONF_U64_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, ll, _val, CONFIG_TYPE_U64)
-#define CONF_FLOAT_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, f, _val, CONFIG_TYPE_FLOAT)
-#define CONF_DOUBLE_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, d, _val, CONFIG_TYPE_DOUBLE)
-#define CONF_STR_VAR(_idx, _sec, _name, _val) \
-	[CONFIG_##_idx] = CONF_VAR(_sec, _name, s, _val, CONFIG_TYPE_STRING)
+#define CONF_VAR(_sec, _name, _field, _val, _type, _desc)			\
+	{ .section = _sec, .name = _name, .value._field = _val, .type = _type, .desc = _desc}
+
+#define CONF_BOOL_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, b, _val, CONFIG_TYPE_BOOL, _desc)
+#define CONF_INT_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, i, _val, CONFIG_TYPE_INT, _desc)
+#define CONF_LONG_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, l, _val, CONFIG_TYPE_LONG, _desc)
+#define CONF_U64_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, ll, _val, CONFIG_TYPE_U64, _desc)
+#define CONF_FLOAT_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, f, _val, CONFIG_TYPE_FLOAT, _desc)
+#define CONF_DOUBLE_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, d, _val, CONFIG_TYPE_DOUBLE, _desc)
+#define CONF_STR_VAR(_idx, _sec, _name, _val, _desc) \
+	[CONFIG_##_idx] = CONF_VAR(_sec, _name, s, _val, CONFIG_TYPE_STRING, _desc)
 #define CONF_END() { .type = CONFIG_END }
 
 struct config_item default_configs[] = {
-	CONF_STR_VAR(COLORS_TOP, "colors", "top", "red, default"),
-	CONF_STR_VAR(COLORS_MEDIUM, "colors", "medium", "green, default"),
-	CONF_STR_VAR(COLORS_NORMAL, "colors", "normal", "lightgray, default"),
-	CONF_STR_VAR(COLORS_SELECTED, "colors", "selected", "white, lightgray"),
-	CONF_STR_VAR(COLORS_CODE, "colors", "code", "blue, default"),
-	CONF_STR_VAR(COLORS_ADDR, "colors", "addr", "magenta, default"),
-	CONF_STR_VAR(COLORS_ROOT, "colors", "root", "white, blue"),
-	CONF_BOOL_VAR(TUI_REPORT, "tui", "report", true),
-	CONF_BOOL_VAR(TUI_ANNOTATE, "tui", "annotate", true),
-	CONF_BOOL_VAR(TUI_TOP, "tui", "top", true),
-	CONF_STR_VAR(BUILDID_DIR, "buildid", "dir", "~/.debug"),
-	CONF_BOOL_VAR(ANNOTATE_HIDE_SRC_CODE, "annotate", "hide_src_code", false),
-	CONF_BOOL_VAR(ANNOTATE_USE_OFFSET, "annotate", "use_offset", true),
-	CONF_BOOL_VAR(ANNOTATE_JUMP_ARROWS, "annotate", "jump_arrows", true),
-	CONF_BOOL_VAR(ANNOTATE_SHOW_NR_JUMPS, "annotate", "show_nr_jumps", false),
-	CONF_BOOL_VAR(GTK_ANNOTATE, "gtk", "annotate", false),
-	CONF_BOOL_VAR(GTK_REPORT, "gtk", "report", false),
-	CONF_BOOL_VAR(GTK_TOP, "gtk", "top", false),
-	CONF_BOOL_VAR(PAGER_CMD, "pager", "cmd", true),
-	CONF_BOOL_VAR(PAGER_REPORT, "pager", "report", true),
-	CONF_BOOL_VAR(PAGER_ANNOTATE, "pager", "annotate", true),
-	CONF_BOOL_VAR(PAGER_TOP, "pager", "top", true),
-	CONF_BOOL_VAR(PAGER_DIFF, "pager", "diff", true),
-	CONF_STR_VAR(HELP_FORMAT, "help", "format", "man"),
-	CONF_INT_VAR(HELP_AUTOCORRECT, "help", "autocorrect", 0),
-	CONF_STR_VAR(HIST_PERCENTAGE, "hist", "percentage", "absolute"),
-	CONF_BOOL_VAR(UI_SHOW_HEADERS, "ui", "show-headers", true),
-	CONF_STR_VAR(CALL_GRAPH_RECORD_MODE, "call-graph", "record-mode", "fp"),
-	CONF_LONG_VAR(CALL_GRAPH_DUMP_SIZE, "call-graph", "dump-size", 8192),
-	CONF_STR_VAR(CALL_GRAPH_PRINT_TYPE, "call-graph", "print-type", "graph"),
-	CONF_STR_VAR(CALL_GRAPH_ORDER, "call-graph", "order", "callee"),
-	CONF_STR_VAR(CALL_GRAPH_SORT_KEY, "call-graph", "sort-key", "function"),
-	CONF_DOUBLE_VAR(CALL_GRAPH_THRESHOLD, "call-graph", "threshold", 0.5),
-	CONF_LONG_VAR(CALL_GRAPH_PRINT_LIMIT, "call-graph", "print-limit", 0),
-	CONF_BOOL_VAR(REPORT_CHILDREN, "report", "children", true),
-	CONF_FLOAT_VAR(REPORT_PERCENT_LIMIT, "report", "percent-limit", 0),
-	CONF_U64_VAR(REPORT_QUEUE_SIZE, "report", "queue-size", 0),
-	CONF_BOOL_VAR(TOP_CHILDREN, "top", "children", true),
-	CONF_STR_VAR(MAN_VIEWER, "man", "viewer", "man"),
-	CONF_STR_VAR(KMEM_DEFAULT, "kmem", "default", "slab"),
+	CONF_STR_VAR(COLORS_TOP, "colors", "top", "red, default",
+		     "A overhead percentage which is more than 5%"),
+	CONF_STR_VAR(COLORS_MEDIUM, "colors", "medium", "green, default",
+		     "A overhead percentage which has more than 0.5%"),
+	CONF_STR_VAR(COLORS_NORMAL, "colors", "normal", "lightgray, default",
+		     "The rest of overhead percentages"),
+	CONF_STR_VAR(COLORS_SELECTED, "colors", "selected", "white, lightgray",
+		     "The current entry in a list of entries on TUI"),
+	CONF_STR_VAR(COLORS_CODE, "colors", "code", "blue, default",
+		     "Arrows and lines in jumps on  assembly code listings"),
+	CONF_STR_VAR(COLORS_ADDR, "colors", "addr", "magenta, default",
+		     "Addresses from 'annotate"),
+	CONF_STR_VAR(COLORS_ROOT, "colors", "root", "white, blue",
+		     "Headers in the output of a sub-command 'top'"),
+	CONF_BOOL_VAR(TUI_REPORT, "tui", "report", true,
+		      "TUI can be enabled or not"),
+	CONF_BOOL_VAR(TUI_ANNOTATE, "tui", "annotate", true,
+		      "TUI can be enabled or not"),
+	CONF_BOOL_VAR(TUI_TOP, "tui", "top", true,
+		      "TUI can be enabled or not"),
+	CONF_STR_VAR(BUILDID_DIR, "buildid", "dir", "~/.debug",
+		     "The directory location of binaries, shared libraries,"
+		     " /proc/kallsyms and /proc/kcore files to be used"
+		     " at analysis time"),
+	CONF_BOOL_VAR(ANNOTATE_HIDE_SRC_CODE, "annotate", "hide_src_code", false,
+		      "Print a list of assembly code without the source code or not"),
+	CONF_BOOL_VAR(ANNOTATE_USE_OFFSET, "annotate", "use_offset", true,
+		      "Addresses subtracted from a base address can be printed"),
+	CONF_BOOL_VAR(ANNOTATE_JUMP_ARROWS, "annotate", "jump_arrows", true,
+		      "Arrows for jump instruction can be printed or not"),
+	CONF_BOOL_VAR(ANNOTATE_SHOW_NR_JUMPS, "annotate", "show_nr_jumps", false,
+		      "The number of branches branching to that address can be printed"),
+	CONF_BOOL_VAR(GTK_ANNOTATE, "gtk", "annotate", false,
+		      "GTK can be enabled or not"),
+	CONF_BOOL_VAR(GTK_REPORT, "gtk", "report", false,
+		      "GTK can be enabled or not"),
+	CONF_BOOL_VAR(GTK_TOP, "gtk", "top", false,
+		      "GTK can be enabled or not"),
+	CONF_BOOL_VAR(PAGER_CMD, "pager", "cmd", true,
+		      "As stdio instead of TUI"),
+	CONF_BOOL_VAR(PAGER_REPORT, "pager", "report", true,
+		      "As stdio instead of TUI"),
+	CONF_BOOL_VAR(PAGER_ANNOTATE, "pager", "annotate", true,
+		      "As stdio instead of TUI"),
+	CONF_BOOL_VAR(PAGER_TOP, "pager", "top", true,
+		      "As stdio instead of TUI"),
+	CONF_BOOL_VAR(PAGER_DIFF, "pager", "diff", true,
+		      "As stdio instead of TUI"),
+	CONF_STR_VAR(HELP_FORMAT, "help", "format", "man", "A format of manual page"),
+	CONF_INT_VAR(HELP_AUTOCORRECT, "help", "autocorrect", 0,
+		     "Automatically correct and execute mistyped commands after"
+		     " waiting for the given number of deciseconds"),
+	CONF_STR_VAR(HIST_PERCENTAGE, "hist", "percentage", "absolute",
+		     "Control a way to calcurate overhead of filtered entries"),
+	CONF_BOOL_VAR(UI_SHOW_HEADERS, "ui", "show-headers", true,
+		      "Show or hide columns as header on TUI"),
+	CONF_STR_VAR(CALL_GRAPH_RECORD_MODE, "call-graph", "record-mode", "fp",
+		     "The mode can be 'fp' (frame pointer) and 'dwarf'"),
+	CONF_LONG_VAR(CALL_GRAPH_DUMP_SIZE, "call-graph", "dump-size", 8192,
+		      "The size of stack to dump in order to do post-unwinding"),
+	CONF_STR_VAR(CALL_GRAPH_PRINT_TYPE, "call-graph", "print-type", "graph",
+		     "The type can be graph (graph absolute), fractal (graph relative), fla"),
+	CONF_STR_VAR(CALL_GRAPH_ORDER, "call-graph", "order", "callee",
+		     "Controls print order of callchains (callee or caller)"),
+	CONF_STR_VAR(CALL_GRAPH_SORT_KEY, "call-graph", "sort-key", "function",
+		     "It can be 'function' or 'address'"),
+	CONF_DOUBLE_VAR(CALL_GRAPH_THRESHOLD, "call-graph", "threshold", 0.5,
+			"Small callchains can be omitted under a certain overhead (threshold)"),
+	CONF_LONG_VAR(CALL_GRAPH_PRINT_LIMIT, "call-graph", "print-limit", 0,
+		      "Control the number of callchains printed for a single entry"),
+	CONF_BOOL_VAR(REPORT_CHILDREN, "report", "children", true,
+		      "Accumulate callchain of children and show total overhead or not"),
+	CONF_FLOAT_VAR(REPORT_PERCENT_LIMIT, "report", "percent-limit", 0,
+		       "Entries have overhead lower than this percentage will not be printed"),
+	CONF_U64_VAR(REPORT_QUEUE_SIZE, "report", "queue-size", 0,
+		     "The maximum allocation size for session's ordered events queue"),
+	CONF_BOOL_VAR(TOP_CHILDREN, "top", "children", true,
+		      "Similar as report.children"),
+	CONF_STR_VAR(MAN_VIEWER, "man", "viewer", "man",
+		     "Select manual tools that work a sub-command 'help'"),
+	CONF_STR_VAR(KMEM_DEFAULT, "kmem", "default", "slab",
+		     "Which allocator is analyzed between 'slab' and 'page"),
 	CONF_END()
 };
 
@@ -291,6 +336,8 @@ static int show_skel_config(void)
 			section = (char *)config->section;
 			printf("\n[%s]\n", config->section);
 		}
+		if (verbose)
+			printf("\t# %s\n", config->desc);
 		printf("\t%s = %s\n", config->name, value);
 		free(value);
 	}
-- 
1.9.1


  parent reply	other threads:[~2015-11-17 18:33 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 13:53 [PATCH v11 01/24] perf tools: Add 'perf-config' command Taeung Song
2015-11-17 13:53 ` [PATCH v11 02/24] perf tools: Add perf-config document Taeung Song
2015-11-17 23:13   ` Namhyung Kim
2015-11-19 19:24     ` Arnaldo Carvalho de Melo
2015-11-22 10:07       ` Taeung Song
2015-11-22 10:11       ` [PATCH v11 RESEND " Taeung Song
2015-11-23 14:17         ` Arnaldo Carvalho de Melo
2015-11-26  8:20         ` [tip:perf/core] perf config: Add initial man page tip-bot for Taeung Song
2015-11-17 13:53 ` [PATCH v11 03/24] perf config: Document variables for 'color' section in " Taeung Song
2015-11-17 23:47   ` Namhyung Kim
2015-12-01  3:59     ` Taeung Song
2015-11-17 13:53 ` [PATCH v11 04/24] perf config: Document variables for 'tui' and 'gtk' sections " Taeung Song
2015-11-18  0:01   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 05/24] perf config: Document 'buildid.dir' variable " Taeung Song
2015-11-18  0:03   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 06/24] perf config: Document variables for 'annotate' section " Taeung Song
2015-11-18  0:24   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 07/24] perf config: Document variables for 'help' " Taeung Song
2015-11-18  0:45   ` Namhyung Kim
2015-12-01 16:17     ` Taeung Song
2015-11-17 13:53 ` [PATCH v11 08/24] perf config: Document 'hist.percentage' variable " Taeung Song
2015-11-18  0:49   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 09/24] perf config: Document 'ui.show-headers' " Taeung Song
2015-11-18  0:59   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 10/24] perf config: Document variables for 'call-graph' section " Taeung Song
2015-11-18  2:51   ` Namhyung Kim
2015-11-30  1:42     ` Taeung Song
2015-11-30  5:03       ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 11/24] perf config: Document variables for 'report' " Taeung Song
2015-11-18  3:01   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 12/24] perf config: Document 'top.chidren' variable " Taeung Song
2015-11-18  3:04   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 13/24] perf config: Document 'man.viewer' " Taeung Song
2015-11-18  4:58   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 14/24] perf config: Document 'pager.<subcommand>' variables " Taeung Song
2015-11-18  5:05   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 15/24] perf config: Document 'kmem.default' variable " Taeung Song
2015-11-18  5:08   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 16/24] perf config: Add '--system' and '--user' options to select which config file is used Taeung Song
2015-11-18  5:11   ` Namhyung Kim
2015-11-17 13:53 ` [PATCH v11 17/24] perf config: Collect configs to handle config variables Taeung Song
2015-11-18  5:15   ` Namhyung Kim
2016-03-04 12:45     ` Taeung Song
2016-03-04 13:58       ` Namhyung Kim
2016-03-05  2:55         ` Taeung Song
2015-11-17 13:53 ` [PATCH v11 18/24] perf config: Add 'list-all' option to perf-config Taeung Song
2015-11-17 13:53 ` [PATCH v11 19/24] perf config: Add a option 'skel' " Taeung Song
2015-11-17 13:53 ` Taeung Song [this message]
2015-11-17 13:53 ` [PATCH v11 21/24] perf config: Add 'get' functionality Taeung Song
2015-11-17 13:53 ` [PATCH v11 22/24] perf config: Add 'set' feature Taeung Song
2015-11-17 13:53 ` [PATCH v11 23/24] perf config: normalize a value depending on default type of it Taeung Song
2015-11-17 13:53 ` [PATCH v11 24/24] perf config: Add a option 'remove' to perf-config Taeung Song
2015-11-17 22:36 ` [PATCH v11 01/24] perf tools: Add 'perf-config' command Namhyung Kim
2015-11-26  8:20 ` [tip:perf/core] perf tools: Add 'perf config' command tip-bot for Taeung Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447768424-17327-20-git-send-email-treeze.taeung@gmail.com \
    --to=treeze.taeung@gmail.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome