aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
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/util
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/util')
-rw-r--r--tools/perf/util/evlist.c2
-rw-r--r--tools/perf/util/evsel.c2
-rw-r--r--tools/perf/util/target.h10
3 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 1201daf71719..80bef281eee0 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -609,7 +609,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
609 if (evlist->threads == NULL) 609 if (evlist->threads == NULL)
610 return -1; 610 return -1;
611 611
612 if (!perf_target__no_cpu(target)) 612 if (perf_target__has_cpu(target))
613 evlist->cpus = cpu_map__new(target->cpu_list); 613 evlist->cpus = cpu_map__new(target->cpu_list);
614 else 614 else
615 evlist->cpus = cpu_map__dummy_new(); 615 evlist->cpus = cpu_map__dummy_new();
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 21eaab240396..d7a2b4b9801d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -115,7 +115,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,
115 115
116 if (!opts->sample_id_all_missing && 116 if (!opts->sample_id_all_missing &&
117 (opts->sample_time || !opts->no_inherit || 117 (opts->sample_time || !opts->no_inherit ||
118 !perf_target__no_cpu(&opts->target))) 118 perf_target__has_cpu(&opts->target)))
119 attr->sample_type |= PERF_SAMPLE_TIME; 119 attr->sample_type |= PERF_SAMPLE_TIME;
120 120
121 if (opts->raw_samples) { 121 if (opts->raw_samples) {
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index 127cff3f8ced..c43f632955fa 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -46,19 +46,19 @@ enum perf_target_errno perf_target__parse_uid(struct perf_target *target);
46int perf_target__strerror(struct perf_target *target, int errnum, char *buf, 46int perf_target__strerror(struct perf_target *target, int errnum, char *buf,
47 size_t buflen); 47 size_t buflen);
48 48
49static inline bool perf_target__no_task(struct perf_target *target) 49static inline bool perf_target__has_task(struct perf_target *target)
50{ 50{
51 return !target->pid && !target->tid && !target->uid_str; 51 return target->tid || target->pid || target->uid_str;
52} 52}
53 53
54static inline bool perf_target__no_cpu(struct perf_target *target) 54static inline bool perf_target__has_cpu(struct perf_target *target)
55{ 55{
56 return !target->system_wide && !target->cpu_list; 56 return target->system_wide || target->cpu_list;
57} 57}
58 58
59static inline bool perf_target__none(struct perf_target *target) 59static inline bool perf_target__none(struct perf_target *target)
60{ 60{
61 return perf_target__no_task(target) && perf_target__no_cpu(target); 61 return !perf_target__has_task(target) && !perf_target__has_cpu(target);
62} 62}
63 63
64#endif /* _PERF_TARGET_H */ 64#endif /* _PERF_TARGET_H */