aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-05-16 05:45:47 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-16 11:09:34 -0400
commitaa22dd4990e38700b1855555aa0def5215859abb (patch)
treeb49e4b99db265a0dc7bd38d5605396889985e395 /tools/perf/builtin-stat.c
parent978da300c7a65494692b329a6a4cbf364afc37c5 (diff)
perf target: Rename functions to avoid double negation
Rename perf_target__no_{cpu,task} to perf_target__has_{cpu,task} because it's more intuitive and easy to parse (for human beings) when used with negation. The names are came out from David Ahern. It is intended to be a mechanical substitution without any functional change. The perf_target__none remains unchanged since I couldn't find a right name and it is hardly used with negation. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Suggested-by: David Ahern <dsahern@gmail.com> Suggested-by: Ingo Molnar <mingo@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1337161549-9870-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index d0605689bad9..0f4b51ae4be7 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -292,10 +292,10 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
292 292
293 attr->inherit = !no_inherit; 293 attr->inherit = !no_inherit;
294 294
295 if (!perf_target__no_cpu(&target)) 295 if (perf_target__has_cpu(&target))
296 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, 296 return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
297 group, group_fd); 297 group, group_fd);
298 if (perf_target__no_task(&target) && (!group || evsel == first)) { 298 if (!perf_target__has_task(&target) && (!group || evsel == first)) {
299 attr->disabled = 1; 299 attr->disabled = 1;
300 attr->enable_on_exec = 1; 300 attr->enable_on_exec = 1;
301 } 301 }
@@ -972,7 +972,7 @@ static void print_stat(int argc, const char **argv)
972 if (!csv_output) { 972 if (!csv_output) {
973 fprintf(output, "\n"); 973 fprintf(output, "\n");
974 fprintf(output, " Performance counter stats for "); 974 fprintf(output, " Performance counter stats for ");
975 if (perf_target__no_task(&target)) { 975 if (!perf_target__has_task(&target)) {
976 fprintf(output, "\'%s", argv[0]); 976 fprintf(output, "\'%s", argv[0]);
977 for (i = 1; i < argc; i++) 977 for (i = 1; i < argc; i++)
978 fprintf(output, " %s", argv[i]); 978 fprintf(output, " %s", argv[i]);
@@ -1194,13 +1194,13 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1194 } else if (big_num_opt == 0) /* User passed --no-big-num */ 1194 } else if (big_num_opt == 0) /* User passed --no-big-num */
1195 big_num = false; 1195 big_num = false;
1196 1196
1197 if (!argc && perf_target__no_task(&target)) 1197 if (!argc && !perf_target__has_task(&target))
1198 usage_with_options(stat_usage, options); 1198 usage_with_options(stat_usage, options);
1199 if (run_count <= 0) 1199 if (run_count <= 0)
1200 usage_with_options(stat_usage, options); 1200 usage_with_options(stat_usage, options);
1201 1201
1202 /* no_aggr, cgroup are for system-wide only */ 1202 /* no_aggr, cgroup are for system-wide only */
1203 if ((no_aggr || nr_cgroups) && perf_target__no_cpu(&target)) { 1203 if ((no_aggr || nr_cgroups) && !perf_target__has_cpu(&target)) {
1204 fprintf(stderr, "both cgroup and no-aggregation " 1204 fprintf(stderr, "both cgroup and no-aggregation "
1205 "modes only available in system-wide mode\n"); 1205 "modes only available in system-wide mode\n");
1206 1206
@@ -1213,9 +1213,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1213 perf_target__validate(&target); 1213 perf_target__validate(&target);
1214 1214
1215 if (perf_evlist__create_maps(evsel_list, &target) < 0) { 1215 if (perf_evlist__create_maps(evsel_list, &target) < 0) {
1216 if (!perf_target__no_task(&target)) 1216 if (perf_target__has_task(&target))
1217 pr_err("Problems finding threads of monitor\n"); 1217 pr_err("Problems finding threads of monitor\n");
1218 if (!perf_target__no_cpu(&target)) 1218 if (perf_target__has_cpu(&target))
1219 perror("failed to parse CPUs map"); 1219 perror("failed to parse CPUs map");
1220 1220
1221 usage_with_options(stat_usage, options); 1221 usage_with_options(stat_usage, options);