linux/tools/perf
Taeung Song 8a0a9c7e91 perf config: Introduce new init() and exit()
Many sub-commands use perf_config() but everytime perf_config() is
called, perf_config() always read config files.  (i.e. user config
'~/.perfconfig' and system config '$(sysconfdir)/perfconfig')

But it is better to use the config set that already contains all config
key-value pairs to avoid this repetitive work reading the config files
in perf_config(). (the config set mean a static variable 'config_set')

In other words, if new perf_config__init() is called, only first time
'config_set' is initialized collecting all configs from the config
files.  And then we could use new perf_config() like old perf_config().
When a sub-command finished, free the config set by perf_config__exit()
at run_builtin().

If we do, 'config_set' can be reused wherever perf_config() is called
and a feature of old perf_config() is the same as new perf_config() work
without the repetitive work that read the config files.

In summary, in order to use features about configuration,
we can call the functions at perf.c and other source files as below.

    # initialize a config set
    perf_config__init()

    # configure actual variables from a config set
    perf_config()

    # eliminate allocated config set
    perf_config__exit()

    # destroy existing config set and initialize a new config set.
    perf_config__refresh()

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466691272-24117-3-git-send-email-treeze.taeung@gmail.com
[ 'init' counterpart is 'exit', not 'finish' ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-06-23 17:20:04 -03:00
..
Documentation perf script: Add callindent option 2016-06-23 17:04:26 -03:00
arch perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
bench perf bench: Remove one more die() call 2016-04-26 13:28:40 -03:00
config kbuild: List libelf-devel as an alternative 2016-06-21 13:18:32 -03:00
jvmti perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
python
scripts perf script stackcollapse: Remove reference to the perl interpreter 2016-06-22 09:56:34 -03:00
tests perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
trace perf trace: Move seccomp args beautifiers to tools/perf/trace/beauty/ 2016-05-11 13:06:00 -03:00
ui perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
util perf config: Introduce new init() and exit() 2016-06-23 17:20:04 -03:00
.gitignore perf tools: Add arch/*/include/generated/ to .gitignore 2016-05-30 12:41:46 -03:00
Build perf tools: Set and pass DOCDIR to builtin-report.c 2016-01-12 12:42:07 -03:00
CREDITS
MANIFEST perf bench: Fix detached tarball building due to missing 'perf bench memcpy' headers 2016-03-24 12:28:57 -03:00
Makefile perf build tests: Do parallell builds with 'build-test' 2016-02-04 15:57:00 -03:00
Makefile.perf perf tools: Let python use correct gcc for build_ext 2016-06-22 16:11:42 -03:00
builtin-annotate.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-bench.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-buildid-cache.c perf tools: Rename strlist_for_each() macros to for_each_entry() 2016-06-23 11:35:01 -03:00
builtin-buildid-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-config.c perf config: Introduce new init() and exit() 2016-06-23 17:20:04 -03:00
builtin-data.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-diff.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-evlist.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-help.c perf config: Move config declarations from util/cache.h to util/config.h 2016-06-23 08:51:41 -03:00
builtin-inject.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-kmem.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-kvm.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-lock.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-mem.c perf mem: Add --ldlat option 2016-06-15 10:35:27 -03:00
builtin-probe.c perf tools: Rename strlist_for_each() macros to for_each_entry() 2016-06-23 11:35:01 -03:00
builtin-record.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-report.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-sched.c perf sched map: Display only given cpus 2016-04-13 10:11:52 -03:00
builtin-script.c perf script: Add callindent option 2016-06-23 17:04:26 -03:00
builtin-stat.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-timechart.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-top.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
builtin-trace.c perf rb_resort: Rename for_each() macros to for_each_entry() 2016-06-23 11:35:07 -03:00
builtin-version.c perf tools: Move cmd_version() to builtin-version.c 2015-12-09 13:42:03 -03:00
builtin.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
command-list.txt perf tools: Do not show trace command if it's not compiled in 2016-01-08 12:46:17 -03:00
design.txt
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c perf config: Introduce new init() and exit() 2016-06-23 17:20:04 -03:00
perf.h perf tools: Ditch record_opts.callgraph_set 2016-04-18 12:26:27 -03:00