diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-29 11:01:45 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-29 13:25:37 -0500 |
commit | 8115d60c323dd9931b95221c0a392aeddc1d6ef3 (patch) | |
tree | 13e75d71c5163c78efc9d8ab33988cc6c7be74a1 /tools/perf/util/header.c | |
parent | 8d50e5b4171a69cf48ca94a1e7c14033d0b4771d (diff) |
perf tools: Kill event_t typedef, use 'union perf_event' instead
And move the event_t methods to the perf_event__ too.
No code changes, just namespace consistency.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index f0138d472339..c0de5ec44145 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1000,11 +1000,11 @@ perf_header__find_attr(u64 id, struct perf_header *header) | |||
1000 | return NULL; | 1000 | return NULL; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | int event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, | 1003 | int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, |
1004 | event__handler_t process, | 1004 | perf_event__handler_t process, |
1005 | struct perf_session *session) | 1005 | struct perf_session *session) |
1006 | { | 1006 | { |
1007 | event_t *ev; | 1007 | union perf_event *ev; |
1008 | size_t size; | 1008 | size_t size; |
1009 | int err; | 1009 | int err; |
1010 | 1010 | ||
@@ -1031,8 +1031,9 @@ int event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, | |||
1031 | return err; | 1031 | return err; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | int event__synthesize_attrs(struct perf_header *self, event__handler_t process, | 1034 | int perf_event__synthesize_attrs(struct perf_header *self, |
1035 | struct perf_session *session) | 1035 | perf_event__handler_t process, |
1036 | struct perf_session *session) | ||
1036 | { | 1037 | { |
1037 | struct perf_header_attr *attr; | 1038 | struct perf_header_attr *attr; |
1038 | int i, err = 0; | 1039 | int i, err = 0; |
@@ -1040,8 +1041,8 @@ int event__synthesize_attrs(struct perf_header *self, event__handler_t process, | |||
1040 | for (i = 0; i < self->attrs; i++) { | 1041 | for (i = 0; i < self->attrs; i++) { |
1041 | attr = self->attr[i]; | 1042 | attr = self->attr[i]; |
1042 | 1043 | ||
1043 | err = event__synthesize_attr(&attr->attr, attr->ids, attr->id, | 1044 | err = perf_event__synthesize_attr(&attr->attr, attr->ids, |
1044 | process, session); | 1045 | attr->id, process, session); |
1045 | if (err) { | 1046 | if (err) { |
1046 | pr_debug("failed to create perf header attribute\n"); | 1047 | pr_debug("failed to create perf header attribute\n"); |
1047 | return err; | 1048 | return err; |
@@ -1051,21 +1052,22 @@ int event__synthesize_attrs(struct perf_header *self, event__handler_t process, | |||
1051 | return err; | 1052 | return err; |
1052 | } | 1053 | } |
1053 | 1054 | ||
1054 | int event__process_attr(event_t *self, struct perf_session *session) | 1055 | int perf_event__process_attr(union perf_event *event, |
1056 | struct perf_session *session) | ||
1055 | { | 1057 | { |
1056 | struct perf_header_attr *attr; | 1058 | struct perf_header_attr *attr; |
1057 | unsigned int i, ids, n_ids; | 1059 | unsigned int i, ids, n_ids; |
1058 | 1060 | ||
1059 | attr = perf_header_attr__new(&self->attr.attr); | 1061 | attr = perf_header_attr__new(&event->attr.attr); |
1060 | if (attr == NULL) | 1062 | if (attr == NULL) |
1061 | return -ENOMEM; | 1063 | return -ENOMEM; |
1062 | 1064 | ||
1063 | ids = self->header.size; | 1065 | ids = event->header.size; |
1064 | ids -= (void *)&self->attr.id - (void *)self; | 1066 | ids -= (void *)&event->attr.id - (void *)event; |
1065 | n_ids = ids / sizeof(u64); | 1067 | n_ids = ids / sizeof(u64); |
1066 | 1068 | ||
1067 | for (i = 0; i < n_ids; i++) { | 1069 | for (i = 0; i < n_ids; i++) { |
1068 | if (perf_header_attr__add_id(attr, self->attr.id[i]) < 0) { | 1070 | if (perf_header_attr__add_id(attr, event->attr.id[i]) < 0) { |
1069 | perf_header_attr__delete(attr); | 1071 | perf_header_attr__delete(attr); |
1070 | return -ENOMEM; | 1072 | return -ENOMEM; |
1071 | } | 1073 | } |
@@ -1081,11 +1083,11 @@ int event__process_attr(event_t *self, struct perf_session *session) | |||
1081 | return 0; | 1083 | return 0; |
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | int event__synthesize_event_type(u64 event_id, char *name, | 1086 | int perf_event__synthesize_event_type(u64 event_id, char *name, |
1085 | event__handler_t process, | 1087 | perf_event__handler_t process, |
1086 | struct perf_session *session) | 1088 | struct perf_session *session) |
1087 | { | 1089 | { |
1088 | event_t ev; | 1090 | union perf_event ev; |
1089 | size_t size = 0; | 1091 | size_t size = 0; |
1090 | int err = 0; | 1092 | int err = 0; |
1091 | 1093 | ||
@@ -1106,8 +1108,8 @@ int event__synthesize_event_type(u64 event_id, char *name, | |||
1106 | return err; | 1108 | return err; |
1107 | } | 1109 | } |
1108 | 1110 | ||
1109 | int event__synthesize_event_types(event__handler_t process, | 1111 | int perf_event__synthesize_event_types(perf_event__handler_t process, |
1110 | struct perf_session *session) | 1112 | struct perf_session *session) |
1111 | { | 1113 | { |
1112 | struct perf_trace_event_type *type; | 1114 | struct perf_trace_event_type *type; |
1113 | int i, err = 0; | 1115 | int i, err = 0; |
@@ -1115,8 +1117,9 @@ int event__synthesize_event_types(event__handler_t process, | |||
1115 | for (i = 0; i < event_count; i++) { | 1117 | for (i = 0; i < event_count; i++) { |
1116 | type = &events[i]; | 1118 | type = &events[i]; |
1117 | 1119 | ||
1118 | err = event__synthesize_event_type(type->event_id, type->name, | 1120 | err = perf_event__synthesize_event_type(type->event_id, |
1119 | process, session); | 1121 | type->name, process, |
1122 | session); | ||
1120 | if (err) { | 1123 | if (err) { |
1121 | pr_debug("failed to create perf header event type\n"); | 1124 | pr_debug("failed to create perf header event type\n"); |
1122 | return err; | 1125 | return err; |
@@ -1126,21 +1129,21 @@ int event__synthesize_event_types(event__handler_t process, | |||
1126 | return err; | 1129 | return err; |
1127 | } | 1130 | } |
1128 | 1131 | ||
1129 | int event__process_event_type(event_t *self, | 1132 | int perf_event__process_event_type(union perf_event *event, |
1130 | struct perf_session *session __unused) | 1133 | struct perf_session *session __unused) |
1131 | { | 1134 | { |
1132 | if (perf_header__push_event(self->event_type.event_type.event_id, | 1135 | if (perf_header__push_event(event->event_type.event_type.event_id, |
1133 | self->event_type.event_type.name) < 0) | 1136 | event->event_type.event_type.name) < 0) |
1134 | return -ENOMEM; | 1137 | return -ENOMEM; |
1135 | 1138 | ||
1136 | return 0; | 1139 | return 0; |
1137 | } | 1140 | } |
1138 | 1141 | ||
1139 | int event__synthesize_tracing_data(int fd, struct perf_evlist *evlist, | 1142 | int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist, |
1140 | event__handler_t process, | 1143 | perf_event__handler_t process, |
1141 | struct perf_session *session __unused) | 1144 | struct perf_session *session __unused) |
1142 | { | 1145 | { |
1143 | event_t ev; | 1146 | union perf_event ev; |
1144 | ssize_t size = 0, aligned_size = 0, padding; | 1147 | ssize_t size = 0, aligned_size = 0, padding; |
1145 | int err = 0; | 1148 | int err = 0; |
1146 | 1149 | ||
@@ -1163,10 +1166,10 @@ int event__synthesize_tracing_data(int fd, struct perf_evlist *evlist, | |||
1163 | return aligned_size; | 1166 | return aligned_size; |
1164 | } | 1167 | } |
1165 | 1168 | ||
1166 | int event__process_tracing_data(event_t *self, | 1169 | int perf_event__process_tracing_data(union perf_event *event, |
1167 | struct perf_session *session) | 1170 | struct perf_session *session) |
1168 | { | 1171 | { |
1169 | ssize_t size_read, padding, size = self->tracing_data.size; | 1172 | ssize_t size_read, padding, size = event->tracing_data.size; |
1170 | off_t offset = lseek(session->fd, 0, SEEK_CUR); | 1173 | off_t offset = lseek(session->fd, 0, SEEK_CUR); |
1171 | char buf[BUFSIZ]; | 1174 | char buf[BUFSIZ]; |
1172 | 1175 | ||
@@ -1192,12 +1195,12 @@ int event__process_tracing_data(event_t *self, | |||
1192 | return size_read + padding; | 1195 | return size_read + padding; |
1193 | } | 1196 | } |
1194 | 1197 | ||
1195 | int event__synthesize_build_id(struct dso *pos, u16 misc, | 1198 | int perf_event__synthesize_build_id(struct dso *pos, u16 misc, |
1196 | event__handler_t process, | 1199 | perf_event__handler_t process, |
1197 | struct machine *machine, | 1200 | struct machine *machine, |
1198 | struct perf_session *session) | 1201 | struct perf_session *session) |
1199 | { | 1202 | { |
1200 | event_t ev; | 1203 | union perf_event ev; |
1201 | size_t len; | 1204 | size_t len; |
1202 | int err = 0; | 1205 | int err = 0; |
1203 | 1206 | ||
@@ -1220,11 +1223,11 @@ int event__synthesize_build_id(struct dso *pos, u16 misc, | |||
1220 | return err; | 1223 | return err; |
1221 | } | 1224 | } |
1222 | 1225 | ||
1223 | int event__process_build_id(event_t *self, | 1226 | int perf_event__process_build_id(union perf_event *event, |
1224 | struct perf_session *session) | 1227 | struct perf_session *session) |
1225 | { | 1228 | { |
1226 | __event_process_build_id(&self->build_id, | 1229 | __event_process_build_id(&event->build_id, |
1227 | self->build_id.filename, | 1230 | event->build_id.filename, |
1228 | session); | 1231 | session); |
1229 | return 0; | 1232 | return 0; |
1230 | } | 1233 | } |