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, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Taeung Song <treeze.taeung@gmail.com>
Subject: [PATCH v13 19/23] perf config: Add --verbose option for showing config description
Date: Fri,  8 Jan 2016 20:39:49 +0900	[thread overview]
Message-ID: <1452253193-30502-20-git-send-email-treeze.taeung@gmail.com> (raw)
In-Reply-To: <1452253193-30502-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@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/Documentation/perf-config.txt |   4 +
 tools/perf/builtin-config.c              | 170 ++++++++++++++++++++-----------
 2 files changed, 114 insertions(+), 60 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 9d348d3..3706ea2 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -41,6 +41,10 @@ OPTIONS
 --skel::
 	Produce an skeleton with the possible config variables.
 
+-v::
+--verbose::
+	Be more verbose. (show config description)
+
 CONFIGURATION FILE
 ------------------
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 4806b93..8c28de8 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()
@@ -111,71 +113,117 @@ 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(ANNOTATE_SHOW_LINENR, "annotate", "show_linenr", false),
-	CONF_BOOL_VAR(ANNOTATE_SHOW_TOTAL_PERIOD, "annotate", "show_total_period", 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_GROUP, "report", "group", false),
-	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(ANNOTATE_SHOW_LINENR, "annotate", "show_linenr", false,
+		      "Show line numbers"),
+	CONF_BOOL_VAR(ANNOTATE_SHOW_TOTAL_PERIOD, "annotate", "show_total_period", false,
+		      "Show a column with the sum of periods"),
+	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_GROUP, "report", "group", false,
+		      "Show event group information together"),
+	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()
 };
 
@@ -297,6 +345,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);
 	}
-- 
2.5.0

  parent reply	other threads:[~2016-01-08 11:40 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
2016-01-08 11:39 ` [PATCH v13 01/23] perf config: Document variables for 'colors' section in man page Taeung Song
2016-02-03 10:09   ` [tip:perf/core] " tip-bot for Taeung Song
2016-01-08 11:39 ` [PATCH v13 02/23] perf config: Document variables for 'tui' and 'gtk' sections " Taeung Song
2016-02-03 10:09   ` [tip:perf/core] perf config: Document variables for 'tui' and ' gtk' " tip-bot for Taeung Song
2016-01-08 11:39 ` [PATCH v13 03/23] perf config: Document 'buildid.dir' variable " Taeung Song
2016-02-03 10:09   ` [tip:perf/core] " tip-bot for Taeung Song
2016-01-08 11:39 ` [PATCH v13 04/23] perf config: Document variables for 'annotate' section " Taeung Song
2016-01-21 14:45   ` Arnaldo Carvalho de Melo
2016-01-22  7:11     ` Taeung Song
2016-02-03 10:10   ` [tip:perf/core] " tip-bot for Taeung Song
2016-01-08 11:39 ` [PATCH v13 05/23] perf config: Document variables for 'help' " Taeung Song
2016-01-21 14:46   ` Arnaldo Carvalho de Melo
2016-01-22  8:00     ` Taeung Song
2016-01-08 11:39 ` [PATCH v13 06/23] perf config: Document 'hist.percentage' variable " Taeung Song
2016-01-21 14:54   ` Arnaldo Carvalho de Melo
2016-01-22  8:03     ` Taeung Song
2016-02-03 10:10   ` [tip:perf/core] " tip-bot for Taeung Song
2016-01-08 11:39 ` [PATCH v13 07/23] perf config: Document 'ui.show-headers' " Taeung Song
2016-01-08 11:39 ` [PATCH v13 08/23] perf config: Document variables for 'call-graph' section " Taeung Song
2016-01-08 11:39 ` [PATCH v13 09/23] perf config: Document variables for 'report' " Taeung Song
2016-01-08 11:39 ` [PATCH v13 10/23] perf config: Document 'top.children' variable " Taeung Song
2016-01-08 11:39 ` [PATCH v13 11/23] perf config: Document 'man.viewer' " Taeung Song
2016-01-08 11:39 ` [PATCH v13 12/23] perf config: Document 'pager.<subcommand>' variables " Taeung Song
2016-01-08 11:39 ` [PATCH v13 13/23] perf config: Document 'kmem.default' variable " Taeung Song
2016-01-08 11:39 ` [PATCH v13 14/23] perf config: Document 'record.build-id' " Taeung Song
2016-01-08 11:39 ` [PATCH v13 15/23] perf config: Add '--system' and '--user' options to select which config file is used Taeung Song
2016-01-08 11:39 ` [PATCH v13 16/23] perf config: Collect configs to handle config variables Taeung Song
2016-01-08 11:39 ` [PATCH v13 17/23] perf config: Add 'list-all' option to perf-config Taeung Song
2016-01-08 11:39 ` [PATCH v13 18/23] perf config: Add a option 'skel' " Taeung Song
2016-01-08 11:39 ` Taeung Song [this message]
2016-01-08 11:39 ` [PATCH v13 20/23] perf config: Add 'get' functionality Taeung Song
2016-01-08 11:39 ` [PATCH v13 21/23] perf config: Add 'set' feature Taeung Song
2016-01-08 11:39 ` [PATCH v13 22/23] perf config: normalize a value depending on default type of it Taeung Song
2016-01-08 11:39 ` [PATCH v13 23/23] perf config: Add a option 'remove' to perf-config 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=1452253193-30502-20-git-send-email-treeze.taeung@gmail.com \
    --to=treeze.taeung@gmail.com \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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