perf config : Adding a command 'config' with a option '--list' and a document for it.
PATCH 1/1 perf config : Adding a command 'config' with a option '--list' and a document for it.
The perf configuration file contain many variables which can make
the perf command's action more effective and more skilful.
But looking through state of configuration is difficult and
there's no knowing what kind of other variables except variables in perfconfig.example exist.
So This patch adds a command 'config --list' and a document for it.
--- tools/perf/Documentation/perf-config.txt | 140 +++++++++++++++++++++++++++++++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-config.c | 56 +++++++++++++ tools/perf/builtin.h | 1 + tools/perf/command-list.txt | 1 + tools/perf/perf.c | 1 + 6 files changed, 200 insertions(+) create mode 100644 tools/perf/Documentation/perf-config.txt create mode 100644 tools/perf/builtin-config.c
tools/perf/Documentation/perf-config.txt new file +140 -0
@@ -0,0 +1,140 @@ +perf-config(1) +============== + +NAME +---- +perf-config - Get and set variables in configuration file. + +SYNOPSIS +-------- +[verse] +'perf config' --list + +DESCRIPTION +----------- +You can manage variables in configuration file with this command. + +OPTIONS +------- + +-l:: +--list:: + Show all variables with key and value into each sections. + +CONFIGURATION FILE +------------------ + +The Perf configuration file contain many variables which can make +the perf command's action more effective, more skilful. +The '$HOME/.perfconfig' file is used to store a per-user configuration. +The file 'etc/perfconfig' or '$(sysconfdir)/.perfconf' can be used to +store a system-wide default configuration. + +The variables are divided into sections. In each sections, the variables +can contain a key and values. + +EXAMPLES +------------ + +Given a $HOME/.perfconfig like this: + +# +# This is the config file, and +# a '#' character indicates a comment +# + +[colors] + # There are types of color which are red, + # green, default, black, blue, + # white, magenta, lightgray + top = red, lightgray + medium = green, lightgray + normal = black, lightgray + selected = lightgray, magenta + code = blue, lightgray + addr = magenta, lightgray + root = default + +[tui] + # Defaults if linked with libslang + report = on + annotate = on + top = on + +[gtk] + report = on + annotate = on + top = on + +[buildid] + # Default, disable using /dev/null + dir = /root/.debug + +[annotate] + # Defaults + hide_src_code = false + use_offset = true + jump_arrows = true + show_nr_jumps = false + +[pager] + # That a 'cmd' is true mean to use pager + cmd = true + +[alias] + +[help] + # Format can be man, info, web or html + format = web + autocorrect = 3 + +[core] + # fall through + +[hist] + # a value of 'percentage' can be 'relative' or 'absolute' + percentage = relative + +[ui] + show-headers= true + +[call-graph] + # fp (framepointer), dwarf + # If you use 'Dwarf style', + # you can add ', (dump-size)' to record-mode such as ', 24' + record-mode = fp + + dump-size = 24 + + # graph (graph absolute), flat, fractal (graph relative) + print-type = graph + + # caller, callee + order = caller + + # function, address + sort-key = function + + threshold = 13.3 + print-limit = 54.3 + +[report] + group = true + percent-limit = 70.54 + children = true + queue-size = 32 + +[man] + cmd = + path = + viewer = + +[record] + # fall through + call-graph = + +[top] + # a 'call-graph' is fall through + call-graph = + children = true +
tools/perf/Makefile.perf +1 -0
@@ -475,6 +475,7 @@ BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o +BUILTIN_OBJS += $(OUTPUT)builtin-config.o BUILTIN_OBJS += $(OUTPUT)builtin-diff.o BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o BUILTIN_OBJS += $(OUTPUT)builtin-help.o
tools/perf/builtin-config.c new file +56 -0
56 lines not on this page · raw message
tools/perf/builtin.h +1 -0
@@ -17,6 +17,7 @@ extern int cmd_annotate(int argc, const char **argv, const char *prefix);extern int cmd_bench (int argc,const char **argv,const char *prefix);extern int cmd_buildid_cache (int argc,const char **argv,const char *prefix);extern int cmd_buildid_list (int argc,const char **argv,const char *prefix); +extern int cmd_config (int argc,const char **argv,const char *prefix);extern int cmd_diff (int argc,const char **argv,const char *prefix);extern int cmd_evlist (int argc,const char **argv,const char *prefix);extern int cmd_help (int argc,const char **argv,const char *prefix);
tools/perf/command-list.txt +1 -0
@@ -7,6 +7,7 @@ perf-archive mainporcelain common perf-bench mainporcelain common perf-buildid-cache mainporcelain common perf-buildid-list mainporcelain common +perf-config mainporcelain common perf-diff mainporcelain common perf-evlist mainporcelain common perf-inject mainporcelain common
tools/perf/perf.c +1 -0
@@ -36,6 +36,7 @@ struct cmd_struct {static struct cmd_struct commands[] = { {"buildid-cache" , cmd_buildid_cache,0 }, {"buildid-list" , cmd_buildid_list,0 }, + {"config" , cmd_config,0 }, {"diff" , cmd_diff,0 }, {"evlist" , cmd_evlist,0 }, {"help" , cmd_help,0 },
Signature · 1 line
1.9.1
Namhyung Kim
maintainerHi Taeung,
Quoted 25 lines · Taeung Song
The perf configuration file contain many variables which can make
the perf command's action more effective and more skilful.
But looking through state of configuration is difficult and
there's no knowing what kind of other variables except variables in perfconfig.example exist.So This patch adds a command 'config --list' and a document for it.
Signed-off-by Taeung Song <[email protected]>--- tools/perf/Documentation/perf-config.txt | 140 +++++++++++++++++++++++++++++++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-config.c | 56 +++++++++++++ tools/perf/builtin.h | 1 + tools/perf/command-list.txt | 1 + tools/perf/perf.c | 1 + 6 files changed, 200 insertions(+) create mode 100644 tools/perf/Documentation/perf-config.txt create mode 100644 tools/perf/builtin-config.ctools/perf/Documentation/perf-config.txt new file +0
-0
tools/perf/Documentation/perf-config.txt line 6
Quoted 6 lines
tools/perf/Documentation/perf-config.txt new file +6
-0@@ -0,0 +1,140 @@ +perf-config(1) +============== + +NAME +---- +perf-config - Get and set variables in configuration file.
So do you also plan to add support for setting config variables like git-config with this? :)
Quoted 14 lines
tools/perf/Documentation/perf-config.txt new file +14
-0+ +SYNOPSIS +-------- +[verse] +'perf config' --list + +DESCRIPTION +----------- +You can manage variables in configuration file with this command. + +OPTIONS +------- + +-l::
tools/perf/Documentation/perf-config.txt line 30
Quoted 10 lines
tools/perf/Documentation/perf-config.txt new file +10
-0+--list:: + Show all variables with key and value into each sections. + +CONFIGURATION FILE +------------------ + +The Perf configuration file contain many variables which can make +the perf command's action more effective, more skilful. +The '$HOME/.perfconfig' file is used to store a per-user configuration. +The file 'etc/perfconfig' or '$(sysconfdir)/.perfconf' can be used to
I think it's '/etc/perfconfig' or '$(sysconfdir)/perfconfig'.
Quoted 99 lines
tools/perf/Documentation/perf-config.txt new file +99
-0+store a system-wide default configuration. + +The variables are divided into sections. In each sections, the variables +can contain a key and values. + +EXAMPLES +------------ + +Given a $HOME/.perfconfig like this: + +# +# This is the config file, and +# a '#' character indicates a comment +# + +[colors] + # There are types of color which are red, + # green, default, black, blue, + # white, magenta, lightgray + top = red, lightgray + medium = green, lightgray + normal = black, lightgray + selected = lightgray, magenta + code = blue, lightgray + addr = magenta, lightgray + root = default + +[tui] + # Defaults if linked with libslang + report = on + annotate = on + top = on + +[gtk] + report = on + annotate = on + top = on + +[buildid] + # Default, disable using /dev/null + dir = /root/.debug + +[annotate] + # Defaults + hide_src_code = false + use_offset = true + jump_arrows = true + show_nr_jumps = false + +[pager] + # That a 'cmd' is true mean to use pager + cmd = true + +[alias] + +[help] + # Format can be man, info, web or html + format = web + autocorrect = 3 + +[core] + # fall through + +[hist] + # a value of 'percentage' can be 'relative' or 'absolute' + percentage = relative + +[ui] + show-headers= true + +[call-graph] + # fp (framepointer), dwarf + # If you use 'Dwarf style', + # you can add ', (dump-size)' to record-mode such as ', 24' + record-mode = fp + + dump-size = 24 + + # graph (graph absolute), flat, fractal (graph relative) + print-type = graph + + # caller, callee + order = caller + + # function, address + sort-key = function + + threshold = 13.3 + print-limit = 54.3 + +[report] + group = true + percent-limit = 70.54 + children = true + queue-size = 32 + +[man] + cmd = + path =
tools/perf/Documentation/perf-config.txt line 139
Quoted 10 lines
tools/perf/Documentation/perf-config.txt new file +10
-0+ viewer = + +[record] + # fall through + call-graph = + +[top] + # a 'call-graph' is fall through + call-graph = + children = true
While it's nice to list up all config variables in the example section, it'd be much greater if you could describe them in more detail like git-config manual page.
Thanks,
Namhyung
Quoted 119 lines
tools/perf/Documentation/perf-config.txt new file +1
-0+tools/perf/Makefile.perf +1
-0@@ -475,6 +475,7 @@ BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o +BUILTIN_OBJS += $(OUTPUT)builtin-config.o BUILTIN_OBJS += $(OUTPUT)builtin-diff.o BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o BUILTIN_OBJS += $(OUTPUT)builtin-help.otools/perf/builtin-config.c new file +56
-0@@ -0,0 +1,56 @@ +/* +* builtin-config.c +* +* Copyright (C) 2015, Taeung Song <[email protected]> +* +*/ +#include "builtin.h" + +#include "perf.h" + +#include "util/cache.h" +#include "util/parse-options.h" +#include "util/util.h" + +static struct { +bool list_action; +} params; + +static int show_all_config (const char *key,const char *value, +void *cb__maybe_unused ) +{ +if (value) +printf ("%s=%s\n" , key, value); +else +printf ("%s\n" , key); + +return 0 ; +} + +static int +cmd_config (int argc,const char **argv,const char *prefix__maybe_unused ) +{ +int ret =0 ; +const char *const config_usage[] = { +"perf config --list" , +NULL + }; +const struct option options[] = { +OPT_BOOLEAN ('l' ,"list" , ¶ms.list_action,"list up current configurations" ), +OPT_END () + }; + + argc =parse_options (argc, argv, options, config_usage, +PARSE_OPT_STOP_AT_NON_OPTION ); +if (argc >0 ) { +if (strcmp (argv[0 ],"-" ) ==0 ) +pr_warn (" Error: '-' is not supported.\n" ); + +usage_with_options (config_usage, options); + } + +if (params.list_action) + ret =perf_config (show_all_config,NULL ); + +return ret; +}tools/perf/builtin.h +1
-0@@ -17,6 +17,7 @@ extern int cmd_annotate(int argc, const char **argv, const char *prefix);extern int cmd_bench (int argc,const char **argv,const char *prefix);extern int cmd_buildid_cache (int argc,const char **argv,const char *prefix);extern int cmd_buildid_list (int argc,const char **argv,const char *prefix); +extern int cmd_config (int argc,const char **argv,const char *prefix);extern int cmd_diff (int argc,const char **argv,const char *prefix);extern int cmd_evlist (int argc,const char **argv,const char *prefix);extern int cmd_help (int argc,const char **argv,const char *prefix);tools/perf/command-list.txt +1
-0@@ -7,6 +7,7 @@ perf-archive mainporcelain common perf-bench mainporcelain common perf-buildid-cache mainporcelain common perf-buildid-list mainporcelain common +perf-config mainporcelain common perf-diff mainporcelain common perf-evlist mainporcelain common perf-inject mainporcelain commontools/perf/perf.c +1
-0@@ -36,6 +36,7 @@ struct cmd_struct {static struct cmd_struct commands[] = { {"buildid-cache" , cmd_buildid_cache,0 }, {"buildid-list" , cmd_buildid_list,0 }, + {"config" , cmd_config,0 }, {"diff" , cmd_diff,0 }, {"evlist" , cmd_evlist,0 }, {"help" , cmd_help,0 },Signature · 7 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Namhyung Kim
maintainerHi Taewoong,
Quoted 10 lines · TaeWoong Song
I have a question about man page.
Although I added perf-config.txt file in Documentaion folder, I've guessed perf-config man page might not be registered. Because of this
$ sudo ./perf help config No manual entry for perf-configInstead of adding path for perf-config man page to MANPATH, is other way which let ‘perf help config’ work ?
Did you run 'make install-doc'?
Thanks,
Namhyung
Quoted 308 lines
Quoted 308 lines · Namhyung Kim
Hi Taeung,
Quoted 25 lines · Taeung Song
The perf configuration file contain many variables which can make
the perf command's action more effective and more skilful.
But looking through state of configuration is difficult and
there's no knowing what kind of other variables except variables in perfconfig.example exist.So This patch adds a command 'config --list' and a document for it.
Signed-off-by Taeung Song <[email protected]>---
tools/perf/Documentation/perf-config.txt | 140 +++++++++++++++++++++++++++++++ tools/perf/Makefile.perf | 1 + tools/perf/builtin-config.c | 56 +++++++++++++ tools/perf/builtin.h | 1 + tools/perf/command-list.txt | 1 + tools/perf/perf.c | 1 + 6 files changed, 200 insertions(+)create mode 100644
tools/perf/Documentation/perf-config.txtcreate mode 100644tools/perf/builtin-config.ctools/perf/Documentation/perf-config.txt new file +0
-0tools/perf/Documentation/perf-config.txt line 6
Quoted 6 lines
tools/perf/Documentation/perf-config.txt new file +6
-0@@ -0,0 +1,140 @@ +perf-config(1) +============== + +NAME +---- +perf-config - Get and set variables in configuration file.So do you also plan to add support for setting config variables like git-config with this? :)
Quoted 14 lines
tools/perf/Documentation/perf-config.txt new file +14
-0+ +SYNOPSIS +-------- +[verse] +'perf config' --list + +DESCRIPTION +----------- +You can manage variables in configuration file with this command. + +OPTIONS +------- + +-l::tools/perf/Documentation/perf-config.txt line 30
Quoted 10 lines
tools/perf/Documentation/perf-config.txt new file +10
-0+--list:: + Show all variables with key and value into each sections. + +CONFIGURATION FILE +------------------ + +The Perf configuration file contain many variables which can make +the perf command's action more effective, more skilful. +The '$HOME/.perfconfig' file is used to store a per-user configuration. +The file 'etc/perfconfig' or '$(sysconfdir)/.perfconf' can be used toI think it's '
/etc/perfconfig' or '$(sysconfdir)/perfconfig'.Quoted 99 lines
tools/perf/Documentation/perf-config.txt new file +99
-0+store a system-wide default configuration. + +The variables are divided into sections. In each sections, the variables +can contain a key and values. + +EXAMPLES +------------ + +Given a $HOME/.perfconfig like this: + +# +# This is the config file, and +# a '#' character indicates a comment +# + +[colors] + # There are types of color which are red, + # green, default, black, blue, + # white, magenta, lightgray + top = red, lightgray + medium = green, lightgray + normal = black, lightgray + selected = lightgray, magenta + code = blue, lightgray + addr = magenta, lightgray + root = default + +[tui] + # Defaults if linked with libslang + report = on + annotate = on + top = on + +[gtk] + report = on + annotate = on + top = on + +[buildid] + # Default, disable using /dev/null + dir = /root/.debug + +[annotate] + # Defaults + hide_src_code = false + use_offset = true + jump_arrows = true + show_nr_jumps = false + +[pager] + # That a 'cmd' is true mean to use pager + cmd = true + +[alias] + +[help] + # Format can be man, info, web or html + format = web + autocorrect = 3 + +[core] + # fall through + +[hist] + # a value of 'percentage' can be 'relative' or 'absolute' + percentage = relative + +[ui] + show-headers= true + +[call-graph] + # fp (framepointer), dwarf + # If you use 'Dwarf style', + # you can add ', (dump-size)' to record-mode such as ', 24' + record-mode = fp + + dump-size = 24 + + # graph (graph absolute), flat, fractal (graph relative) + print-type = graph + + # caller, callee + order = caller + + # function, address + sort-key = function + + threshold = 13.3 + print-limit = 54.3 + +[report] + group = true + percent-limit = 70.54 + children = true + queue-size = 32 + +[man] + cmd = + path =tools/perf/Documentation/perf-config.txt line 139
Quoted 10 lines
tools/perf/Documentation/perf-config.txt new file +10
-0+ viewer = + +[record] + # fall through + call-graph = + +[top] + # a 'call-graph' is fall through + call-graph = + children = trueWhile it's nice to list up all config variables in the example section, it'd be much greater if you could describe them in more detail like git-config manual page.
Thanks,
NamhyungQuoted 119 lines
tools/perf/Documentation/perf-config.txt new file +1
-0+tools/perf/Makefile.perf +0
-0@@ -475,6 +475,7 @@ BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
BUILTIN_OBJS+= $(OUTPUT)bench/futex-wake.oBUILTIN_OBJS+= $(OUTPUT)bench/futex-requeue.o+BUILTIN_OBJS += $(OUTPUT)builtin-config.o
BUILTIN_OBJS+= $(OUTPUT)builtin-diff.oBUILTIN_OBJS+= $(OUTPUT)builtin-evlist.oBUILTIN_OBJS+= $(OUTPUT)builtin-help.otools/perf/builtin-config.c new file +56
-0@@ -0,0 +1,56 @@ +/* +* builtin-config.c +* +* Copyright (C) 2015, Taeung Song <[email protected]> +* +*/ +#include "builtin.h" + +#include "perf.h" + +#include "util/cache.h" +#include "util/parse-options.h" +#include "util/util.h" + +static struct { +bool list_action; +} params; + +static int show_all_config (const char *key,const char *value, +void *cb__maybe_unused ) +{ +if (value) +printf ("%s=%s\n" , key, value); +else +printf ("%s\n" , key); + +return 0 ; +} + +static int +cmd_config (int argc,const char **argv,const char *prefix__maybe_unused ) +{ +int ret =0 ; +const char *const config_usage[] = { +"perf config --list" , +NULL + }; +const struct option options[] = { +OPT_BOOLEAN ('l' ,"list" , ¶ms.list_action,"list up current configurations" ), +OPT_END () + }; + + argc =parse_options (argc, argv, options, config_usage, +PARSE_OPT_STOP_AT_NON_OPTION ); +if (argc >0 ) { +if (strcmp (argv[0 ],"-" ) ==0 ) +pr_warn (" Error: '-' is not supported.\n" ); + +usage_with_options (config_usage, options); + } + +if (params.list_action) + ret =perf_config (show_all_config,NULL ); + +return ret; +}tools/perf/builtin.h +1
-0@@ -17,6 +17,7 @@ extern int cmd_annotate(int argc, const char **argv, const char *prefix);extern int cmd_bench (int argc,const char **argv,const char *prefix);extern int cmd_buildid_cache (int argc,const char **argv,const char *prefix);extern int cmd_buildid_list (int argc,const char **argv,const char *prefix); +extern int cmd_config (int argc,const char **argv,const char *prefix);extern int cmd_diff (int argc,const char **argv,const char *prefix);extern int cmd_evlist (int argc,const char **argv,const char *prefix);extern int cmd_help (int argc,const char **argv,const char *prefix);tools/perf/command-list.txt +0
-0@@ -7,6 +7,7 @@ perf-archive mainporcelain commonperf-bench mainporcelain common
perf-buildid-cache mainporcelain common
perf-buildid-list mainporcelain common
+perf-config mainporcelain common
perf-diff mainporcelain common
perf-evlist mainporcelain common
perf-inject mainporcelain commontools/perf/perf.c +1
-0@@ -36,6 +36,7 @@ struct cmd_struct {static struct cmd_struct commands[] = { {"buildid-cache" , cmd_buildid_cache,0 }, {"buildid-list" , cmd_buildid_list,0 }, + {"config" , cmd_config,0 }, {"diff" , cmd_diff,0 }, {"evlist" , cmd_evlist,0 }, {"help" , cmd_help,0 },Signature · 7 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] <mailto:[email protected]> More majordomo info at http://vger.kernel.org/majordomo-info.html <http://vger.kernel.org/majordomo-info.html> Please read the FAQ at http://www.tux.org/lkml/ <http://www.tux.org/lkml/>