aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/target.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-11-12 14:46:16 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-12 14:51:03 -0500
commit602ad878d41ef097cc9aa2def7830d5bb27a15d8 (patch)
tree6383b40cf015a1fd74a51c4cbfadd8756cde8dee /tools/perf/util/target.h
parent48095b721ca54ffa70427185c00473530f4aef06 (diff)
perf target: Shorten perf_target__ to target__
Getting unwieldly long, for this app domain should be descriptive enough and the use of __ to separate the class from the method names should help with avoiding clashes with other code bases. Reported-by: David Ahern <dsahern@gmail.com> Suggested-by: Ingo Molnar <mingo@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20131112113427.GA4053@ghostprotocols.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/target.h')
-rw-r--r--tools/perf/util/target.h44
1 files changed, 21 insertions, 23 deletions
diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
index a4be8575fda5..89bab7129de4 100644
--- a/tools/perf/util/target.h
+++ b/tools/perf/util/target.h
@@ -4,7 +4,7 @@
4#include <stdbool.h> 4#include <stdbool.h>
5#include <sys/types.h> 5#include <sys/types.h>
6 6
7struct perf_target { 7struct target {
8 const char *pid; 8 const char *pid;
9 const char *tid; 9 const char *tid;
10 const char *cpu_list; 10 const char *cpu_list;
@@ -14,8 +14,8 @@ struct perf_target {
14 bool uses_mmap; 14 bool uses_mmap;
15}; 15};
16 16
17enum perf_target_errno { 17enum target_errno {
18 PERF_ERRNO_TARGET__SUCCESS = 0, 18 TARGET_ERRNO__SUCCESS = 0,
19 19
20 /* 20 /*
21 * Choose an arbitrary negative big number not to clash with standard 21 * Choose an arbitrary negative big number not to clash with standard
@@ -24,42 +24,40 @@ enum perf_target_errno {
24 * 24 *
25 * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html 25 * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
26 */ 26 */
27 __PERF_ERRNO_TARGET__START = -10000, 27 __TARGET_ERRNO__START = -10000,
28 28
29 /* for target__validate() */
30 TARGET_ERRNO__PID_OVERRIDE_CPU = __TARGET_ERRNO__START,
31 TARGET_ERRNO__PID_OVERRIDE_UID,
32 TARGET_ERRNO__UID_OVERRIDE_CPU,
33 TARGET_ERRNO__PID_OVERRIDE_SYSTEM,
34 TARGET_ERRNO__UID_OVERRIDE_SYSTEM,
29 35
30 /* for perf_target__validate() */ 36 /* for target__parse_uid() */
31 PERF_ERRNO_TARGET__PID_OVERRIDE_CPU = __PERF_ERRNO_TARGET__START, 37 TARGET_ERRNO__INVALID_UID,
32 PERF_ERRNO_TARGET__PID_OVERRIDE_UID, 38 TARGET_ERRNO__USER_NOT_FOUND,
33 PERF_ERRNO_TARGET__UID_OVERRIDE_CPU,
34 PERF_ERRNO_TARGET__PID_OVERRIDE_SYSTEM,
35 PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM,
36 39
37 /* for perf_target__parse_uid() */ 40 __TARGET_ERRNO__END,
38 PERF_ERRNO_TARGET__INVALID_UID,
39 PERF_ERRNO_TARGET__USER_NOT_FOUND,
40
41 __PERF_ERRNO_TARGET__END,
42}; 41};
43 42
44enum perf_target_errno perf_target__validate(struct perf_target *target); 43enum target_errno target__validate(struct target *target);
45enum perf_target_errno perf_target__parse_uid(struct perf_target *target); 44enum target_errno target__parse_uid(struct target *target);
46 45
47int perf_target__strerror(struct perf_target *target, int errnum, char *buf, 46int target__strerror(struct target *target, int errnum, char *buf, size_t buflen);
48 size_t buflen);
49 47
50static inline bool perf_target__has_task(struct perf_target *target) 48static inline bool target__has_task(struct target *target)
51{ 49{
52 return target->tid || target->pid || target->uid_str; 50 return target->tid || target->pid || target->uid_str;
53} 51}
54 52
55static inline bool perf_target__has_cpu(struct perf_target *target) 53static inline bool target__has_cpu(struct target *target)
56{ 54{
57 return target->system_wide || target->cpu_list; 55 return target->system_wide || target->cpu_list;
58} 56}
59 57
60static inline bool perf_target__none(struct perf_target *target) 58static inline bool target__none(struct target *target)
61{ 59{
62 return !perf_target__has_task(target) && !perf_target__has_cpu(target); 60 return !target__has_task(target) && !target__has_cpu(target);
63} 61}
64 62
65#endif /* _PERF_TARGET_H */ 63#endif /* _PERF_TARGET_H */