All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info
@ 2016-01-08 11:39 Taeung Song
  2016-01-08 11:39 ` [PATCH v13 01/23] perf config: Document variables for 'colors' section in man page Taeung Song
                   ` (22 more replies)
  0 siblings, 23 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Add options (user, system, list-all, skel, verbose, remove) and
getting and setting features into perf-config subcommand to more useful.
And document perf config informations for each section.

Changes in v13:
	- Add record.build-id config info to perf-config doc [Namhyung]
	- Fill missing options info ('verbose', 'skel') on perf-config doc

Changes in v12:
	- Modify perf-config documentation for each section to be more proper
	  and correct small typing errors [Namhyung]
	- Add missing config variables that are group, show_linenr and
	  show_total_period [Namhyung]

Changes in v11:
	- Add --skel option to produce an skeleton with the possible config
	  variables [Arnaldo]
	- Add exception handling to --list option when nothing configured [Arnaldo]
	- Default action without option is to show an usage message [Arnaldo]

Changes in v10:
	- Split perf-config.txt into several patches for each section and replace some
	  paragraphes with better proper things [Arnaldo, Namhyung]
	- Correct wrong default values for each variable [Namhyung]
	- Remove the compare name function

Changes in v9:
	- Add the compare name functionality treating '-' and '-' as being
	  the same thing for usability

Changes in v8:
	- Correct small typing errors in a perf-config documention
	- Split the collecting configs part into a separate patch
	- Use new enum and struct for default configs instead of
	  hard-coded value [Namhyung]

Changes in v7:
	- Modify explanations of syntax and options(color, gtk, tui, buildid, annotate)
	  to be better proper descriptions [Arnaldo]

Changes in v6:
	- Split a 'set' feature patch into two patch to separate normalize_value() from it
	- Bug fix : 'remove' and 'set' malfunctions when without a specific file-option
	  (If file-option isn't used, 'remove' feature had to use both user and system
	  config file and 'set' feature had to only handle user config file.)

Changes in v5:
	- Simplify the switch statement in cmd_config()
	- Set a config file path with '--system' or '--user'
	  instead of '--global' or '--system' [Namhyung]
	- The patch about 'get' and 'set 'split into two patchs [Namhyung]

Changes in v4:
	- If some config value is default value, notice it is '(default)' [Jirka]
	- If there wasn't any perfconfig file, perf-config malfunctioned
	  So add exception routine with '--global' and '--system'
	  option which can select perf config file path [Jirka]

Changes in v3:
	- Add a config variable 'kmem.default' with a default value [Namhyung]

Changes in v2:
	- Change option name of listing all configs as '--list-all'
	  instead of '--all' [Namhyung]
	- Correct small infelicities or typing errors in a perf-config documention [Arnaldo]
	- Declaration a global variable 'static struct default_configsets' has config
	  variables with default values instead of using a 'util/PERFCONFIG-DEFAULT' file.
	- Add a function to normalize a value and check data type of it.
	- Simplify parsing arguments as arguments is just divided by '=' and then
	  in front of '.' is a section, between '.' and '=' is a name,
	  and behind '=' is a value.
	- If run perf-config command without any option, perf-config work as '--list'.

Taeung Song (23):
  perf config: Document variables for 'colors' section in man page
  perf config: Document variables for 'tui' and 'gtk' sections in man
       	       page
  perf config: Document 'buildid.dir' variable in man page
  perf config: Document variables for 'annotate' section in man page
  perf config: Document variables for 'help' section in man page
  perf config: Document 'hist.percentage' variable in man page
  perf config: Document 'ui.show-headers' variable in man page
  perf config: Document variables for 'call-graph' section in man page
  perf config: Document variables for 'report' section in man page
  perf config: Document 'top.children' variable in man page
  perf config: Document 'man.viewer' variable in man page
  perf config: Document 'pager.<subcommand>' variables in man page
  perf config: Document 'kmem.default' variable in man page
  perf config: Document 'record.build-id' variable in man page
  perf config: Add '--system' and '--user' options to select which
       	       config file is used
  perf config: Collect configs to handle config variables
  perf config: Add 'list-all' option to perf-config
  perf config: Add a option 'skel' to perf-config
  perf config: Add --verbose option for showing config description
  perf config: Add 'get' functionality
  perf config: Add 'set' feature
  perf config: normalize a value depending on default type of it
  perf config: Add a option 'remove' to perf-config

 tools/perf/Documentation/perf-config.txt | 380 ++++++++++++++++-
 tools/perf/builtin-config.c              | 709 ++++++++++++++++++++++++++++++-
 tools/perf/util/cache.h                  |  20 +
 tools/perf/util/config.c                 |  31 +-
 4 files changed, 1126 insertions(+), 14 deletions(-)

-- 
2.5.0

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

* [PATCH v13 01/23] perf config: Document variables for 'colors' section in man page
  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 ` 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
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'colors' section and its variables.

'top', 'medium', 'normal', 'selected',
'code', 'addr' and 'root'.

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 | 46 ++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index b9ca1e3..e77dcd1 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -98,6 +98,52 @@ Given a $HOME/.perfconfig like this:
 		order = caller
 		sort-key = function
 
+Variables
+~~~~~~~~~
+
+colors.*::
+	The variables for customizing the colors used in the output for the
+	'report', 'top' and 'annotate' in the TUI. They should specify the
+	foreground and background colors, separated by a comma, for example:
+
+		medium = green, lightgray
+
+	If you want to use the color configured for you terminal, just leave it
+	as 'default', for example:
+
+		medium = default, lightgray
+
+	Available colors:
+	red, yellow, green, cyan, gray, black, blue,
+	white, default, magenta, lightgray
+
+	colors.top::
+		'top' means a overhead percentage which is more than 5%.
+		And values of this variable specify percentage colors.
+		Basic key values are foreground-color 'red' and
+		background-color 'default'.
+	colors.medium::
+		'medium' means a overhead percentage which has more than 0.5%.
+		Default values are 'green' and 'default'.
+	colors.normal::
+		'normal' means the rest of overhead percentages
+		except 'top', 'medium', 'selected'.
+		Default values are 'lightgray' and 'default'.
+	colors.selected::
+		This selects the colors for the current entry in a list of entries
+		from sub-commands (top, report, annotate).
+		Default values are 'black' and 'lightgray'.
+	colors.jump_arrows::
+		Colors for jump arrows on assembly code listings
+		such as 'jns', 'jmp', 'jane', etc.
+		Default values are 'blue', 'default'.
+	colors.addr::
+		This selects colors for addresses from 'annotate'.
+		Default values are 'magenta', 'default'.
+	colors.root::
+		Colors for headers in the output of a sub-commands (top, report).
+		Default values are 'white', 'blue'.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 02/23] perf config: Document variables for 'tui' and 'gtk' sections in man page
  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-01-08 11:39 ` 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
                   ` (20 subsequent siblings)
  22 siblings, 1 reply; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'tui' and 'gtk' sections and these variables.

'top', 'report' and 'annotate'

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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index e77dcd1..9d752ca 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -144,6 +144,15 @@ colors.*::
 		Colors for headers in the output of a sub-commands (top, report).
 		Default values are 'white', 'blue'.
 
+tui.*, gtk.*::
+	Available subcommands are 'top', 'report' and 'annotate'.
+	These values are a boolean type, for example:
+
+		top = true
+
+	By setting value, TUI or GTK can be enabled or not. But it is needed
+	that perf detects the required library for them during build.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 03/23] perf config: Document 'buildid.dir' variable in man page
  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-01-08 11:39 ` [PATCH v13 02/23] perf config: Document variables for 'tui' and 'gtk' sections " Taeung Song
