Skip to contentSkip to conversation

perf config: Correctly check whether it is from system config

PATCH Superseded Taeung Song 2 participants 3 messages May 8, 2017 perf events

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/4 perf config: Correctly check whether it is from system config

Currently section's from_system_config was checked twice. So adjust it in order to correctly check not only section's but also item's from_system_config.

Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/builtin-config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-config.c +1 -1
index 0d38599..2a6ca0d 100644
@@ -56,7 +56,7 @@ static int set_config(struct perf_config_set *set, const char *file_name)
 		fprintf(fp, "[%s]\n", section->name);
 
 		perf_config_items__for_each_entry(&section->items, item) {
-			if (!use_system_config && section->from_system_config)
+			if (!use_system_config && item->from_system_config)
 				continue;
 			if (item->value)
 				fprintf(fp, "\t%s = %s\n",
Signature · 1 line
2.7.4
#1 lore raw

Em Mon, May 08, 2017 at 08:07:45PM +0900, Taeung Song escreveu:

Quoted 1 line

Currently section's from_system_config was checked twice.

you mean:

"The item->from_system_config is not being checked when iterating over
section->items, instead section->from_system_config is being checked multiple times, fix this"

?

Quoted 25 lines

So adjust it in order to correctly check not only section's but also item's from_system_config.

Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/builtin-config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-config.c +1 -1
index 0d38599..2a6ca0d 100644
@@ -56,7 +56,7 @@ static int set_config(struct perf_config_set *set, const char *file_name)
 		fprintf(fp, "[%s]\n", section->name);
 
 		perf_config_items__for_each_entry(&section->items, item) {
-			if (!use_system_config && section->from_system_config)
+			if (!use_system_config && item->from_system_config)
 				continue;
 			if (item->value)
 				fprintf(fp, "\t%s = %s\n",
Signature · 1 line
2.7.4
#2 lore raw

Hi Arnaldo,

Quoted 10 lines · Arnaldo Carvalho de Melo

Em Mon, May 08, 2017 at 08:07:45PM +0900, Taeung Song escreveu:

Quoted 1 line

Currently section's from_system_config was checked twice.

you mean:

"The item->from_system_config is not being checked when iterating over
section->items, instead section->from_system_config is being checked multiple times, fix this"

?

Yes, it is.
Change the commit message to be more proper ?

Thanks,
Taeung

Quoted 26 lines
Quoted 26 lines

So adjust it in order to correctly check not only section's but also item's from_system_config.

Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/builtin-config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-config.c +1 -2
index 0d38599..2a6ca0d 100644
@@ -56,7 +56,7 @@ static int set_config(struct perf_config_set *set, const char *file_name)
 		fprintf(fp, "[%s]\n", section->name);
 
 		perf_config_items__for_each_entry(&section->items, item) {
-			if (!use_system_config && section->from_system_config)
+			if (!use_system_config && item->from_system_config)
 				continue;
 			if (item->value)
 				fprintf(fp, "\t%s = %s\n",
--

2.7.4