Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1417362

[RFC][PATCH v8 0/5] perf config: Reimplement perf_config() using perf_config_set__inter()

From Taeung Song <treeze.taeung@gmail.com>
Newsgroups linux.kernel
Subject [RFC][PATCH v8 0/5] perf config: Reimplement perf_config() using perf_config_set__inter()
Date 2016-06-08 14:40 +0200
Message-ID <rHKW5-7x-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hello, :)

This patchset is to reimplement perf_config() for efficient config management.

Everytime perf_config() is called, perf_config() always read config files.
(i.e. user config '~/.perfconfig' and system config '$(sysconfdir)/perfconfig')

But we need to use 'struct perf_config_set config_set' variable
that already contains all config key-value pairs
to avoid this repetitive work in perf_config().

In other words, if new perf_config() is called,
only first time 'config_set' is initialized
collecting all configs from config files and it work with perf_config_set__iter().

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

IMHO, I think this patchset is needed because not only the repetitive work
should be avoided but also in near future, it would be smooth to manage perf configs.

If you give me any feedback, I'd apprecicated it. :)

Thanks,
Taeung

v8:
- handle the error about NULL at perf_config_set__delete()
- bring declarations about config from util/config.h to util/config.h
- reimplement show_config() using perf_config_set__iter() instead of perf_config()
- rebased onto perf-core-for-mingo-20160607
- applied ([PATCH v7 1/7] 25d8f48, [PATCH v7 2/7] 8beeb00)

v7:
- fill a missing crumb that assign NULL to 'set' variable in perf_config_set__new()
  (Arnaldo)
- two patches applied ([PATCH v6 1/9] 78f71c9, [PATCH v6 3/9] 7db91f2)

v6:
- add printing error message when perf_config_set__iter() is failed
- modify commit messages for bugfix 1~3 (PATCH 1/9 ~ 3/9)
  to help reviewers easily understand why them is needed

v5:
- solve the leak when perf_config_set__init() failed (Arnaldo)
  (to clear the problem it is needed to apply the bottom bugfix 1~3 patches)
- bugfix 1) fix the problem of abnormal terminaltion at perf_parse_file() called by perf_config()
- bugfix 2) if failed at collect_config(), finally free a config set
            after it is done instead of freeing the config set in the function
- bugfix 3) handle NULL pointer exception of 'set' at collect_config()

v4:
- Keep perf_config_set__delete() as it is (Arnaldo)
- Remove perf_config_set__check() (Arnaldo)
- Keep the existing code about the config set at cmd_config() (Arnaldo)

v3:
- add freeing config set after sub-command work at run_builtin() (Namhyung)
- remove needless code about the config set at cmd_config()
- add a patch about a global variable 'config_set'

v2:
- split a patch into several patches
- reimplement show_config() using new perf_config()
- modify perf_config_set__delete using global variable 'config_set'
- reset config set when only 'config' sub-commaned work
  because of options for config file location

Taeung Song (5):
  perf config: Handle the error about NULL at perf_config_set__delete()
  perf config: Bring declarations about config from util/cache.h to
    util/config.h
  perf config: Reimplement perf_config() using perf_config_set__iter()
  perf config: Use zfree() instead of free() at
    perf_config_set__delete()
  perf config: Reimplement show_config() using perf_config_set__iter()

 tools/perf/builtin-config.c | 35 ++++++----------
 tools/perf/perf.c           |  1 +
 tools/perf/util/cache.h     | 13 +-----
 tools/perf/util/config.c    | 98 ++++++++++++++++++++++-----------------------
 tools/perf/util/config.h    | 16 +++++++-
 5 files changed, 78 insertions(+), 85 deletions(-)

-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[RFC][PATCH v8 0/5] perf config: Reimplement perf_config() using perf_config_set__inter() Taeung Song <treeze.taeung@gmail.com> - 2016-06-08 14:40 +0200
  [BUGFIX][PATCH v8 1/5] perf config: Handle the error about NULL at perf_config_set__delete() Taeung Song <treeze.taeung@gmail.com> - 2016-06-08 14:40 +0200
  [PATCH v8 2/5] perf config: Bring declarations about config from util/cache.h to util/config.h Taeung Song <treeze.taeung@gmail.com> - 2016-06-08 14:40 +0200
    Re: [PATCH v8 2/5] perf config: Bring declarations about config from  util/cache.h to util/config.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-09 15:40 +0200
      Re: [PATCH v8 2/5] perf config: Bring declarations about config from  util/cache.h to util/config.h Taeung Song <treeze.taeung@gmail.com> - 2016-06-10 08:30 +0200
        Re: [PATCH v8 2/5] perf config: Bring declarations about config from  util/cache.h to util/config.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-10 21:10 +0200
          Re: [PATCH v8 2/5] perf config: Bring declarations about config from  util/cache.h to util/config.h Taeung Song <treeze.taeung@gmail.com> - 2016-06-11 03:00 +0200
  [PATCH v8 3/5] perf config: Reimplement perf_config() using perf_config_set__iter() Taeung Song <treeze.taeung@gmail.com> - 2016-06-08 14:40 +0200
    Re: [PATCH v8 3/5] perf config: Reimplement perf_config() using  perf_config_set__iter() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-09 15:40 +0200
      Re: [PATCH v8 3/5] perf config: Reimplement perf_config() using  perf_config_set__iter() Taeung Song <treeze.taeung@gmail.com> - 2016-06-10 13:00 +0200
    Re: [PATCH v8 3/5] perf config: Reimplement perf_config() using  perf_config_set__iter() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-09 15:50 +0200
      Re: [PATCH v8 3/5] perf config: Reimplement perf_config() using  perf_config_set__iter() Taeung Song <treeze.taeung@gmail.com> - 2016-06-10 13:10 +0200
  [PATCH v8 5/5] perf config: Reimplement show_config() using perf_config_set__iter() Taeung Song <treeze.taeung@gmail.com> - 2016-06-08 14:40 +0200

csiph-web