@ 2016-01-08 11:39 ` 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
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'buildid.dir' variable.

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 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 9d752ca..8835215 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -153,6 +153,21 @@ tui.*, gtk.*::
 	By setting value, TUI or GTK can be enabled or not. But it is needed
 	that perf detects the required library for them during build.
 
+buildid.*::
+	buildid.dir::
+		Each executable and shared library in modern distributions comes with a
+		content based identifier that, if available, will be inserted in a
+		'perf.data' file header to, at analysis time find what is needed to do
+		symbol resolution, code annotation, etc.
+
+		The recording tools also stores a hard link or copy in a per-user
+		directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms
+		and /proc/kcore files to be used at analysis time.
+
+		The buildid.dir variable can be used to either change this directory
+		cache location, or to disable it altogether. If you want to disable it,
+		set buildid.dir to /dev/null. The default is $HOME/.debug
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 04/23] perf config: Document variables for 'annotate' section in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (2 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 03/23] perf config: Document 'buildid.dir' variable " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-21 14:45   ` Arnaldo Carvalho de Melo
  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
                   ` (18 subsequent siblings)
  22 siblings, 2 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'annotate' section and its variables.

'hide_src_code', 'use_offset', 'jump_arrows',
'show_linenr', 'show_nr_jump' and 'show_total_period'.

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 | 110 +++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 8835215..85b811f 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -168,6 +168,116 @@ buildid.*::
 		cache location, or to disable it altogether. If you want to disable it,
 		set buildid.dir to /dev/null. The default is $HOME/.debug
 
+annotate.*::
+	These options work only for TUI.
+	These are in control of addresses, jump function, source code
+	in lines of assembly code from a specific program.
+
+	annotate.hide_src_code::
+		If a program which is analyzed has source code,
+		this option lets 'annotate' print a list of assembly code with the source code.
+		For example, let's see a part of a program. There're four lines.
+		If this option is 'true', they can be printed
+		without source code from a program as below.
+
+		│        push   %rbp
+		│        mov    %rsp,%rbp
+		│        sub    $0x10,%rsp
+		│        mov    (%rdi),%rdx
+
+		But if this option is 'false', source code of the part
+		can be also printed as below. Default is 'false'.
+
+		│      struct rb_node *rb_next(const struct rb_node *node)
+		│      {
+		│        push   %rbp
+		│        mov    %rsp,%rbp
+		│        sub    $0x10,%rsp
+		│              struct rb_node *parent;
+		│
+		│              if (RB_EMPTY_NODE(node))
+		│        mov    (%rdi),%rdx
+		│              return n;
+
+        annotate.use_offset::
+		Basing on a first address of a loaded function, offset can be used.
+		Instead of using original addresses of assembly code,
+		addresses subtracted from a base address can be printed.
+		Let's illustrate an example.
+		If a base address is 0XFFFFFFFF81624d50 as below,
+
+		ffffffff81624d50 <load0>
+
+		an address on assembly code has a specific absolute address as below
+
+		ffffffff816250b8:│  mov    0x8(%r14),%rdi
+
+		but if use_offset is 'true', an address subtracted from a base address is printed.
+		Default is true. This option is only applied to TUI.
+
+		             368:│  mov    0x8(%r14),%rdi
+
+	annotate.jump_arrows::
+		There can be jump instruction among assembly code.
+		Depending on a boolean value of jump_arrows,
+		arrows can be printed or not which represent
+		where do the instruction jump into as below.
+
+		│     ┌──jmp    1333
+		│     │  xchg   %ax,%ax
+		│1330:│  mov    %r15,%r10
+		│1333:└─→cmp    %r15,%r14
+
+		If jump_arrow is 'false', the arrows isn't printed as below.
+		Default is 'false'.
+
+		│      ↓ jmp    1333
+		│        xchg   %ax,%ax
+		│1330:   mov    %r15,%r10
+		│1333:   cmp    %r15,%r14
+
+        annotate.show_linenr::
+		When showing source code if this option is 'true',
+		line numbers are printed as below.
+
+		│1628         if (type & PERF_SAMPLE_IDENTIFIER) {
+		│     ↓ jne    508
+		│1628                 data->id = *array;
+		│1629                 array++;
+		│1630         }
+
+		However if this option is 'false', they aren't printed as below.
+		Default is 'false'.
+
+		│             if (type & PERF_SAMPLE_IDENTIFIER) {
+		│     ↓ jne    508
+		│                     data->id = *array;
+		│                     array++;
+		│             }
+
+        annotate.show_nr_jumps::
+		Let's see a part of assembly code.
+
+		│1382:   movb   $0x1,-0x270(%rbp)
+
+		If use this, the number of branches jumping to that address can be printed as below.
+		Default is 'false'.
+
+		│1 1382:   movb   $0x1,-0x270(%rbp)
+
+        annotate.show_total_period::
+		To compare two records on an instruction base, with this option
+		provided, display total number of samples that belong to a line
+		in assembly code. If this option is 'true', total periods are printed
+		instead of percent values as below.
+
+		  302 │      mov    %eax,%eax
+
+		But if this option is 'false', percent values for overhead are printed i.e.
+		Default is 'false'.
+
+		99.93 │      mov    %eax,%eax
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 05/23] perf config: Document variables for 'help' section in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (3 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 04/23] perf config: Document variables for 'annotate' section " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-21 14:46   ` Arnaldo Carvalho de Melo
  2016-01-08 11:39 ` [PATCH v13 06/23] perf config: Document 'hist.percentage' variable " Taeung Song
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'help.format' variables.

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 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 85b811f..aaf1791 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -278,6 +278,10 @@ annotate.*::
 
 		99.93 │      mov    %eax,%eax
 
+help.*::
+	help.format::
+		A format of manual page can be 'man' that is default.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 06/23] perf config: Document 'hist.percentage' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (4 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 05/23] perf config: Document variables for 'help' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-21 14:54   ` Arnaldo Carvalho de Melo
  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
                   ` (16 subsequent siblings)
  22 siblings, 2 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'hist.percentage' variable.

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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index aaf1791..b9892e5 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -282,6 +282,23 @@ help.*::
 	help.format::
 		A format of manual page can be 'man' that is default.
 
+hist.*::
+	hist.percentage::
+		This option control the way to calculate overhead of filtered entries -
+		that means the value of this option is effective only if there's a
+		filter (by comm, dso or symbol name). Suppose a following example:
+
+		       Overhead  Symbols
+		       ........  .......
+		        33.33%     foo
+		        33.33%     bar
+		        33.33%     baz
+
+	       This is an original overhead and we'll filter out the first 'foo'
+	       entry. The value of 'relative' would increase the overhead of 'bar'
+	       and 'baz' to 50.00% for each, while 'absolute' would show their
+	       current overhead (33.33%).
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 07/23] perf config: Document 'ui.show-headers' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (5 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 06/23] perf config: Document 'hist.percentage' variable " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 08/23] perf config: Document variables for 'call-graph' section " Taeung Song
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'ui.show-headers' variable.

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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index b9892e5..fe50bd1 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -299,6 +299,12 @@ hist.*::
 	       and 'baz' to 50.00% for each, while 'absolute' would show their
 	       current overhead (33.33%).
 
+ui.*::
+	ui.show-headers::
+		This option controls display of column headers (like 'Overhead' and 'Symbol')
+		in 'report' and 'top'. If this option is false, they are hidden.
+		This option is only applied to TUI.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 08/23] perf config: Document variables for 'call-graph' section in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (6 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 07/23] perf config: Document 'ui.show-headers' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 09/23] perf config: Document variables for 'report' " Taeung Song
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'call-graph' section and its variables.

'record-mode', 'dump-size', 'print-type', 'order',
'sort-key', 'threshold' and 'print-limit'.

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 | 67 ++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index fe50bd1..2f965e0 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -305,6 +305,73 @@ ui.*::
 		in 'report' and 'top'. If this option is false, they are hidden.
 		This option is only applied to TUI.
 
+call-graph.*::
+	When sub-commands 'top' and 'report' work with -g/—-children
+	there're options in control of call-graph.
+
+	call-graph.record-mode::
+		The record-mode can be 'fp' (frame pointer), 'dwarf' and 'lbr'.
+		The value of 'dwarf' is effective only if perf detect needed library
+		(libunwind or a recent version of libdw).
+		'lbr' only work for cpus that support it.
+
+	call-graph.dump-size::
+		The size of stack to dump in order to do post-unwinding. Default is 8192 (byte).
+		When using dwarf into record-mode, the default size will be used if omitted.
+
+	call-graph.print-type::
+		The print-types can be graph (graph absolute), fractal (graph relative),
+		flat and folded. This option controls a way to show overhead for each callchain
+		entry. Suppose a following example.
+
+                Overhead  Symbols
+                ........  .......
+                  40.00%  foo
+                          |
+                          ---foo
+                             |
+                             |--50.00%--bar
+                             |          main
+                             |
+                              --50.00%--baz
+                                        main
+
+		This output is a 'fractal' format. The 'foo' came from 'bar' and 'baz' exactly
+		half and half so 'fractal' shows 50.00% for each
+		(meaning that it assumes 100% total overhead of 'foo').
+
+		The 'graph' uses absolute overhead value of 'foo' as total so each of
+		'bar' and 'baz' callchain will have 20.00% of overhead.
+		If 'flat' is used, single column and linear exposure of call chains.
+		'folded' mean call chains are displayed in a line, separated by semicolons.
+
+	call-graph.order::
+		This option controls print order of callchains. The default is
+		'callee' which means callee is printed at top and then followed by its
+		caller and so on. The 'caller' prints it in reverse order.
+
+		If this option is not set and report.children or top.children is
+		set to true (or the equivalent command line option is given),
+		the default value of this option is changed to 'caller' for the
+		execution of 'perf report' or 'perf top'. Other commands will
+		still default to 'callee'.
+
+	call-graph.sort-key::
+		The callchains are merged if they contain same information.
+		The sort-key option determines a way to compare the callchains.
+		A value of 'sort-key' can be 'function' or 'address'.
+		The default is 'function'.
+
+	call-graph.threshold::
+		When there're many callchains it'd print tons of lines. So perf omits
+		small callchains under a certain overhead (threshold) and this option
+		control the threshold. Default is 0.5 (%). The overhead is calculated
+		by value depends on call-graph.print-type.
+
+	call-graph.print-limit::
+		This is a maximum number of lines of callchain printed for a single
+		histogram entry. Default is 0 which means no limitation.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 09/23] perf config: Document variables for 'report' section in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (7 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 08/23] perf config: Document variables for 'call-graph' section " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 10/23] perf config: Document 'top.children' variable " Taeung Song
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'report' section's variables.

'percent-limit', 'queue-size' and 'children'.

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 | 34 ++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 2f965e0..ef4d68f 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -372,6 +372,40 @@ call-graph.*::
 		This is a maximum number of lines of callchain printed for a single
 		histogram entry. Default is 0 which means no limitation.
 
+report.*::
+	report.percent-limit::
+		This one is mostly same as call-graph.threshold but works for
+		histogram entries. Entries have overhead lower than this percentage
+		will not be printed. Default is 0. If percent-limit is 10,
+		entries which have more than 10% of overhead will be printed only.
+
+	report.queue-size::
+		This option is to setup the maximum allocation size of internal
+		event queue for ordering events. Default is 0, meaning no limit.
+
+	report.children::
+		The children means that functions called from another function.
+		If this option is true, perf report cumulates callchains of children
+		and show (accumulated) total overhead as well as self overhead.
+		Please refer to the perf-report manual. The default is true.
+
+	report.group::
+		This option is to show event group information together.
+		If it is 'true', event group view can be enabled by default i.e.
+
+		# group: {ref-cycles,cycles}
+		# ========
+		#
+		# Samples: 7K of event 'anon group { ref-cycles, cycles }'
+		# Event count (approx.): 6876107743
+		#
+		#         Overhead  Command      Shared Object                      Symbol
+		# ................  .......  .................  ..........................
+		#
+		    99.84%  99.76%  noploop  noploop            [.] main
+		     0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp
+		     0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 10/23] perf config: Document 'top.children' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (8 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 09/23] perf config: Document variables for 'report' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 11/23] perf config: Document 'man.viewer' " Taeung Song
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'top.children' variable.

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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index ef4d68f..882f591 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -406,6 +406,13 @@ report.*::
 		     0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp
 		     0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del
 
+top.*::
+	top.children::
+		This option means same as report.children. So if it is true,
+		the output of 'top' command will have 'Children' overhead column
+		as well as 'Self' overhead column by default.
+		The default is true.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 11/23] perf config: Document 'man.viewer' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (9 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 10/23] perf config: Document 'top.children' variable " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 12/23] perf config: Document 'pager.<subcommand>' variables " Taeung Song
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'man.viewer' variable and how to add
new man viewer tools.

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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 882f591..b7172b2 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -413,6 +413,15 @@ top.*::
 		as well as 'Self' overhead column by default.
 		The default is true.
 
+man.*::
+	man.viewer::
+		This option can assign a tool to view manual pages when 'help'
+		subcommand was invoked. Supported tools are 'man', 'woman'
+		(with emacs client) and 'konqueror'. Default is 'man'.
+
+		New man viewer tool can be also added using 'man.<tool>.cmd'
+		or use different path using 'man.<tool>.path' config option.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 12/23] perf config: Document 'pager.<subcommand>' variables in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (10 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 11/23] perf config: Document 'man.viewer' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 13/23] perf config: Document 'kmem.default' variable " Taeung Song
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'pager.<subcommand>' variables.

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index b7172b2..e7754f9 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -422,6 +422,11 @@ man.*::
 		New man viewer tool can be also added using 'man.<tool>.cmd'
 		or use different path using 'man.<tool>.path' config option.
 
+pager.*::
+	pager.<subcommand>::
+		When the subcommand is run on stdio, determine whether it uses
+		pager or not based on this value. Default is 'unspecified'.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 13/23] perf config: Document 'kmem.default' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (11 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 12/23] perf config: Document 'pager.<subcommand>' variables " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 14/23] perf config: Document 'record.build-id' " Taeung Song
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'kmem.default' variable.

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index e7754f9..060f160 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -427,6 +427,11 @@ pager.*::
 		When the subcommand is run on stdio, determine whether it uses
 		pager or not based on this value. Default is 'unspecified'.
 
+kmem.*::
+	kmem.default::
+		This option decides which allocator is to be analyzed if neither
+		'--slab' nor '--page' option is used. Default is 'slab'.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 14/23] perf config: Document 'record.build-id' variable in man page
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (12 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 13/23] perf config: Document 'kmem.default' variable " Taeung Song
@ 2016-01-08 11:39 ` 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
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Explain 'record.build-id' variable.

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 060f160..7056c3f 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -432,6 +432,14 @@ kmem.*::
 		This option decides which allocator is to be analyzed if neither
 		'--slab' nor '--page' option is used. Default is 'slab'.
 
+record.*::
+	record.build-id::
+		This option can be 'cache', 'no-cache' or 'skip'.
+		'cache' is to post-process data and save/update the binaries into
+		the build-id cache (in ~/.debug). This is the default.
+		But if this option is 'no-cache', not update the build-id cache.
+		'skip' mean that skip post-processing and do not update the cache.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
2.5.0

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

