From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932303AbcFGJ00 (ORCPT ); Tue, 7 Jun 2016 05:26:26 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33822 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606AbcFGJ0X (ORCPT ); Tue, 7 Jun 2016 05:26:23 -0400 From: Taeung Song To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Masami Hiramatsu , Taeung Song Subject: [RFC][PATCH v7 0/9] perf config: Reimplement perf_config() using perf_config_set__inter() Date: Tue, 7 Jun 2016 18:26:10 +0900 Message-Id: <1465291577-20973-1-git-send-email-treeze.taeung@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v7: - fill a missing crumb that assign NULL to 'set' variable in perf_config_set__new() (Arnaldo) 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 (7): perf config: If collect_config() is failed, finally free a config set after it is done perf config: Use new perf_config_set__init() to initialize config set perf config: Add global variable 'config_set' perf config: Use zfree() instead of free() at perf_config_set__delete() perf config: Reimplement perf_config() using perf_config_set__iter() perf config: Reset the config set at only 'config' sub-command perf config: Reimplement show_config() using perf_config() tools/perf/builtin-config.c | 41 +++++------- tools/perf/perf.c | 1 + tools/perf/util/cache.h | 1 + tools/perf/util/config.c | 147 +++++++++++++++++++++++++++++--------------- tools/perf/util/config.h | 4 +- 5 files changed, 117 insertions(+), 77 deletions(-) -- 2.5.0