diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-01 18:31:00 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-01 18:31:00 -0400 |
commit | 7b56cce27123ccbf2cb82febbbc88443d719f1f8 (patch) | |
tree | d15e3255d7a09d0e3193afdad8e0fea469f0fc4a /tools | |
parent | 5e5624745d7e4a2c956c072ef2542872955b59c4 (diff) |
perf session: Use perf_evlist__id_hdr_size more extensively
Removing perf_session->id_hdr_size, as it can be obtained from the
evsel/evlist.
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@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1nwc2kslu7gsfblu98xbqbll@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 13 | ||||
-rw-r--r-- | tools/perf/util/session.h | 3 |
4 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f5a6452931e6..dc2b62565aa1 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -313,7 +313,7 @@ try_again: | |||
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | perf_session__update_sample_type(session); | 316 | perf_session__set_id_hdr_size(session); |
317 | } | 317 | } |
318 | 318 | ||
319 | static int process_buildids(struct perf_record *rec) | 319 | static int process_buildids(struct perf_record *rec) |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 35e86c6df713..520e4256fc66 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -1032,7 +1032,7 @@ static int __cmd_top(struct perf_top *top) | |||
1032 | &top->session->host_machine); | 1032 | &top->session->host_machine); |
1033 | perf_top__start_counters(top); | 1033 | perf_top__start_counters(top); |
1034 | top->session->evlist = top->evlist; | 1034 | top->session->evlist = top->evlist; |
1035 | perf_session__update_sample_type(top->session); | 1035 | perf_session__set_id_hdr_size(top->session); |
1036 | 1036 | ||
1037 | /* Wait for a minimal set of events before starting the snapshot */ | 1037 | /* Wait for a minimal set of events before starting the snapshot */ |
1038 | poll(top->evlist->pollfd, top->evlist->nr_fds, 100); | 1038 | poll(top->evlist->pollfd, top->evlist->nr_fds, 100); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 348cc11385b7..5b8601df2392 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -101,11 +101,12 @@ out_close: | |||
101 | return -1; | 101 | return -1; |
102 | } | 102 | } |
103 | 103 | ||
104 | void perf_session__update_sample_type(struct perf_session *self) | 104 | void perf_session__set_id_hdr_size(struct perf_session *session) |
105 | { | 105 | { |
106 | self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); | 106 | u16 id_hdr_size = perf_evlist__id_hdr_size(session->evlist); |
107 | self->host_machine.id_hdr_size = self->id_hdr_size; | 107 | |
108 | machines__set_id_hdr_size(&self->machines, self->id_hdr_size); | 108 | session->host_machine.id_hdr_size = id_hdr_size; |
109 | machines__set_id_hdr_size(&session->machines, id_hdr_size); | ||
109 | } | 110 | } |
110 | 111 | ||
111 | int perf_session__create_kernel_maps(struct perf_session *self) | 112 | int perf_session__create_kernel_maps(struct perf_session *self) |
@@ -165,7 +166,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, | |||
165 | if (mode == O_RDONLY) { | 166 | if (mode == O_RDONLY) { |
166 | if (perf_session__open(self, force) < 0) | 167 | if (perf_session__open(self, force) < 0) |
167 | goto out_delete; | 168 | goto out_delete; |
168 | perf_session__update_sample_type(self); | 169 | perf_session__set_id_hdr_size(self); |
169 | } else if (mode == O_WRONLY) { | 170 | } else if (mode == O_WRONLY) { |
170 | /* | 171 | /* |
171 | * In O_RDONLY mode this will be performed when reading the | 172 | * In O_RDONLY mode this will be performed when reading the |
@@ -1054,7 +1055,7 @@ static int perf_session__process_user_event(struct perf_session *session, union | |||
1054 | case PERF_RECORD_HEADER_ATTR: | 1055 | case PERF_RECORD_HEADER_ATTR: |
1055 | err = tool->attr(event, &session->evlist); | 1056 | err = tool->attr(event, &session->evlist); |
1056 | if (err == 0) | 1057 | if (err == 0) |
1057 | perf_session__update_sample_type(session); | 1058 | perf_session__set_id_hdr_size(session); |
1058 | return err; | 1059 | return err; |
1059 | case PERF_RECORD_HEADER_EVENT_TYPE: | 1060 | case PERF_RECORD_HEADER_EVENT_TYPE: |
1060 | return tool->event_type(tool, event); | 1061 | return tool->event_type(tool, event); |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index a2c3ce9e716d..e2a1a4b7b236 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -44,7 +44,6 @@ struct perf_session { | |||
44 | int fd; | 44 | int fd; |
45 | bool fd_pipe; | 45 | bool fd_pipe; |
46 | bool repipe; | 46 | bool repipe; |
47 | u16 id_hdr_size; | ||
48 | int cwdlen; | 47 | int cwdlen; |
49 | char *cwd; | 48 | char *cwd; |
50 | struct ordered_samples ordered_samples; | 49 | struct ordered_samples ordered_samples; |
@@ -83,7 +82,7 @@ void perf_event__attr_swap(struct perf_event_attr *attr); | |||
83 | 82 | ||
84 | int perf_session__create_kernel_maps(struct perf_session *self); | 83 | int perf_session__create_kernel_maps(struct perf_session *self); |
85 | 84 | ||
86 | void perf_session__update_sample_type(struct perf_session *self); | 85 | void perf_session__set_id_hdr_size(struct perf_session *session); |
87 | void perf_session__remove_thread(struct perf_session *self, struct thread *th); | 86 | void perf_session__remove_thread(struct perf_session *self, struct thread *th); |
88 | 87 | ||
89 | static inline | 88 | static inline |