* [PATCH v13 15/23] perf config: Add '--system' and '--user' options to select which config file is used
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (13 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 14/23] perf config: Document 'record.build-id' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 16/23] perf config: Collect configs to handle config variables Taeung Song
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

The file-options '--system' means $(sysconfdir)/perfconfig and
'--user' means $HOME/.perfconfig. If file-option isn't used,
both system and user config file is read.
The syntax examples are like below.

    perf config [<file-option>] [options]

    a specific config file.
    # perf config --user | --system
    or
    both user and system config file.
    # perf config

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 | 14 +++++++++++++-
 tools/perf/builtin-config.c              | 18 +++++++++++++++++-
 tools/perf/util/cache.h                  |  3 +++
 tools/perf/util/config.c                 |  4 ++--
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 7056c3f..697ecff 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -8,7 +8,7 @@ perf-config - Get and set variables in a configuration file.
 SYNOPSIS
 --------
 [verse]
-'perf config' -l | --list
+'perf config' [<file-option>] -l | --list
 
 DESCRIPTION
 -----------
@@ -21,6 +21,14 @@ OPTIONS
 --list::
 	Show current config variables, name and value, for all sections.
 
+--user::
+	For writing and reading options: write to user
+	'$HOME/.perfconfig' file or read it.
+
+--system::
+	For writing and reading options: write to system-wide
+	'$(sysconfdir)/perfconfig' or read it.
+
 CONFIGURATION FILE
 ------------------
 
@@ -30,6 +38,10 @@ The '$HOME/.perfconfig' file is used to store a per-user configuration.
 The file '$(sysconfdir)/perfconfig' can be used to
 store a system-wide default configuration.
 
+When reading or writing, the values are read from the system and user
+configuration files by default, and options '--system' and '--user'
+can be used to tell the command to read from or write to only that location.
+
 Syntax
 ~~~~~~
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index f04e804..2aa6afe 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -13,8 +13,10 @@
 #include "util/util.h"
 #include "util/debug.h"
 
+static bool use_system_config, use_user_config;
+
 static const char * const config_usage[] = {
-	"perf config [options]",
+	"perf config [<file-option>] [options]",
 	NULL
 };
 
