diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-12 14:46:16 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-12 14:51:03 -0500 |
commit | 602ad878d41ef097cc9aa2def7830d5bb27a15d8 (patch) | |
tree | 6383b40cf015a1fd74a51c4cbfadd8756cde8dee /tools/perf/util | |
parent | 48095b721ca54ffa70427185c00473530f4aef06 (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')
-rw-r--r-- | tools/perf/util/evlist.c | 12 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 5 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 9 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 3 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 6 | ||||
-rw-r--r-- | tools/perf/util/machine.h | 4 | ||||
-rw-r--r-- | tools/perf/util/target.c | 54 | ||||
-rw-r--r-- | tools/perf/util/target.h | 44 | ||||
-rw-r--r-- | tools/perf/util/top.c | 2 |
9 files changed, 65 insertions, 74 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index cb19044601bb..dc6fa3fbb180 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -811,8 +811,7 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, | |||
811 | return perf_evlist__mmap_per_cpu(evlist, prot, mask); | 811 | return perf_evlist__mmap_per_cpu(evlist, prot, mask); |
812 | } | 812 | } |
813 | 813 | ||
814 | int perf_evlist__create_maps(struct perf_evlist *evlist, | 814 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) |
815 | struct perf_target *target) | ||
816 | { | 815 | { |
817 | evlist->threads = thread_map__new_str(target->pid, target->tid, | 816 | evlist->threads = thread_map__new_str(target->pid, target->tid, |
818 | target->uid); | 817 | target->uid); |
@@ -820,9 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, | |||
820 | if (evlist->threads == NULL) | 819 | if (evlist->threads == NULL) |
821 | return -1; | 820 | return -1; |
822 | 821 | ||
823 | if (perf_target__has_task(target)) | 822 | if (target__has_task(target)) |
824 | evlist->cpus = cpu_map__dummy_new(); | 823 | evlist->cpus = cpu_map__dummy_new(); |
825 | else if (!perf_target__has_cpu(target) && !target->uses_mmap) | 824 | else if (!target__has_cpu(target) && !target->uses_mmap) |
826 | evlist->cpus = cpu_map__dummy_new(); | 825 | evlist->cpus = cpu_map__dummy_new(); |
827 | else | 826 | else |
828 | evlist->cpus = cpu_map__new(target->cpu_list); | 827 | evlist->cpus = cpu_map__new(target->cpu_list); |
@@ -1031,8 +1030,7 @@ out_err: | |||
1031 | return err; | 1030 | return err; |
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | int perf_evlist__prepare_workload(struct perf_evlist *evlist, | 1033 | int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *target, |
1035 | struct perf_target *target, | ||
1036 | const char *argv[], bool pipe_output, | 1034 | const char *argv[], bool pipe_output, |
1037 | bool want_signal) | 1035 | bool want_signal) |
1038 | { | 1036 | { |
@@ -1084,7 +1082,7 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, | |||
1084 | exit(-1); | 1082 | exit(-1); |
1085 | } | 1083 | } |
1086 | 1084 | ||
1087 | if (perf_target__none(target)) | 1085 | if (target__none(target)) |
1088 | evlist->threads->map[0] = evlist->workload.pid; | 1086 | evlist->threads->map[0] = evlist->workload.pid; |
1089 | 1087 | ||
1090 | close(child_ready_pipe[1]); | 1088 | close(child_ready_pipe[1]); |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index ecaa582f40e2..649d6ea98a84 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -102,7 +102,7 @@ void perf_evlist__config(struct perf_evlist *evlist, | |||
102 | int perf_record_opts__config(struct perf_record_opts *opts); | 102 | int perf_record_opts__config(struct perf_record_opts *opts); |
103 | 103 | ||
104 | int perf_evlist__prepare_workload(struct perf_evlist *evlist, | 104 | int perf_evlist__prepare_workload(struct perf_evlist *evlist, |
105 | struct perf_target *target, | 105 | struct target *target, |
106 | const char *argv[], bool pipe_output, | 106 | const char *argv[], bool pipe_output, |
107 | bool want_signal); | 107 | bool want_signal); |
108 | int perf_evlist__start_workload(struct perf_evlist *evlist); | 108 | int perf_evlist__start_workload(struct perf_evlist *evlist); |
@@ -134,8 +134,7 @@ static inline void perf_evlist__set_maps(struct perf_evlist *evlist, | |||
134 | evlist->threads = threads; | 134 | evlist->threads = threads; |
135 | } | 135 | } |
136 | 136 | ||
137 | int perf_evlist__create_maps(struct perf_evlist *evlist, | 137 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); |
138 | struct perf_target *target); | ||
139 | void perf_evlist__delete_maps(struct perf_evlist *evlist); | 138 | void perf_evlist__delete_maps(struct perf_evlist *evlist); |
140 | int perf_evlist__apply_filters(struct perf_evlist *evlist); | 139 | int perf_evlist__apply_filters(struct perf_evlist *evlist); |
141 | 140 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f95653a639a6..18f7c188ff63 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
645 | } | 645 | } |
646 | } | 646 | } |
647 | 647 | ||
648 | if (perf_target__has_cpu(&opts->target)) | 648 | if (target__has_cpu(&opts->target)) |
649 | perf_evsel__set_sample_bit(evsel, CPU); | 649 | perf_evsel__set_sample_bit(evsel, CPU); |
650 | 650 | ||
651 | if (opts->period) | 651 | if (opts->period) |
@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
653 | 653 | ||
654 | if (!perf_missing_features.sample_id_all && | 654 | if (!perf_missing_features.sample_id_all && |
655 | (opts->sample_time || !opts->no_inherit || | 655 | (opts->sample_time || !opts->no_inherit || |
656 | perf_target__has_cpu(&opts->target))) | 656 | target__has_cpu(&opts->target))) |
657 | perf_evsel__set_sample_bit(evsel, TIME); | 657 | perf_evsel__set_sample_bit(evsel, TIME); |
658 | 658 | ||
659 | if (opts->raw_samples) { | 659 | if (opts->raw_samples) { |
@@ -696,7 +696,7 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
696 | * Setting enable_on_exec for independent events and | 696 | * Setting enable_on_exec for independent events and |
697 | * group leaders for traced executed by perf. | 697 | * group leaders for traced executed by perf. |
698 | */ | 698 | */ |
699 | if (perf_target__none(&opts->target) && perf_evsel__is_group_leader(evsel)) | 699 | if (target__none(&opts->target) && perf_evsel__is_group_leader(evsel)) |
700 | attr->enable_on_exec = 1; | 700 | attr->enable_on_exec = 1; |
701 | } | 701 | } |
702 | 702 | ||
@@ -2006,8 +2006,7 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int err, | |||
2006 | return false; | 2006 | return false; |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | int perf_evsel__open_strerror(struct perf_evsel *evsel, | 2009 | int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, |
2010 | struct perf_target *target, | ||
2011 | int err, char *msg, size_t size) | 2010 | int err, char *msg, size_t size) |
2012 | { | 2011 | { |
2013 | switch (err) { | 2012 | switch (err) { |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 0178233abd64..f5029653dcd7 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -318,8 +318,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel, | |||
318 | 318 | ||
319 | bool perf_evsel__fallback(struct perf_evsel *evsel, int err, | 319 | bool perf_evsel__fallback(struct perf_evsel *evsel, int err, |
320 | char *msg, size_t msgsize); | 320 | char *msg, size_t msgsize); |
321 | int perf_evsel__open_strerror(struct perf_evsel *evsel, | 321 | int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, |
322 | struct perf_target *target, | ||
323 | int err, char *msg, size_t size); | 322 | int err, char *msg, size_t size); |
324 | 323 | ||
325 | static inline int perf_evsel__group_idx(struct perf_evsel *evsel) | 324 | static inline int perf_evsel__group_idx(struct perf_evsel *evsel) |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 680700b6d779..0393912d8033 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1396,12 +1396,12 @@ int machine__for_each_thread(struct machine *machine, | |||
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 1398 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
1399 | struct perf_target *target, struct thread_map *threads, | 1399 | struct target *target, struct thread_map *threads, |
1400 | perf_event__handler_t process, bool data_mmap) | 1400 | perf_event__handler_t process, bool data_mmap) |
1401 | { | 1401 | { |
1402 | if (perf_target__has_task(target)) | 1402 | if (target__has_task(target)) |
1403 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); | 1403 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); |
1404 | else if (perf_target__has_cpu(target)) | 1404 | else if (target__has_cpu(target)) |
1405 | return perf_event__synthesize_threads(tool, process, machine, data_mmap); | 1405 | return perf_event__synthesize_threads(tool, process, machine, data_mmap); |
1406 | /* command specified */ | 1406 | /* command specified */ |
1407 | return 0; | 1407 | return 0; |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index fedd1dfaf715..477133015440 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -180,10 +180,10 @@ int machine__for_each_thread(struct machine *machine, | |||
180 | void *priv); | 180 | void *priv); |
181 | 181 | ||
182 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 182 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
183 | struct perf_target *target, struct thread_map *threads, | 183 | struct target *target, struct thread_map *threads, |
184 | perf_event__handler_t process, bool data_mmap); | 184 | perf_event__handler_t process, bool data_mmap); |
185 | static inline | 185 | static inline |
186 | int machine__synthesize_threads(struct machine *machine, struct perf_target *target, | 186 | int machine__synthesize_threads(struct machine *machine, struct target *target, |
187 | struct thread_map *threads, bool data_mmap) | 187 | struct thread_map *threads, bool data_mmap) |
188 | { | 188 | { |
189 | return __machine__synthesize_threads(machine, NULL, target, threads, | 189 | return __machine__synthesize_threads(machine, NULL, target, threads, |
diff --git a/tools/perf/util/target.c b/tools/perf/util/target.c index 065528b7563e..3c778a07b7cc 100644 --- a/tools/perf/util/target.c +++ b/tools/perf/util/target.c | |||
@@ -13,9 +13,9 @@ | |||
13 | #include <string.h> | 13 | #include <string.h> |
14 | 14 | ||
15 | 15 | ||
16 | enum perf_target_errno perf_target__validate(struct perf_target *target) | 16 | enum target_errno target__validate(struct target *target) |
17 | { | 17 | { |
18 | enum perf_target_errno ret = PERF_ERRNO_TARGET__SUCCESS; | 18 | enum target_errno ret = TARGET_ERRNO__SUCCESS; |
19 | 19 | ||
20 | if (target->pid) | 20 | if (target->pid) |
21 | target->tid = target->pid; | 21 | target->tid = target->pid; |
@@ -23,42 +23,42 @@ enum perf_target_errno perf_target__validate(struct perf_target *target) | |||
23 | /* CPU and PID are mutually exclusive */ | 23 | /* CPU and PID are mutually exclusive */ |
24 | if (target->tid && target->cpu_list) { | 24 | if (target->tid && target->cpu_list) { |
25 | target->cpu_list = NULL; | 25 | target->cpu_list = NULL; |
26 | if (ret == PERF_ERRNO_TARGET__SUCCESS) | 26 | if (ret == TARGET_ERRNO__SUCCESS) |
27 | ret = PERF_ERRNO_TARGET__PID_OVERRIDE_CPU; | 27 | ret = TARGET_ERRNO__PID_OVERRIDE_CPU; |
28 | } | 28 | } |
29 | 29 | ||
30 | /* UID and PID are mutually exclusive */ | 30 | /* UID and PID are mutually exclusive */ |
31 | if (target->tid && target->uid_str) { | 31 | if (target->tid && target->uid_str) { |
32 | target->uid_str = NULL; | 32 | target->uid_str = NULL; |
33 | if (ret == PERF_ERRNO_TARGET__SUCCESS) | 33 | if (ret == TARGET_ERRNO__SUCCESS) |
34 | ret = PERF_ERRNO_TARGET__PID_OVERRIDE_UID; | 34 | ret = TARGET_ERRNO__PID_OVERRIDE_UID; |
35 | } | 35 | } |
36 | 36 | ||
37 | /* UID and CPU are mutually exclusive */ | 37 | /* UID and CPU are mutually exclusive */ |
38 | if (target->uid_str && target->cpu_list) { | 38 | if (target->uid_str && target->cpu_list) { |
39 | target->cpu_list = NULL; | 39 | target->cpu_list = NULL; |
40 | if (ret == PERF_ERRNO_TARGET__SUCCESS) | 40 | if (ret == TARGET_ERRNO__SUCCESS) |
41 | ret = PERF_ERRNO_TARGET__UID_OVERRIDE_CPU; | 41 | ret = TARGET_ERRNO__UID_OVERRIDE_CPU; |
42 | } | 42 | } |
43 | 43 | ||
44 | /* PID and SYSTEM are mutually exclusive */ | 44 | /* PID and SYSTEM are mutually exclusive */ |
45 | if (target->tid && target->system_wide) { | 45 | if (target->tid && target->system_wide) { |
46 | target->system_wide = false; | 46 | target->system_wide = false; |
47 | if (ret == PERF_ERRNO_TARGET__SUCCESS) | 47 | if (ret == TARGET_ERRNO__SUCCESS) |
48 | ret = PERF_ERRNO_TARGET__PID_OVERRIDE_SYSTEM; | 48 | ret = TARGET_ERRNO__PID_OVERRIDE_SYSTEM; |
49 | } | 49 | } |
50 | 50 | ||
51 | /* UID and SYSTEM are mutually exclusive */ | 51 | /* UID and SYSTEM are mutually exclusive */ |
52 | if (target->uid_str && target->system_wide) { | 52 | if (target->uid_str && target->system_wide) { |
53 | target->system_wide = false; | 53 | target->system_wide = false; |
54 | if (ret == PERF_ERRNO_TARGET__SUCCESS) | 54 | if (ret == TARGET_ERRNO__SUCCESS) |
55 | ret = PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM; | 55 | ret = TARGET_ERRNO__UID_OVERRIDE_SYSTEM; |
56 | } | 56 | } |
57 | 57 | ||
58 | return ret; | 58 | return ret; |
59 | } | 59 | } |
60 | 60 | ||
61 | enum perf_target_errno perf_target__parse_uid(struct perf_target *target) | 61 | enum target_errno target__parse_uid(struct target *target) |
62 | { | 62 | { |
63 | struct passwd pwd, *result; | 63 | struct passwd pwd, *result; |
64 | char buf[1024]; | 64 | char buf[1024]; |
@@ -66,7 +66,7 @@ enum perf_target_errno perf_target__parse_uid(struct perf_target *target) | |||
66 | 66 | ||
67 | target->uid = UINT_MAX; | 67 | target->uid = UINT_MAX; |
68 | if (str == NULL) | 68 | if (str == NULL) |
69 | return PERF_ERRNO_TARGET__SUCCESS; | 69 | return TARGET_ERRNO__SUCCESS; |
70 | 70 | ||
71 | /* Try user name first */ | 71 | /* Try user name first */ |
72 | getpwnam_r(str, &pwd, buf, sizeof(buf), &result); | 72 | getpwnam_r(str, &pwd, buf, sizeof(buf), &result); |
@@ -79,22 +79,22 @@ enum perf_target_errno perf_target__parse_uid(struct perf_target *target) | |||
79 | int uid = strtol(str, &endptr, 10); | 79 | int uid = strtol(str, &endptr, 10); |
80 | 80 | ||
81 | if (*endptr != '\0') | 81 | if (*endptr != '\0') |
82 | return PERF_ERRNO_TARGET__INVALID_UID; | 82 | return TARGET_ERRNO__INVALID_UID; |
83 | 83 | ||
84 | getpwuid_r(uid, &pwd, buf, sizeof(buf), &result); | 84 | getpwuid_r(uid, &pwd, buf, sizeof(buf), &result); |
85 | 85 | ||
86 | if (result == NULL) | 86 | if (result == NULL) |
87 | return PERF_ERRNO_TARGET__USER_NOT_FOUND; | 87 | return TARGET_ERRNO__USER_NOT_FOUND; |
88 | } | 88 | } |
89 | 89 | ||
90 | target->uid = result->pw_uid; | 90 | target->uid = result->pw_uid; |
91 | return PERF_ERRNO_TARGET__SUCCESS; | 91 | return TARGET_ERRNO__SUCCESS; |
92 | } | 92 | } |
93 | 93 | ||
94 | /* | 94 | /* |
95 | * This must have a same ordering as the enum perf_target_errno. | 95 | * This must have a same ordering as the enum target_errno. |
96 | */ | 96 | */ |
97 | static const char *perf_target__error_str[] = { | 97 | static const char *target__error_str[] = { |
98 | "PID/TID switch overriding CPU", | 98 | "PID/TID switch overriding CPU", |
99 | "PID/TID switch overriding UID", | 99 | "PID/TID switch overriding UID", |
100 | "UID switch overriding CPU", | 100 | "UID switch overriding CPU", |
@@ -104,7 +104,7 @@ static const char *perf_target__error_str[] = { | |||
104 | "Problems obtaining information for user %s", | 104 | "Problems obtaining information for user %s", |
105 | }; | 105 | }; |
106 | 106 | ||
107 | int perf_target__strerror(struct perf_target *target, int errnum, | 107 | int target__strerror(struct target *target, int errnum, |
108 | char *buf, size_t buflen) | 108 | char *buf, size_t buflen) |
109 | { | 109 | { |
110 | int idx; | 110 | int idx; |
@@ -124,21 +124,19 @@ int perf_target__strerror(struct perf_target *target, int errnum, | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (errnum < __PERF_ERRNO_TARGET__START || | 127 | if (errnum < __TARGET_ERRNO__START || errnum >= __TARGET_ERRNO__END) |
128 | errnum >= __PERF_ERRNO_TARGET__END) | ||
129 | return -1; | 128 | return -1; |
130 | 129 | ||
131 | idx = errnum - __PERF_ERRNO_TARGET__START; | 130 | idx = errnum - __TARGET_ERRNO__START; |
132 | msg = perf_target__error_str[idx]; | 131 | msg = target__error_str[idx]; |
133 | 132 | ||
134 | switch (errnum) { | 133 | switch (errnum) { |
135 | case PERF_ERRNO_TARGET__PID_OVERRIDE_CPU | 134 | case TARGET_ERRNO__PID_OVERRIDE_CPU ... TARGET_ERRNO__UID_OVERRIDE_SYSTEM: |
136 | ... PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM: | ||
137 | snprintf(buf, buflen, "%s", msg); | 135 | snprintf(buf, buflen, "%s", msg); |
138 | break; | 136 | break; |
139 | 137 | ||
140 | case PERF_ERRNO_TARGET__INVALID_UID: | 138 | case TARGET_ERRNO__INVALID_UID: |
141 | case PERF_ERRNO_TARGET__USER_NOT_FOUND: | 139 | case TARGET_ERRNO__USER_NOT_FOUND: |
142 | snprintf(buf, buflen, msg, target->uid_str); | 140 | snprintf(buf, buflen, msg, target->uid_str); |
143 | break; | 141 | break; |
144 | 142 | ||
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 | ||
7 | struct perf_target { | 7 | struct 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 | ||
17 | enum perf_target_errno { | 17 | enum 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 | ||
44 | enum perf_target_errno perf_target__validate(struct perf_target *target); | 43 | enum target_errno target__validate(struct target *target); |
45 | enum perf_target_errno perf_target__parse_uid(struct perf_target *target); | 44 | enum target_errno target__parse_uid(struct target *target); |
46 | 45 | ||
47 | int perf_target__strerror(struct perf_target *target, int errnum, char *buf, | 46 | int target__strerror(struct target *target, int errnum, char *buf, size_t buflen); |
48 | size_t buflen); | ||
49 | 47 | ||
50 | static inline bool perf_target__has_task(struct perf_target *target) | 48 | static 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 | ||
55 | static inline bool perf_target__has_cpu(struct perf_target *target) | 53 | static 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 | ||
60 | static inline bool perf_target__none(struct perf_target *target) | 58 | static 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 */ |
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index f857b51b6bde..ce793c7dd23c 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c | |||
@@ -27,7 +27,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size) | |||
27 | float ksamples_per_sec; | 27 | float ksamples_per_sec; |
28 | float esamples_percent; | 28 | float esamples_percent; |
29 | struct perf_record_opts *opts = &top->record_opts; | 29 | struct perf_record_opts *opts = &top->record_opts; |
30 | struct perf_target *target = &opts->target; | 30 | struct target *target = &opts->target; |
31 | size_t ret = 0; | 31 | size_t ret = 0; |
32 | 32 | ||
33 | if (top->samples) { | 33 | if (top->samples) { |