summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-config.c
diff options
context:
space:
mode:
authorTaeung Song <treeze.taeung@gmail.com>2016-11-04 07:44:22 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-14 17:10:37 +0100
commit08d090cfed8cc2ce5821ddb2b91118979e511019 (patch)
treeac306e1da6b4012b0040626cd2bb83dde6938b2d /tools/perf/builtin-config.c
parentperf config: Add support setting variables in a config file (diff)
downloadlinux-08d090cfed8cc2ce5821ddb2b91118979e511019.tar.xz
linux-08d090cfed8cc2ce5821ddb2b91118979e511019.zip
perf config: Mark where are config items from (user or system)
To write config items to a particular config file, we should know where is each config section and item from. Current setting functionality of perf-config use autogenerating way by overwriting collected config items to a config file. For example, when collecting config items from user and system config files (i.e. ~/.perfconfig and $(sysconf)/perfconfig), perf_config_set can contain both user and system config items. So we should know where each value is from to avoid merging user and system config items on user config file. Signed-off-by: Taeung Song <treeze.taeung@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Nambong Ha <over3025@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Cc: Wookje Kwon <aweee0@gmail.com> Link: http://lkml.kernel.org/r/1478241862-31230-7-git-send-email-treeze.taeung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-config.c')
-rw-r--r--tools/perf/builtin-config.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 7c861b54f3a6..8c0d93b7c2f0 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -48,14 +48,18 @@ static int set_config(struct perf_config_set *set, const char *file_name,
if (!fp)
return -1;
- perf_config_set__collect(set, var, value);
+ perf_config_set__collect(set, file_name, var, value);
fprintf(fp, "%s\n", first_line);
/* overwrite configvariables */
perf_config_items__for_each_entry(&set->sections, section) {
+ if (!use_system_config && section->from_system_config)
+ continue;
fprintf(fp, "[%s]\n", section->name);
perf_config_items__for_each_entry(&section->items, item) {
+ if (!use_system_config && section->from_system_config)
+ continue;
if (item->value)
fprintf(fp, "\t%s = %s\n",
item->name, item->value);