@@ -25,6 +27,8 @@ enum actions {
 static struct option config_options[] = {
 	OPT_SET_UINT('l', "list", &actions,
 		     "show current config variables", ACTION_LIST),
+	OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
+	OPT_BOOLEAN(0, "user", &use_user_config, "use user config file"),
 	OPT_END()
 };
 
@@ -46,6 +50,18 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 	argc = parse_options(argc, argv, config_options, config_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 
+	if (use_system_config && use_user_config) {
+		pr_err("Error: only one config file at a time\n");
+		parse_options_usage(config_usage, config_options, "user", 0);
+		parse_options_usage(NULL, config_options, "system", 0);
+		return -1;
+	}
+
+	if (use_system_config)
+		config_exclusive_filename = perf_etc_perfconfig();
+	else if (use_user_config)
+		config_exclusive_filename = mkpath("%s/.perfconfig", getenv("HOME"));
+
 	switch (actions) {
 	case ACTION_LIST:
 		if (argc) {
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 07b5d63..3ca453f 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -23,6 +23,8 @@
 #define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
 #define PERF_PAGER_ENVIRONMENT "PERF_PAGER"
 
+extern const char *config_exclusive_filename;
+
 typedef int (*config_fn_t)(const char *, const char *, void *);
 extern int perf_default_config(const char *, const char *, void *);
 extern int perf_config(config_fn_t fn, void *);
@@ -31,6 +33,7 @@ extern u64 perf_config_u64(const char *, const char *);
 extern int perf_config_bool(const char *, const char *);
 extern int config_error_nonbool(const char *);
 extern const char *perf_config_dirname(const char *, const char *);
+extern const char *perf_etc_perfconfig(void);
 
 char *alias_lookup(const char *alias);
 int split_cmdline(char *cmdline, const char ***argv);
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index d3e12e3..4e72763 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -26,7 +26,7 @@ static const char *config_file_name;
 static int config_linenr;
 static int config_file_eof;
 
-static const char *config_exclusive_filename;
+const char *config_exclusive_filename;
 
 static int get_next_char(void)
 {
@@ -434,7 +434,7 @@ static int perf_config_from_file(config_fn_t fn, const char *filename, void *dat
 	return ret;
 }
 
-static const char *perf_etc_perfconfig(void)
+const char *perf_etc_perfconfig(void)
 {
 	static const char *system_wide;
 	if (!system_wide)
-- 
2.5.0

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

* [PATCH v13 16/23] perf config: Collect configs to handle config variables
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (14 preceding siblings ...)
  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 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 17/23] perf config: Add 'list-all' option to perf-config Taeung Song
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Collecting configs into list because of two reason.

First of all, if there are same variables both user
and system config file, they all will be printed
when 'list' command work. But if config variables are
duplicated, user config variables should only be printed
because it has priority.

Lastly, list into which configs is collected
will be required to keep and handle config variables
and values in the near furture. For example,
getting or setting functionality.

And change show_config() function.
Old show_config() worked depending on perf_config().
New show_config() work using collected configs list.

Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/builtin-config.c | 150 ++++++++++++++++++++++++++++++++++++++++++--
 tools/perf/util/cache.h     |  13 ++++
 2 files changed, 158 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 2aa6afe..0fbf73e 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -32,13 +32,148 @@ static struct option config_options[] = {
 	OPT_END()
 };
 
-static int show_config(const char *key, const char *value,
-		       void *cb __maybe_unused)
+static struct config_section *find_section(struct list_head *sections,
+					   const char *section_name)
 {
+	struct config_section *section;
+
+	list_for_each_entry(section, sections, list)
+		if (!strcmp(section->name, section_name))
+			return section;
+
+	return NULL;
+}
+
+static struct config_element *find_element(const char *name,
+					   struct config_section *section)
+{
+	struct config_element *element;
+
+	list_for_each_entry(element, &section->element_head, list)
+		if (!strcmp(element->name, name))
+			return element;
+
+	return NULL;
+}
+
+static void find_config(struct list_head *sections,
+			struct config_section **section,
+			struct config_element **element,
+			const char *section_name, const char *name)
+{
+	*section = find_section(sections, section_name);
+
+	if (*section != NULL)
+		*element = find_element(name, *section);
+	else
+		*element = NULL;
+}
+
+static struct config_section *init_section(const char *section_name)
+{
+	struct config_section *section;
+
+	section = zalloc(sizeof(*section));
+	if (!section)
+		return NULL;
+
+	INIT_LIST_HEAD(&section->element_head);
+	section->name = strdup(section_name);
+	if (!section->name) {
+		pr_err("%s: strdup failed\n", __func__);
+		free(section);
+		return NULL;
+	}
+
+	return section;
+}
+
+static int add_element(struct list_head *head,
+			      const char *name, const char *value)
+{
+	struct config_element *element;
+
+	element = zalloc(sizeof(*element));
+	if (!element)
+		return -1;
+
+	element->name = strdup(name);
+	if (!element->name) {
+		pr_err("%s: strdup failed\n", __func__);
+		free(element);
+		return -1;
+	}
 	if (value)
-		printf("%s=%s\n", key, value);
+		element->value = (char *)value;
 	else
-		printf("%s\n", key);
+		element->value = NULL;
+
+	list_add_tail(&element->list, head);
+	return 0;
+}
+
+static int collect_current_config(const char *var, const char *value,
+				  void *spec_sections)
+{
+	int ret = -1;
+	char *ptr, *key;
+	char *section_name, *name;
+	struct config_section *section = NULL;
+	struct config_element *element = NULL;
+	struct list_head *sections = (struct list_head *)spec_sections;
+
+	key = ptr = strdup(var);
+	if (!key) {
+		pr_err("%s: strdup failed\n", __func__);
+		return -1;
+	}
+
+	section_name = strsep(&ptr, ".");
+	name = ptr;
+	if (name == NULL || value == NULL)
+		goto out_err;
+
+	find_config(sections, &section, &element, section_name, name);
+
+	if (!section) {
+		section = init_section(section_name);
+		if (!section)
+			goto out_err;
+		list_add_tail(&section->list, sections);
+	}
+
+	value = strdup(value);
+	if (!value) {
+		pr_err("%s: strdup failed\n", __func__);
+		goto out_err;
+	}
+
+	if (!element)
+		add_element(&section->element_head, name, value);
+	else {
+		free(element->value);
+		element->value = (char *)value;
+	}
+
+	ret = 0;
+out_err:
+	free(key);
+	return ret;
+}
+
+static int show_config(struct list_head *sections)
+{
+	struct config_section *section;
+	struct config_element *element;
+
+	if (list_empty(sections))
+		return -1;
+	list_for_each_entry(section, sections, list) {
+		list_for_each_entry(element, &section->element_head, list) {
+			printf("%s.%s=%s\n", section->name,
+				       element->name, element->value);
+		}
+	}
 
 	return 0;
 }
@@ -46,6 +181,7 @@ static int show_config(const char *key, const char *value,
 int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	int ret = 0;
+	struct list_head sections;
 
 	argc = parse_options(argc, argv, config_options, config_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
@@ -57,18 +193,22 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 		return -1;
 	}
 
+	INIT_LIST_HEAD(&sections);
+
 	if (use_system_config)
 		config_exclusive_filename = perf_etc_perfconfig();
 	else if (use_user_config)
 		config_exclusive_filename = mkpath("%s/.perfconfig", getenv("HOME"));
 
+	perf_config(collect_current_config, &sections);
+
 	switch (actions) {
 	case ACTION_LIST:
 		if (argc) {
 			pr_err("Error: takes no arguments\n");
 			parse_options_usage(config_usage, config_options, "l", 1);
 		} else {
-			ret = perf_config(show_config, NULL);
+			ret = show_config(&sections);
 			if (ret < 0)
 				pr_err("Nothing configured, "
 				       "please check your ~/.perfconfig file\n");
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 3ca453f..92cd739 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -1,6 +1,7 @@
 #ifndef __PERF_CACHE_H
 #define __PERF_CACHE_H
 
+#include <linux/list.h>
 #include <stdbool.h>
 #include "util.h"
 #include "strbuf.h"
@@ -23,6 +24,18 @@
 #define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
 #define PERF_PAGER_ENVIRONMENT "PERF_PAGER"
 
+struct config_element {
+	char *name;
+	char *value;
+	struct list_head list;
+};
+
+struct config_section {
+	char *name;
+	struct list_head element_head;
+	struct list_head list;
+};
+
 extern const char *config_exclusive_filename;
 
 typedef int (*config_fn_t)(const char *, const char *, void *);
-- 
2.5.0

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

* [PATCH v13 17/23] perf config: Add 'list-all' option to perf-config
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (15 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 16/23] perf config: Collect configs to handle config variables Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 18/23] perf config: Add a option 'skel' " Taeung Song
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

'list-all' option is to display both current config variables
and all possible config variables with default values.
The syntax examples are like below

    perf config [<file-option>] [options]

    display all perf config with default values.
    # perf config -a | --list-all

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 |   6 +
 tools/perf/builtin-config.c              | 228 ++++++++++++++++++++++++++++++-
 2 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 697ecff..dfb0d44 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -9,6 +9,8 @@ SYNOPSIS
 --------
 [verse]
 'perf config' [<file-option>] -l | --list
+or
+'perf config' [<file-option>] -a | --list-all
 
 DESCRIPTION
 -----------
@@ -29,6 +31,10 @@ OPTIONS
 	For writing and reading options: write to system-wide
 	'$(sysconfdir)/perfconfig' or read it.
 
+-a::
+--list-all::
+	Show current and all possible config variables with default values.
+
 CONFIGURATION FILE
 ------------------
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 0fbf73e..8f3982c 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -21,17 +21,160 @@ static const char * const config_usage[] = {
 };
 
 enum actions {
-	ACTION_LIST = 1
+	ACTION_LIST = 1,
+	ACTION_LIST_ALL
 } actions;
 
 static struct option config_options[] = {
 	OPT_SET_UINT('l', "list", &actions,
 		     "show current config variables", ACTION_LIST),
+	OPT_SET_UINT('a', "list-all", &actions,
+		     "show current and all possible config"
+		     " variables with default values", ACTION_LIST_ALL),
 	OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
 	OPT_BOOLEAN(0, "user", &use_user_config, "use user config file"),
 	OPT_END()
 };
 
+enum config_idx {
+	CONFIG_COLORS_TOP,
+	CONFIG_COLORS_MEDIUM,
+	CONFIG_COLORS_NORMAL,
+	CONFIG_COLORS_SELECTED,
+	CONFIG_COLORS_CODE,
+	CONFIG_COLORS_ADDR,
+	CONFIG_COLORS_ROOT,
+	CONFIG_TUI_REPORT,
+	CONFIG_TUI_ANNOTATE,
+	CONFIG_TUI_TOP,
+	CONFIG_BUILDID_DIR,
+	CONFIG_ANNOTATE_HIDE_SRC_CODE,
+	CONFIG_ANNOTATE_USE_OFFSET,
+	CONFIG_ANNOTATE_JUMP_ARROWS,
+	CONFIG_ANNOTATE_SHOW_NR_JUMPS,
+	CONFIG_ANNOTATE_SHOW_LINENR,
+	CONFIG_ANNOTATE_SHOW_TOTAL_PERIOD,
+	CONFIG_GTK_ANNOTATE,
+	CONFIG_GTK_REPORT,
+	CONFIG_GTK_TOP,
+	CONFIG_PAGER_CMD,
+	CONFIG_PAGER_REPORT,
+	CONFIG_PAGER_ANNOTATE,
+	CONFIG_PAGER_TOP,
+	CONFIG_PAGER_DIFF,
+	CONFIG_HELP_FORMAT,
+	CONFIG_HELP_AUTOCORRECT,
+	CONFIG_HIST_PERCENTAGE,
+	CONFIG_UI_SHOW_HEADERS,
+	CONFIG_CALL_GRAPH_RECORD_MODE,
+	CONFIG_CALL_GRAPH_DUMP_SIZE,
+	CONFIG_CALL_GRAPH_PRINT_TYPE,
+	CONFIG_CALL_GRAPH_ORDER,
+	CONFIG_CALL_GRAPH_SORT_KEY,
+	CONFIG_CALL_GRAPH_THRESHOLD,
+	CONFIG_CALL_GRAPH_PRINT_LIMIT,
+	CONFIG_REPORT_GROUP,
+	CONFIG_REPORT_CHILDREN,
+	CONFIG_REPORT_PERCENT_LIMIT,
+	CONFIG_REPORT_QUEUE_SIZE,
+	CONFIG_TOP_CHILDREN,
+	CONFIG_MAN_VIEWER,
+	CONFIG_KMEM_DEFAULT,
+};
+
+enum config_type {
+	CONFIG_TYPE_BOOL,
+	CONFIG_TYPE_INT,
+	CONFIG_TYPE_LONG,
+	CONFIG_TYPE_U64,
+	CONFIG_TYPE_FLOAT,
+	CONFIG_TYPE_DOUBLE,
+	CONFIG_TYPE_STRING,
+	/* special type */
+	CONFIG_END
+};
+
+struct config_item {
+	const char *section;
+	const char *name;
+	union {
+		bool b;
+		int i;
+		u32 l;
+		u64 ll;
+		float f;
+		double d;
+		const char *s;
+	} value;
+	enum config_type type;
+};
+
+#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_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_END()
+};
+
 static struct config_section *find_section(struct list_head *sections,
 					   const char *section_name)
 {
@@ -112,6 +255,75 @@ static int add_element(struct list_head *head,
 	return 0;
 }
 
+static char *get_value(struct config_item *config)
+{
+	int ret = 0;
+	char *value;
+
+	if (config->type == CONFIG_TYPE_BOOL)
+		ret = asprintf(&value, "%s",
+			       config->value.b ? "true" : "false");
+	else if (config->type == CONFIG_TYPE_INT)
+		ret = asprintf(&value, "%d", config->value.i);
+	else if (config->type == CONFIG_TYPE_LONG)
+		ret = asprintf(&value, "%u", config->value.l);
+	else if (config->type == CONFIG_TYPE_U64)
+		ret = asprintf(&value, "%"PRId64, config->value.ll);
+	else if (config->type == CONFIG_TYPE_FLOAT)
+		ret = asprintf(&value, "%f", config->value.f);
+	else if (config->type == CONFIG_TYPE_DOUBLE)
+		ret = asprintf(&value, "%f", config->value.d);
+	else
+		ret = asprintf(&value, "%s", config->value.s);
+
+	if (ret < 0)
+		return NULL;
+
+	return value;
+}
+
+static int show_all_config(struct list_head *sections)
+{
+	int i;
+	bool has_config;
+	struct config_section *section;
+	struct config_element *element;
+
+	for (i = 0; default_configs[i].type != CONFIG_END; i++) {
+		struct config_item *config = &default_configs[i];
+		find_config(sections, &section, &element,
+			    config->section, config->name);
+
+		if (!element) {
+			char *value = get_value(config);
+
+			printf("%s.%s=%s\n", config->section, config->name, value);
+			free(value);
+		} else
+			printf("%s.%s=%s\n", section->name,
+			       element->name, element->value);
+	}
+
+	/* Print config variables the default configsets haven't */
+	list_for_each_entry(section, sections, list) {
+		list_for_each_entry(element, &section->element_head, list) {
+			has_config = false;
+			for (i = 0; default_configs[i].type != CONFIG_END; i++) {
+				if (!strcmp(default_configs[i].section, section->name) &&
+				    !strcmp(default_configs[i].name, element->name)) {
+					has_config = true;
+					break;
+				}
+			}
+			if (!has_config)
+				printf("%s.%s=%s\n", section->name,
+				       element->name, element->value);
+		}
+	}
+
+	return 0;
+}
+
 static int collect_current_config(const char *var, const char *value,
 				  void *spec_sections)
 {
@@ -183,6 +395,9 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 	int ret = 0;
 	struct list_head sections;
 
+	set_option_flag(config_options, 'l', "list", PARSE_OPT_EXCLUSIVE);
+	set_option_flag(config_options, 'a', "list-all", PARSE_OPT_EXCLUSIVE);
+
 	argc = parse_options(argc, argv, config_options, config_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 
@@ -203,10 +418,19 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 	perf_config(collect_current_config, &sections);
 
 	switch (actions) {
+	case ACTION_LIST_ALL:
+		if (argc == 0) {
+			ret = show_all_config(&sections);
+			break;
+		}
+		/* fall through */
 	case ACTION_LIST:
 		if (argc) {
 			pr_err("Error: takes no arguments\n");
-			parse_options_usage(config_usage, config_options, "l", 1);
+			if (actions == ACTION_LIST_ALL)
+				parse_options_usage(config_usage, config_options, "a", 1);
+			else
+				parse_options_usage(config_usage, config_options, "l", 1);
 		} else {
 			ret = show_config(&sections);
 			if (ret < 0)
-- 
2.5.0

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

* [PATCH v13 18/23] perf config: Add a option 'skel' to perf-config
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (16 preceding siblings ...)
  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 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 19/23] perf config: Add --verbose option for showing config description Taeung Song
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Produce an skeleton with the possible config variables so
that one could then use $EDITOR ~/.perfconfig or
$(sysconfdir)/perfconfigand go on setting the knobs.

For the syntax examples,

    # perf config -k | --skel
    Initialize the possible config variables on config file.
    # perf config --skel > ~/.perfconfig

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 |  6 ++++++
 tools/perf/builtin-config.c              | 30 +++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index dfb0d44..9d348d3 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -11,6 +11,8 @@ SYNOPSIS
 'perf config' [<file-option>] -l | --list
 or
 'perf config' [<file-option>] -a | --list-all
+or
+'perf config' [<file-option>] -k | --skel
 
 DESCRIPTION
 -----------
@@ -35,6 +37,10 @@ OPTIONS
 --list-all::
 	Show current and all possible config variables with default values.
 
+-k::
+--skel::
+	Produce an skeleton with the possible config variables.
+
 CONFIGURATION FILE
 ------------------
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 8f3982c..4806b93 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -22,7 +22,8 @@ static const char * const config_usage[] = {
 
 enum actions {
 	ACTION_LIST = 1,
-	ACTION_LIST_ALL
+	ACTION_LIST_ALL,
+	ACTION_SKEL
 } actions;
 
 static struct option config_options[] = {
@@ -31,6 +32,9 @@ static struct option config_options[] = {
 	OPT_SET_UINT('a', "list-all", &actions,
 		     "show current and all possible config"
 		     " variables with default values", ACTION_LIST_ALL),
+	OPT_SET_UINT('k', "skel", &actions,
+		     "produce an skeleton with the possible"
+		     " config variables", ACTION_SKEL),
 	OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
 	OPT_BOOLEAN(0, "user", &use_user_config, "use user config file"),
 	OPT_END()
@@ -282,6 +286,24 @@ static char *get_value(struct config_item *config)
 	return value;
 }
 
+static int show_skel_config(void)
+{
+	char *section;
+
+	for (int i = 0; default_configs[i].type != CONFIG_END; i++) {
+		struct config_item *config = &default_configs[i];
+		char *value = get_value(config);
+		if (strcmp(section, config->section) != 0) {
+			section = (char *)config->section;
+			printf("\n[%s]\n", config->section);
+		}
+		printf("\t%s = %s\n", config->name, value);
+		free(value);
+	}
+
+	return 0;
+}
+
 static int show_all_config(struct list_head *sections)
 {
 	int i;
@@ -418,6 +440,12 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 	perf_config(collect_current_config, &sections);
 
 	switch (actions) {
+	case ACTION_SKEL:
+		if (argc)
+			parse_options_usage(config_usage, config_options, "k", 1);
+		else
+			ret = show_skel_config();
+		break;
 	case ACTION_LIST_ALL:
 		if (argc == 0) {
 			ret = show_all_config(&sections);
-- 
2.5.0

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

* [PATCH v13 19/23] perf config: Add --verbose option for showing config description
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (17 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 18/23] perf config: Add a option 'skel' " Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 20/23] perf config: Add 'get' functionality Taeung Song
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

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

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

* [PATCH v13 20/23] perf config: Add 'get' functionality
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (18 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 19/23] perf config: Add --verbose option for showing config description Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 21/23] perf config: Add 'set' feature Taeung Song
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

This patch consists of functions
which can get specific config variables.
For the syntax examples,

    perf config [<file-option>] [section.name ...]

    display key-value pairs of specific config variables
    # perf config report.queue-size report.children

In addition, the functionality can work with --verbose option
to show the config description, i.e.

    # perf config -v report.queue-size

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 |  2 +
 tools/perf/builtin-config.c              | 83 ++++++++++++++++++++++++++++++--
 tools/perf/util/cache.h                  |  1 +
 3 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 3706ea2..14535fc 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -8,6 +8,8 @@ perf-config - Get and set variables in a configuration file.
 SYNOPSIS
 --------
 [verse]
+'perf config' [<file-option>] [section.name ...]
+or
 'perf config' [<file-option>] -l | --list
 or
 'perf config' [<file-option>] -a | --list-all
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 8c28de8..488f572 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -16,7 +16,7 @@
 static bool use_system_config, use_user_config;
 
 static const char * const config_usage[] = {
-	"perf config [<file-option>] [options]",
+	"perf config [<file-option>] [options] [section.name ...]",
 	NULL
 };
 
@@ -396,6 +396,40 @@ static int show_all_config(struct list_head *sections)
 	return 0;
 }
 
+static int show_spec_config(struct list_head *sections,
+			    const char *section_name, const char *name)
+{
+	int i;
+	struct config_section *section = NULL;
+	struct config_element *element = NULL;
+
+	find_config(sections, &section, &element, section_name, name);
+
+	if (section && element) {
+		printf("%s.%s=%s\n", section->name,
+		       element->name, element->value);
+		return 0;
+	}
+
+	for (i = 0; default_configs[i].type != CONFIG_END; i++) {
+		struct config_item *config = &default_configs[i];
+
+		if (!strcmp(config->section, section_name) &&
+		    !strcmp(config->name, name)) {
+			char *value = get_value(config);
+
+			if (verbose)
+				printf("# %s\n", config->desc);
+			printf("%s.%s=%s (default)\n", config->section,
+			       config->name, value);
+			free(value);
+			return 0;
+		}
+	}
+
+	return -1;
+}
+
 static int collect_current_config(const char *var, const char *value,
 				  void *spec_sections)
 {
@@ -445,6 +479,43 @@ out_err:
 	return ret;
 }
 
+static int perf_configset_with_option(configset_fn_t fn, struct list_head *sections,
+				      const char *var)
+{
+	int ret = -1;
+	char *ptr, *key;
+	const char *last_dot;
+	char *section_name, *name;
+
+	key = ptr = strdup(var);
+	if (!key) {
+		pr_err("%s: strdup failed\n", __func__);
+		return -1;
+	}
+	last_dot = strchr(key, '.');
+	/*
+	 * Since "key" actually contains the section name and the real
+	 * key name separated by a dot, we have to know where the dot is.
+	 */
+	if (last_dot == NULL || last_dot == key) {
+		pr_err("The config variable does not contain a section: %s\n", key);
+		goto out_err;
+	}
+	if (!last_dot[1]) {
+		pr_err("The config varible does not contain variable name: %s\n", key);
+		goto out_err;
+	}
+
+	section_name = strsep(&ptr, ".");
+	name = ptr;
+	fn(sections, section_name, name);
+	ret = 0;
+
+out_err:
+	free(key);
+	return ret;
+}
+
 static int show_config(struct list_head *sections)
 {
 	struct config_section *section;
@@ -464,7 +535,7 @@ static int show_config(struct list_head *sections)
 
 int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-	int ret = 0;
+	int i, ret = 0;
 	struct list_head sections;
 
 	set_option_flag(config_options, 'l', "list", PARSE_OPT_EXCLUSIVE);
@@ -501,7 +572,6 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 			ret = show_all_config(&sections);
 			break;
 		}
-		/* fall through */
 	case ACTION_LIST:
 		if (argc) {
 			pr_err("Error: takes no arguments\n");
@@ -517,7 +587,12 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 		}
 		break;
 	default:
-		usage_with_options(config_usage, config_options);
+		if (argc)
+			for (i = 0; argv[i]; i++)
+				ret = perf_configset_with_option(show_spec_config, &sections,
+								 argv[i]);
+		else
+			usage_with_options(config_usage, config_options);
 	}
 
 	return ret;
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 92cd739..d5dcc85 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -39,6 +39,7 @@ struct config_section {
 extern const char *config_exclusive_filename;
 
 typedef int (*config_fn_t)(const char *, const char *, void *);
+typedef int (*configset_fn_t)(struct list_head *, const char *, const char *);
 extern int perf_default_config(const char *, const char *, void *);
 extern int perf_config(config_fn_t fn, void *);
 extern int perf_config_int(const char *, const char *);
-- 
2.5.0

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

* [PATCH v13 21/23] perf config: Add 'set' feature
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (19 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 20/23] perf config: Add 'get' functionality Taeung Song
@ 2016-01-08 11:39 ` 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
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

This patch consists of functions
which can set specific config variables.
For the syntax examples,

    perf config [<file-option>] [options] [section.name[=value] ...]

    set specific config variables
    # perf config report.queue-size=100M report.children=true

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 |   2 +-
 tools/perf/builtin-config.c              | 127 +++++++++++++++++++++++++------
 tools/perf/util/cache.h                  |   5 +-
 tools/perf/util/config.c                 |  27 ++++++-
 4 files changed, 134 insertions(+), 27 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 14535fc..367a73b 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -8,7 +8,7 @@ perf-config - Get and set variables in a configuration file.
 SYNOPSIS
 --------
 [verse]
-'perf config' [<file-option>] [section.name ...]
+'perf config' [<file-option>] [section.name[=value] ...]
 or
 'perf config' [<file-option>] -l | --list
 or
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 488f572..329ee75 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -16,7 +16,7 @@
 static bool use_system_config, use_user_config;
 
 static const char * const config_usage[] = {
-	"perf config [<file-option>] [options] [section.name ...]",
+	"perf config [<file-option>] [options] [section.name[=value] ...]",
 	NULL
 };
 
@@ -397,7 +397,9 @@ static int show_all_config(struct list_head *sections)
 }
 
 static int show_spec_config(struct list_head *sections,
-			    const char *section_name, const char *name)
+			    const char *config_file_name __maybe_unused,
+			    const char *section_name, const char *name,
+			    char *value)
 {
 	int i;
 	struct config_section *section = NULL;
@@ -416,7 +418,7 @@ static int show_spec_config(struct list_head *sections,
 
 		if (!strcmp(config->section, section_name) &&
 		    !strcmp(config->name, name)) {
-			char *value = get_value(config);
+			value = get_value(config);
 
 			if (verbose)
 				printf("# %s\n", config->desc);
@@ -430,6 +432,39 @@ static int show_spec_config(struct list_head *sections,
 	return -1;
 }
 
+static int set_config(struct list_head *sections, const char *config_file_name,
+		      const char *section_name, const char *name, char *value)
+{
+	struct config_section *section = NULL;
+	struct config_element *element = NULL;
+
+	find_config(sections, &section, &element, section_name, name);
+	if (value != NULL) {
+		value = strdup(value);
+		if (!value) {
+			pr_err("%s: strdup failed\n", __func__);
+			return -1;
+		}
+
+		/* if there isn't existent section, add a new section */
+		if (!section) {
+			section = init_section(section_name);
+			if (!section)
+				return -1;
+			list_add_tail(&section->list, sections);
+		}
+		/* if nothing to replace, add a new element which contains key-value pair. */
+		if (!element) {
+			add_element(&section->element_head, name, value);
+		} else {
+			free(element->value);
+			element->value = value;
+		}
+	}
+
+	return perf_configset_write_in_full(sections, config_file_name);
+}
+
 static int collect_current_config(const char *var, const char *value,
 				  void *spec_sections)
 {
@@ -479,8 +514,10 @@ out_err:
 	return ret;
 }
 
-static int perf_configset_with_option(configset_fn_t fn, struct list_head *sections,
-				      const char *var)
+static int perf_configset_with_option(configset_fn_t fn,
+				      struct list_head *sections,
+				      const char *config_file_name,
+				      const char *var, char *value)
 {
 	int ret = -1;
 	char *ptr, *key;
@@ -507,10 +544,24 @@ static int perf_configset_with_option(configset_fn_t fn, struct list_head *secti
 	}
 
 	section_name = strsep(&ptr, ".");
-	name = ptr;
-	fn(sections, section_name, name);
-	ret = 0;
+	name = strsep(&ptr, "=");
+	if (!value) {
+		/* do nothing */
+	} else if (!strcmp(value, "=")) {
+		pr_err("The config variable does not contain a value: %s.%s\n",
+		       section_name, name);
+		goto out_err;
+	} else {
+		value++;
+		name = strsep(&name, "=");
+		if (name[0] == '\0') {
+			pr_err("invalid key: %s\n", var);
+			goto out_err;
+		}
+	}
 
+	fn(sections, config_file_name, section_name, name, value);
+	ret = 0;
 out_err:
 	free(key);
 	return ret;
@@ -536,7 +587,10 @@ static int show_config(struct list_head *sections)
 int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	int i, ret = 0;
-	struct list_head sections;
+	struct list_head *sections;
+	struct list_head all_sections, user_sections, system_sections;
+	const char *system_config = perf_etc_perfconfig();
+	char *user_config = mkpath("%s/.perfconfig", getenv("HOME"));
 
 	set_option_flag(config_options, 'l', "list", PARSE_OPT_EXCLUSIVE);
 	set_option_flag(config_options, 'a', "list-all", PARSE_OPT_EXCLUSIVE);
@@ -551,14 +605,22 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 		return -1;
 	}
 
-	INIT_LIST_HEAD(&sections);
-
-	if (use_system_config)
-		config_exclusive_filename = perf_etc_perfconfig();
-	else if (use_user_config)
-		config_exclusive_filename = mkpath("%s/.perfconfig", getenv("HOME"));
-
-	perf_config(collect_current_config, &sections);
+	INIT_LIST_HEAD(&user_sections);
+	INIT_LIST_HEAD(&system_sections);
+	perf_config_from_file(collect_current_config, user_config,  &user_sections);
+	perf_config_from_file(collect_current_config, system_config,  &system_sections);
+
+	if (use_system_config) {
+		sections = &system_sections;
+		config_exclusive_filename = system_config;
+	} else if (use_user_config) {
+		sections = &user_sections;
+		config_exclusive_filename = user_config;
+	} else {
+		sections = &all_sections;
+		INIT_LIST_HEAD(&all_sections);
+		perf_config(collect_current_config, &all_sections);
+	}
 
 	switch (actions) {
 	case ACTION_SKEL:
@@ -569,7 +631,7 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 		break;
 	case ACTION_LIST_ALL:
 		if (argc == 0) {
-			ret = show_all_config(&sections);
+			ret = show_all_config(sections);
 			break;
 		}
 	case ACTION_LIST:
@@ -580,18 +642,35 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 			else
 				parse_options_usage(config_usage, config_options, "l", 1);
 		} else {
-			ret = show_config(&sections);
+			ret = show_config(sections);
 			if (ret < 0)
 				pr_err("Nothing configured, "
 				       "please check your ~/.perfconfig file\n");
 		}
 		break;
 	default:
-		if (argc)
-			for (i = 0; argv[i]; i++)
-				ret = perf_configset_with_option(show_spec_config, &sections,
-								 argv[i]);
-		else
+		if (argc) {
+			for (i = 0; argv[i]; i++) {
+				char *value = strchr(argv[i], '=');
+
+				if (value == NULL)
+					ret = perf_configset_with_option(show_spec_config,
+									 sections, NULL,
+									 argv[i], value);
+				else {
+					if (!use_system_config && !use_user_config)
+						ret = perf_configset_with_option(set_config,
+										 &user_sections,
+										 user_config,
+										 argv[i], value);
+					else
+						ret = perf_configset_with_option(set_config,
+										 sections,
+										 config_exclusive_filename,
+										 argv[i], value);
+				}
+			}
+		} else
 			usage_with_options(config_usage, config_options);
 	}
 
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index d5dcc85..9614afd 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -39,9 +39,12 @@ struct config_section {
 extern const char *config_exclusive_filename;
 
 typedef int (*config_fn_t)(const char *, const char *, void *);
-typedef int (*configset_fn_t)(struct list_head *, const char *, const char *);
+typedef int (*configset_fn_t)(struct list_head *, const char *,
+			      const char *, const char *, char *);
+extern int perf_configset_write_in_full(struct list_head *sections, const char *file_name);
 extern int perf_default_config(const char *, const char *, void *);
 extern int perf_config(config_fn_t fn, void *);
+extern int perf_config_from_file(config_fn_t fn, const char *filename, void *data);
 extern int perf_config_int(const char *, const char *);
 extern u64 perf_config_u64(const char *, const char *);
 extern int perf_config_bool(const char *, const char *);
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 4e72763..34eff22 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -416,7 +416,7 @@ int perf_default_config(const char *var, const char *value,
 	return 0;
 }
 
-static int perf_config_from_file(config_fn_t fn, const char *filename, void *data)
+int perf_config_from_file(config_fn_t fn, const char *filename, void *data)
 {
 	int ret;
 	FILE *f = fopen(filename, "r");
@@ -506,6 +506,31 @@ out:
 	return ret;
 }
 
+int perf_configset_write_in_full(struct list_head *sections, const char *file_name)
+{
+	struct config_section *section;
+	struct config_element *element;
+	const char *first_line = "# this file is auto-generated.";
+	FILE *fp = fopen(file_name, "w");
+
+	if (!fp)
+		return -1;
+
+	fprintf(fp, "%s\n", first_line);
+	/* overwrite configvariables */
+	list_for_each_entry(section, sections, list) {
+		fprintf(fp, "[%s]\n", section->name);
+		list_for_each_entry(element, &section->element_head, list) {
+			if (element->value)
+				fprintf(fp, "\t%s = %s\n",
+					element->name, element->value);
+		}
+	}
+	fclose(fp);
+
+	return 0;
+}
+
 /*
  * Call this to report error for your variable that should not
  * get a boolean value (i.e. "[my] var" means "true").
-- 
2.5.0

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

* [PATCH v13 22/23] perf config: normalize a value depending on default type of it
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (20 preceding siblings ...)
  2016-01-08 11:39 ` [PATCH v13 21/23] perf config: Add 'set' feature Taeung Song
@ 2016-01-08 11:39 ` Taeung Song
  2016-01-08 11:39 ` [PATCH v13 23/23] perf config: Add a option 'remove' to perf-config Taeung Song
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

Whether or not user mis-type wrong data type to set config,
normalize the value. If a config user enter isn't contained
in default configs, just pass as it is.
For the examples,

   # perf config report.queue-size=1M
   # perf config report.queue-size
   report.queue-size=1048576

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

diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 329ee75..387f148 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -432,6 +432,54 @@ static int show_spec_config(struct list_head *sections,
 	return -1;
 }
 
+static char *normalize_value(const char *section_name, const char *name, const char *value)
+{
+	int i, ret = 0;
+	char *endptr;
+	char key[BUFSIZ];
+	char *normalized;
+
+	scnprintf(key, sizeof(key), "%s.%s", section_name, name);
+	for (i = 0; default_configs[i].type != CONFIG_END; i++) {
+		struct config_item *config = &default_configs[i];
+
+		if (!strcmp(config->section, section_name) &&
+		    !strcmp(config->name, name)) {
+			if (config->type == CONFIG_TYPE_BOOL)
+				ret = asprintf(&normalized, "%s",
+					       perf_config_bool(key, value) ? "true" : "false");
+			else if (config->type == CONFIG_TYPE_INT ||
+				 config->type == CONFIG_TYPE_LONG)
+				ret = asprintf(&normalized, "%d",
+					       perf_config_int(key, value));
+			else if (config->type == CONFIG_TYPE_U64)
+				ret = asprintf(&normalized, "%"PRId64,
+					       perf_config_u64(key, value));
+			else if (config->type == CONFIG_TYPE_FLOAT)
+				ret = asprintf(&normalized, "%f",
+					       strtof(value, &endptr));
+			else if (config->type == CONFIG_TYPE_DOUBLE)
+				ret = asprintf(&normalized, "%f",
+					       strtod(value, &endptr));
+			else
+				ret = asprintf(&normalized, "%s", value);
+
+			if (ret < 0)
+				return NULL;
+
+			return normalized;
+		}
+	}
+
+	normalized = strdup(value);
+	if (!normalized) {
+		pr_err("%s: strdup failed\n", __func__);
+		return NULL;
+	}
+
+	return normalized;
+}
+
 static int set_config(struct list_head *sections, const char *config_file_name,
 		      const char *section_name, const char *name, char *value)
 {
@@ -440,11 +488,7 @@ static int set_config(struct list_head *sections, const char *config_file_name,
 
 	find_config(sections, &section, &element, section_name, name);
 	if (value != NULL) {
-		value = strdup(value);
-		if (!value) {
-			pr_err("%s: strdup failed\n", __func__);
-			return -1;
-		}
+		value = normalize_value(section_name, name, value);
 
 		/* if there isn't existent section, add a new section */
 		if (!section) {
-- 
2.5.0

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

* [PATCH v13 23/23] perf config: Add a option 'remove' to perf-config
  2016-01-08 11:39 [PATCH v13 00/22] perf config: Add functionalities into perf-config and document config info Taeung Song
                   ` (21 preceding siblings ...)
  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 ` Taeung Song
  22 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-08 11:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar, Taeung Song

A option 'remove' is to remove specific config variables.
For the syntax examples,

    # perf config [<file-option>] -r | --remove [section.name ...]

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 |  6 ++++++
 tools/perf/builtin-config.c              | 37 ++++++++++++++++++++++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 367a73b..98314c2 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -15,6 +15,8 @@ or
 'perf config' [<file-option>] -a | --list-all
 or
 'perf config' [<file-option>] -k | --skel
+or
+'perf config' [<file-option>] -r | --remove [section.name ...]
 
 DESCRIPTION
 -----------
@@ -47,6 +49,10 @@ OPTIONS
 --verbose::
 	Be more verbose. (show config description)
 
+-r::
+--remove::
+	Remove specific config variables.
+
 CONFIGURATION FILE
 ------------------
 
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 387f148..3857d74 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -23,7 +23,8 @@ static const char * const config_usage[] = {
 enum actions {
 	ACTION_LIST = 1,
 	ACTION_LIST_ALL,
-	ACTION_SKEL
+	ACTION_SKEL,
+	ACTION_REMOVE
 } actions;
 
 static struct option config_options[] = {
@@ -35,6 +36,8 @@ static struct option config_options[] = {
 	OPT_SET_UINT('k', "skel", &actions,
 		     "produce an skeleton with the possible"
 		     " config variables", ACTION_SKEL),
+	OPT_SET_UINT('r', "remove", &actions,
+		     "remove specific variables: [section.name ...]", ACTION_REMOVE),
 	OPT_INCR('v', "verbose", &verbose, "Be more verbose"
 		 " (show config description)"),
 	OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
@@ -487,7 +490,13 @@ static int set_config(struct list_head *sections, const char *config_file_name,
 	struct config_element *element = NULL;
 
 	find_config(sections, &section, &element, section_name, name);
-	if (value != NULL) {
+	if (!value) {
+		/* value == NULL means remove the variable */
+		if (section && element) {
+			free(element->value);
+			element->value = NULL;
+		}
+	} else {
 		value = normalize_value(section_name, name, value);
 
 		/* if there isn't existent section, add a new section */
@@ -638,6 +647,7 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	set_option_flag(config_options, 'l', "list", PARSE_OPT_EXCLUSIVE);
 	set_option_flag(config_options, 'a', "list-all", PARSE_OPT_EXCLUSIVE);
+	set_option_flag(config_options, 'r', "remove", PARSE_OPT_EXCLUSIVE);
 
 	argc = parse_options(argc, argv, config_options, config_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
@@ -667,6 +677,29 @@ int cmd_config(int argc, const char **argv, const char *prefix __maybe_unused)
 	}
 
 	switch (actions) {
+	case ACTION_REMOVE:
+		if (argc) {
+			for (i = 0; argv[i]; i++) {
+				if (!use_system_config && !use_user_config) {
+					ret = perf_configset_with_option(set_config,
+									 &system_sections,
+									 system_config,
+									 argv[i], NULL);
+					ret = perf_configset_with_option(set_config,
+									 &user_sections,
+									 user_config,
+									 argv[i], NULL);
+				} else
+					ret = perf_configset_with_option(set_config, sections,
+									 config_exclusive_filename,
+									 argv[i], NULL);
+			}
+		} else {
+			pr_err("Error: Missing arguments\n");
+			parse_options_usage(config_usage, config_options, "r", 1);
+			return -1;
+		}
+		break;
 	case ACTION_SKEL:
 		if (argc)
 			parse_options_usage(config_usage, config_options, "k", 1);
-- 
2.5.0

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

* Re: [PATCH v13 04/23] perf config: Document variables for 'annotate' section in man page
  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
  1 sibling, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-21 14:45 UTC (permalink / raw)
  To: Taeung Song; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar

Em Fri, Jan 08, 2016 at 08:39:34PM +0900, Taeung Song escreveu:
> Explain 'annotate' section and its variables.
> 
> 'hide_src_code', 'use_offset', 'jump_arrows',
> 'show_linenr', 'show_nr_jump' and 'show_total_period'.
> 
> 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 | 110 +++++++++++++++++++++++++++++++
>  1 file changed, 110 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
> index 8835215..85b811f 100644
> --- a/tools/perf/Documentation/perf-config.txt
> +++ b/tools/perf/Documentation/perf-config.txt
> @@ -168,6 +168,116 @@ buildid.*::
>  		cache location, or to disable it altogether. If you want to disable it,
>  		set buildid.dir to /dev/null. The default is $HOME/.debug

I suggest you document here also the hotkeys that are available in the
TUI to toggle those knobs, i.e. please go to the annotate browser and
press 'h', you'll get the list of hotkeys, this way, for someone reading
the man page the information will know that this can be done
interactively, not just by changing a config file.

Also it would be interesting to change the annotate/top/report man page
to point to this documentation.

But this can be done on top, I'm doing quick text flowing/grammar fixes
and applying as much as I can from this patchkit, thanks for continuing
work on it.

- Arnaldo
  
> +annotate.*::
> +	These options work only for TUI.
> +	These are in control of addresses, jump function, source code
> +	in lines of assembly code from a specific program.
> +
> +	annotate.hide_src_code::
> +		If a program which is analyzed has source code,
> +		this option lets 'annotate' print a list of assembly code with the source code.
> +		For example, let's see a part of a program. There're four lines.
> +		If this option is 'true', they can be printed
> +		without source code from a program as below.
> +
> +		│        push   %rbp
> +		│        mov    %rsp,%rbp
> +		│        sub    $0x10,%rsp
> +		│        mov    (%rdi),%rdx
> +
> +		But if this option is 'false', source code of the part
> +		can be also printed as below. Default is 'false'.
> +
> +		│      struct rb_node *rb_next(const struct rb_node *node)
> +		│      {
> +		│        push   %rbp
> +		│        mov    %rsp,%rbp
> +		│        sub    $0x10,%rsp
> +		│              struct rb_node *parent;
> +		│
> +		│              if (RB_EMPTY_NODE(node))
> +		│        mov    (%rdi),%rdx
> +		│              return n;
> +
> +        annotate.use_offset::
> +		Basing on a first address of a loaded function, offset can be used.
> +		Instead of using original addresses of assembly code,
> +		addresses subtracted from a base address can be printed.
> +		Let's illustrate an example.
> +		If a base address is 0XFFFFFFFF81624d50 as below,
> +
> +		ffffffff81624d50 <load0>
> +
> +		an address on assembly code has a specific absolute address as below
> +
> +		ffffffff816250b8:│  mov    0x8(%r14),%rdi
> +
> +		but if use_offset is 'true', an address subtracted from a base address is printed.
> +		Default is true. This option is only applied to TUI.
> +
> +		             368:│  mov    0x8(%r14),%rdi
> +
> +	annotate.jump_arrows::
> +		There can be jump instruction among assembly code.
> +		Depending on a boolean value of jump_arrows,
> +		arrows can be printed or not which represent
> +		where do the instruction jump into as below.
> +
> +		│     ┌──jmp    1333
> +		│     │  xchg   %ax,%ax
> +		│1330:│  mov    %r15,%r10
> +		│1333:└─→cmp    %r15,%r14
> +
> +		If jump_arrow is 'false', the arrows isn't printed as below.
> +		Default is 'false'.
> +
> +		│      ↓ jmp    1333
> +		│        xchg   %ax,%ax
> +		│1330:   mov    %r15,%r10
> +		│1333:   cmp    %r15,%r14
> +
> +        annotate.show_linenr::
> +		When showing source code if this option is 'true',
> +		line numbers are printed as below.
> +
> +		│1628         if (type & PERF_SAMPLE_IDENTIFIER) {
> +		│     ↓ jne    508
> +		│1628                 data->id = *array;
> +		│1629                 array++;
> +		│1630         }
> +
> +		However if this option is 'false', they aren't printed as below.
> +		Default is 'false'.
> +
> +		│             if (type & PERF_SAMPLE_IDENTIFIER) {
> +		│     ↓ jne    508
> +		│                     data->id = *array;
> +		│                     array++;
> +		│             }
> +
> +        annotate.show_nr_jumps::
> +		Let's see a part of assembly code.
> +
> +		│1382:   movb   $0x1,-0x270(%rbp)
> +
> +		If use this, the number of branches jumping to that address can be printed as below.
> +		Default is 'false'.
> +
> +		│1 1382:   movb   $0x1,-0x270(%rbp)
> +
> +        annotate.show_total_period::
> +		To compare two records on an instruction base, with this option
> +		provided, display total number of samples that belong to a line
> +		in assembly code. If this option is 'true', total periods are printed
> +		instead of percent values as below.
> +
> +		  302 │      mov    %eax,%eax
> +
> +		But if this option is 'false', percent values for overhead are printed i.e.
> +		Default is 'false'.
> +
> +		99.93 │      mov    %eax,%eax
> +
>  SEE ALSO
>  --------
>  linkperf:perf[1]
> -- 
> 2.5.0

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

* Re: [PATCH v13 05/23] perf config: Document variables for 'help' section in man page
  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
  0 siblings, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-21 14:46 UTC (permalink / raw)
  To: Taeung Song; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar

Em Fri, Jan 08, 2016 at 08:39:35PM +0900, Taeung Song escreveu:
> Explain 'help.format' variables.
> 
> 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 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
> index 85b811f..aaf1791 100644
> --- a/tools/perf/Documentation/perf-config.txt
> +++ b/tools/perf/Documentation/perf-config.txt
> @@ -278,6 +278,10 @@ annotate.*::
>  
>  		99.93 │      mov    %eax,%eax
>  
> +help.*::
> +	help.format::
> +		A format of manual page can be 'man' that is default.
> +

Huh? If this is the case, i.e. we have something that is configurable
but admits only one option, maybe we should trow this alltogether and
remove the need to document it? :-)

- Arnaldo

>  SEE ALSO
>  --------
>  linkperf:perf[1]
> -- 
> 2.5.0

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

* Re: [PATCH v13 06/23] perf config: Document 'hist.percentage' variable in man page
  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
  1 sibling, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-21 14:54 UTC (permalink / raw)
  To: Taeung Song; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar

Em Fri, Jan 08, 2016 at 08:39:36PM +0900, Taeung Song escreveu:
> Explain 'hist.percentage' variable.
> 
> 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 | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
> index aaf1791..b9892e5 100644
> --- a/tools/perf/Documentation/perf-config.txt
> +++ b/tools/perf/Documentation/perf-config.txt
> @@ -282,6 +282,23 @@ help.*::
>  	help.format::
>  		A format of manual page can be 'man' that is default.
>  
> +hist.*::
> +	hist.percentage::
> +		This option control the way to calculate overhead of filtered entries -
> +		that means the value of this option is effective only if there's a
> +		filter (by comm, dso or symbol name). Suppose a following example:
> +
> +		       Overhead  Symbols
> +		       ........  .......
> +		        33.33%     foo
> +		        33.33%     bar
> +		        33.33%     baz
> +
> +	       This is an original overhead and we'll filter out the first 'foo'
> +	       entry. The value of 'relative' would increase the overhead of 'bar'
> +	       and 'baz' to 50.00% for each, while 'absolute' would show their
> +	       current overhead (33.33%).

Ditto, this one can be toggled interactively using 'F'

- Arnaldo

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

* Re: [PATCH v13 04/23] perf config: Document variables for 'annotate' section in man page
  2016-01-21 14:45   ` Arnaldo Carvalho de Melo
@ 2016-01-22  7:11     ` Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-22  7:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar

Hi, Arnaldo

Sorry for my tardy response.

On 01/21/2016 11:45 PM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jan 08, 2016 at 08:39:34PM +0900, Taeung Song escreveu:
>> Explain 'annotate' section and its variables.
>>
>> 'hide_src_code', 'use_offset', 'jump_arrows',
>> 'show_linenr', 'show_nr_jump' and 'show_total_period'.
>>
>> 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 | 110 +++++++++++++++++++++++++++++++
>>   1 file changed, 110 insertions(+)
>>
>> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
>> index 8835215..85b811f 100644
>> --- a/tools/perf/Documentation/perf-config.txt
>> +++ b/tools/perf/Documentation/perf-config.txt
>> @@ -168,6 +168,116 @@ buildid.*::
>>   		cache location, or to disable it altogether. If you want to disable it,
>>   		set buildid.dir to /dev/null. The default is $HOME/.debug
>
> I suggest you document here also the hotkeys that are available in the
> TUI to toggle those knobs, i.e. please go to the annotate browser and
> press 'h', you'll get the list of hotkeys, this way, for someone reading
> the man page the information will know that this can be done
> interactively, not just by changing a config file.
>

I don't know whether this patch was applied
as it is, because of my tardy response or not..
I saw this patch was included in [GIT PULL] mail.

Would you mind if I add this hotkeys information
into perf-config documentation as new patchset ?

> Also it would be interesting to change the annotate/top/report man page
> to point to this documentation.
>

Ok, I understood that add 'linkperf:perf-config[1]' to section
'SEE ALSO' on the annotate/top/report man page.
Is it right ?

If it isn't, add a sentence such as
'Please refer to the perf-config manual.'
to the annotate/top/report documentation ?

> But this can be done on top, I'm doing quick text flowing/grammar fixes
> and applying as much as I can from this patchkit, thanks for continuing
> work on it.

Although it is a minor contribution,
I'm so glad I could contribute. :-)

Thanks,
Taeung

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

* Re: [PATCH v13 05/23] perf config: Document variables for 'help' section in man page
  2016-01-21 14:46   ` Arnaldo Carvalho de Melo
@ 2016-01-22  8:00     ` Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-22  8:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar


On 01/21/2016 11:46 PM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jan 08, 2016 at 08:39:35PM +0900, Taeung Song escreveu:
>> Explain 'help.format' variables.
>>
>> 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 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
>> index 85b811f..aaf1791 100644
>> --- a/tools/perf/Documentation/perf-config.txt
>> +++ b/tools/perf/Documentation/perf-config.txt
>> @@ -278,6 +278,10 @@ annotate.*::
>>
>>   		99.93 │      mov    %eax,%eax
>>
>> +help.*::
>> +	help.format::
>> +		A format of manual page can be 'man' that is default.
>> +
>
> Huh? If this is the case, i.e. we have something that is configurable
> but admits only one option, maybe we should trow this alltogether and
> remove the need to document it? :-)
>

Hum.. I think so.

I tested config variables 'help.format' and 'man.viewer', again.
Selecting which manual page viewer can be done by both
this config variables.

So IMHO I think even if 'help.format' is removed,
it hasn't problem because this functionality is duplicated.
And I think it seems to be tidy that the whole 'help' section
is removed or just don't document it on perf-config doc.

Would I keep working on perf-config patchkit excluding 'help' section ?


Thanks,
Taeung

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

* Re: [PATCH v13 06/23] perf config: Document 'hist.percentage' variable in man page
  2016-01-21 14:54   ` Arnaldo Carvalho de Melo
@ 2016-01-22  8:03     ` Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: Taeung Song @ 2016-01-22  8:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Ingo Molnar



On 01/21/2016 11:54 PM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jan 08, 2016 at 08:39:36PM +0900, Taeung Song escreveu:
>> Explain 'hist.percentage' variable.
>>
>> 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 | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
>> index aaf1791..b9892e5 100644
>> --- a/tools/perf/Documentation/perf-config.txt
>> +++ b/tools/perf/Documentation/perf-config.txt
>> @@ -282,6 +282,23 @@ help.*::
>>   	help.format::
>>   		A format of manual page can be 'man' that is default.
>>
>> +hist.*::
>> +	hist.percentage::
>> +		This option control the way to calculate overhead of filtered entries -
>> +		that means the value of this option is effective only if there's a
>> +		filter (by comm, dso or symbol name). Suppose a following example:
>> +
>> +		       Overhead  Symbols
>> +		       ........  .......
>> +		        33.33%     foo
>> +		        33.33%     bar
>> +		        33.33%     baz
>> +
>> +	       This is an original overhead and we'll filter out the first 'foo'
>> +	       entry. The value of 'relative' would increase the overhead of 'bar'
>> +	       and 'baz' to 50.00% for each, while 'absolute' would show their
>> +	       current overhead (33.33%).
>
> Ditto, this one can be toggled interactively using 'F'


I got it.
As I say on previous mail,
Would I work new patchset for hotkeys information ?


Thanks,
Taeung

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

* [tip:perf/core] perf config: Document variables for 'colors' section in man page
  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-bot for Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: tip-bot for Taeung Song @ 2016-02-03 10:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, treeze.taeung, namhyung, linux-kernel, tglx, mingo, jolsa, hpa

Commit-ID:  89debf178708458ac62f5b53dfc97437009d02d3
Gitweb:     http://git.kernel.org/tip/89debf178708458ac62f5b53dfc97437009d02d3
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 8 Jan 2016 20:39:31 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Jan 2016 11:52:46 -0300

perf config: Document variables for 'colors' section in man page

Explain 'colors' section and its variables, used for The variables for
customizing the colors used in the output for the 'report', 'top' and
'annotate' in the TUI, those are:

'top', 'medium', 'normal', 'selected',
'jump_arrows', 'addr' and 'root'.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1452253193-30502-2-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 46 ++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 1ee488b..8051782 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -98,6 +98,52 @@ Given a $HOME/.perfconfig like this:
 		order = caller
 		sort-key = function
 
+Variables
+~~~~~~~~~
+
+colors.*::
+	The variables for customizing the colors used in the output for the
+	'report', 'top' and 'annotate' in the TUI. They should specify the
+	foreground and background colors, separated by a comma, for example:
+
+		medium = green, lightgray
+
+	If you want to use the color configured for you terminal, just leave it
+	as 'default', for example:
+
+		medium = default, lightgray
+
+	Available colors:
+	red, yellow, green, cyan, gray, black, blue,
+	white, default, magenta, lightgray
+
+	colors.top::
+		'top' means a overhead percentage which is more than 5%.
+		And values of this variable specify percentage colors.
+		Basic key values are foreground-color 'red' and
+		background-color 'default'.
+	colors.medium::
+		'medium' means a overhead percentage which has more than 0.5%.
+		Default values are 'green' and 'default'.
+	colors.normal::
+		'normal' means the rest of overhead percentages
+		except 'top', 'medium', 'selected'.
+		Default values are 'lightgray' and 'default'.
+	colors.selected::
+		This selects the colors for the current entry in a list of entries
+		from sub-commands (top, report, annotate).
+		Default values are 'black' and 'lightgray'.
+	colors.jump_arrows::
+		Colors for jump arrows on assembly code listings
+		such as 'jns', 'jmp', 'jane', etc.
+		Default values are 'blue', 'default'.
+	colors.addr::
+		This selects colors for addresses from 'annotate'.
+		Default values are 'magenta', 'default'.
+	colors.root::
+		Colors for headers in the output of a sub-commands (top, report).
+		Default values are 'white', 'blue'.
+
 SEE ALSO
 --------
 linkperf:perf[1]

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

* [tip:perf/core] perf config: Document variables for 'tui' and ' gtk' sections in man page
  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-bot for Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: tip-bot for Taeung Song @ 2016-02-03 10:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, treeze.taeung, jolsa, namhyung, hpa, acme, tglx

Commit-ID:  3fa9f40718a33d27eb2f4bd36c13318a2d58839d
Gitweb:     http://git.kernel.org/tip/3fa9f40718a33d27eb2f4bd36c13318a2d58839d
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 8 Jan 2016 20:39:32 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Jan 2016 11:52:47 -0300

perf config: Document variables for 'tui' and 'gtk' sections in man page

Explain 'tui' and 'gtk' sections and these variables.

'top', 'report' and 'annotate'

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1452253193-30502-3-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 8051782..ccbdb64 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -144,6 +144,16 @@ colors.*::
 		Colors for headers in the output of a sub-commands (top, report).
 		Default values are 'white', 'blue'.
 
+tui.*, gtk.*::
+	Subcommands that can be configured here are 'top', 'report' and 'annotate'.
+	These values are booleans, for example:
+
+	[tui]
+		top = true
+
+	will make the TUI be the default for the 'top' subcommand. Those will be
+	available if the required libs were detected at tool build time.
+
 SEE ALSO
 --------
 linkperf:perf[1]

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

* [tip:perf/core] perf config: Document 'buildid.dir' variable in man page
  2016-01-08 11:39 ` [PATCH v13 03/23] perf config: Document 'buildid.dir' variable " Taeung Song
@ 2016-02-03 10:09   ` tip-bot for Taeung Song
  0 siblings, 0 replies; 35+ messages in thread
From: tip-bot for Taeung Song @ 2016-02-03 10:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, tglx, treeze.taeung, hpa, namhyung, jolsa, mingo

Commit-ID:  2733525b8c1a5f9b6e55338d836b835c9c698913
Gitweb:     http://git.kernel.org/tip/2733525b8c1a5f9b6e55338d836b835c9c698913
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 8 Jan 2016 20:39:33 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Jan 2016 11:52:47 -0300

perf config: Document 'buildid.dir' variable in man page

Explain 'buildid.dir' variable.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1452253193-30502-4-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index ccbdb64..a095f0c 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -154,6 +154,21 @@ tui.*, gtk.*::
 	will make the TUI be the default for the 'top' subcommand. Those will be
 	available if the required libs were detected at tool build time.
 
+buildid.*::
+	buildid.dir::
+		Each executable and shared library in modern distributions comes with a
+		content based identifier that, if available, will be inserted in a
+		'perf.data' file header to, at analysis time find what is needed to do
+		symbol resolution, code annotation, etc.
+
+		The recording tools also stores a hard link or copy in a per-user
+		directory, $HOME/.debug/, of binaries, shared libraries, /proc/kallsyms
+		and /proc/kcore files to be used at analysis time.
+
+		The buildid.dir variable can be used to either change this directory
+		cache location, or to disable it altogether. If you want to disable it,
+		set buildid.dir to /dev/null. The default is $HOME/.debug
+
 SEE ALSO
 --------
 linkperf:perf[1]

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

* [tip:perf/core] perf config: Document variables for 'annotate' section in man page
  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-02-03 10:10   ` tip-bot for Taeung Song
  1 sibling, 0 replies; 35+ messages in thread
From: tip-bot for Taeung Song @ 2016-02-03 10:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: treeze.taeung, namhyung, tglx, acme, linux-kernel, mingo, jolsa, hpa

Commit-ID:  3b97629d139b19cbcd15b0b3c128a4d6587d2091
Gitweb:     http://git.kernel.org/tip/3b97629d139b19cbcd15b0b3c128a4d6587d2091
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 8 Jan 2016 20:39:34 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Jan 2016 11:52:48 -0300

perf config: Document variables for 'annotate' section in man page

Explain 'annotate' section and its variables.

'hide_src_code', 'use_offset', 'jump_arrows',
'show_linenr', 'show_nr_jump' and 'show_total_period'.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1452253193-30502-5-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 110 +++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index a095f0c..cb7ca50 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -169,6 +169,116 @@ buildid.*::
 		cache location, or to disable it altogether. If you want to disable it,
 		set buildid.dir to /dev/null. The default is $HOME/.debug
 
+annotate.*::
+	These options work only for TUI.
+	These are in control of addresses, jump function, source code
+	in lines of assembly code from a specific program.
+
+	annotate.hide_src_code::
+		If a program which is analyzed has source code,
+		this option lets 'annotate' print a list of assembly code with the source code.
+		For example, let's see a part of a program. There're four lines.
+		If this option is 'true', they can be printed
+		without source code from a program as below.
+
+		│        push   %rbp
+		│        mov    %rsp,%rbp
+		│        sub    $0x10,%rsp
+		│        mov    (%rdi),%rdx
+
+		But if this option is 'false', source code of the part
+		can be also printed as below. Default is 'false'.
+
+		│      struct rb_node *rb_next(const struct rb_node *node)
+		│      {
+		│        push   %rbp
+		│        mov    %rsp,%rbp
+		│        sub    $0x10,%rsp
+		│              struct rb_node *parent;
+		│
+		│              if (RB_EMPTY_NODE(node))
+		│        mov    (%rdi),%rdx
+		│              return n;
+
+        annotate.use_offset::
+		Basing on a first address of a loaded function, offset can be used.
+		Instead of using original addresses of assembly code,
+		addresses subtracted from a base address can be printed.
+		Let's illustrate an example.
+		If a base address is 0XFFFFFFFF81624d50 as below,
+
+		ffffffff81624d50 <load0>
+
+		an address on assembly code has a specific absolute address as below
+
+		ffffffff816250b8:│  mov    0x8(%r14),%rdi
+
+		but if use_offset is 'true', an address subtracted from a base address is printed.
+		Default is true. This option is only applied to TUI.
+
+		             368:│  mov    0x8(%r14),%rdi
+
+	annotate.jump_arrows::
+		There can be jump instruction among assembly code.
+		Depending on a boolean value of jump_arrows,
+		arrows can be printed or not which represent
+		where do the instruction jump into as below.
+
+		│     ┌──jmp    1333
+		│     │  xchg   %ax,%ax
+		│1330:│  mov    %r15,%r10
+		│1333:└─→cmp    %r15,%r14
+
+		If jump_arrow is 'false', the arrows isn't printed as below.
+		Default is 'false'.
+
+		│      ↓ jmp    1333
+		│        xchg   %ax,%ax
+		│1330:   mov    %r15,%r10
+		│1333:   cmp    %r15,%r14
+
+        annotate.show_linenr::
+		When showing source code if this option is 'true',
+		line numbers are printed as below.
+
+		│1628         if (type & PERF_SAMPLE_IDENTIFIER) {
+		│     ↓ jne    508
+		│1628                 data->id = *array;
+		│1629                 array++;
+		│1630         }
+
+		However if this option is 'false', they aren't printed as below.
+		Default is 'false'.
+
+		│             if (type & PERF_SAMPLE_IDENTIFIER) {
+		│     ↓ jne    508
+		│                     data->id = *array;
+		│                     array++;
+		│             }
+
+        annotate.show_nr_jumps::
+		Let's see a part of assembly code.
+
+		│1382:   movb   $0x1,-0x270(%rbp)
+
+		If use this, the number of branches jumping to that address can be printed as below.
+		Default is 'false'.
+
+		│1 1382:   movb   $0x1,-0x270(%rbp)
+
+        annotate.show_total_period::
+		To compare two records on an instruction base, with this option
+		provided, display total number of samples that belong to a line
+		in assembly code. If this option is 'true', total periods are printed
+		instead of percent values as below.
+
+		  302 │      mov    %eax,%eax
+
+		But if this option is 'false', percent values for overhead are printed i.e.
+		Default is 'false'.
+
+		99.93 │      mov    %eax,%eax
+
 SEE ALSO
 --------
 linkperf:perf[1]

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

* [tip:perf/core] perf config: Document 'hist.percentage' variable in man page
  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-02-03 10:10   ` tip-bot for Taeung Song
  1 sibling, 0 replies; 35+ messages in thread
From: tip-bot for Taeung Song @ 2016-02-03 10:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, jolsa, tglx, acme, linux-kernel, namhyung, hpa, treeze.taeung

Commit-ID:  485311d97863f2810646e17c8075be2992225f98
Gitweb:     http://git.kernel.org/tip/485311d97863f2810646e17c8075be2992225f98
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 8 Jan 2016 20:39:36 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 26 Jan 2016 11:52:48 -0300

perf config: Document 'hist.percentage' variable in man page

Explain 'hist.percentage' variable.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1452253193-30502-7-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index cb7ca50..74589c6 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -279,6 +279,23 @@ annotate.*::
 
 		99.93 │      mov    %eax,%eax
 
+hist.*::
+	hist.percentage::
+		This option control the way to calculate overhead of filtered entries -
+		that means the value of this option is effective only if there's a
+		filter (by comm, dso or symbol name). Suppose a following example:
+
+		       Overhead  Symbols
+		       ........  .......
+		        33.33%     foo
+		        33.33%     bar
+		        33.33%     baz
+
+	       This is an original overhead and we'll filter out the first 'foo'
+	       entry. The value of 'relative' would increase the overhead of 'bar'
+	       and 'baz' to 50.00% for each, while 'absolute' would show their
+	       current overhead (33.33%).
+
 SEE ALSO
 --------
 linkperf:perf[1]

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

end of thread, other threads:[~2016-02-03 10:11 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v13 19/23] perf config: Add --verbose option for showing config description Taeung Song
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.