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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5e562474
...@@ -313,7 +313,7 @@ static void perf_record__open(struct perf_record *rec) ...@@ -313,7 +313,7 @@ static void perf_record__open(struct perf_record *rec)
} }
} }
perf_session__update_sample_type(session); perf_session__set_id_hdr_size(session);
} }
static int process_buildids(struct perf_record *rec) static int process_buildids(struct perf_record *rec)
......
...@@ -1032,7 +1032,7 @@ static int __cmd_top(struct perf_top *top) ...@@ -1032,7 +1032,7 @@ static int __cmd_top(struct perf_top *top)
&top->session->host_machine); &top->session->host_machine);
perf_top__start_counters(top); perf_top__start_counters(top);
top->session->evlist = top->evlist; top->session->evlist = top->evlist;
perf_session__update_sample_type(top->session); perf_session__set_id_hdr_size(top->session);
/* Wait for a minimal set of events before starting the snapshot */ /* Wait for a minimal set of events before starting the snapshot */
poll(top->evlist->pollfd, top->evlist->nr_fds, 100); poll(top->evlist->pollfd, top->evlist->nr_fds, 100);
......
...@@ -101,11 +101,12 @@ static int perf_session__open(struct perf_session *self, bool force) ...@@ -101,11 +101,12 @@ static int perf_session__open(struct perf_session *self, bool force)
return -1; return -1;
} }
void perf_session__update_sample_type(struct perf_session *self) void perf_session__set_id_hdr_size(struct perf_session *session)
{ {
self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); u16 id_hdr_size = perf_evlist__id_hdr_size(session->evlist);
self->host_machine.id_hdr_size = self->id_hdr_size;
machines__set_id_hdr_size(&self->machines, self->id_hdr_size); session->host_machine.id_hdr_size = id_hdr_size;
machines__set_id_hdr_size(&session->machines, id_hdr_size);
} }
int perf_session__create_kernel_maps(struct perf_session *self) 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,7 +166,7 @@ struct perf_session *perf_session__new(const char *filename, int mode,
if (mode == O_RDONLY) { if (mode == O_RDONLY) {
if (perf_session__open(self, force) < 0) if (perf_session__open(self, force) < 0)
goto out_delete; goto out_delete;
perf_session__update_sample_type(self); perf_session__set_id_hdr_size(self);
} else if (mode == O_WRONLY) { } else if (mode == O_WRONLY) {
/* /*
* In O_RDONLY mode this will be performed when reading the * 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,7 +1055,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
case PERF_RECORD_HEADER_ATTR: case PERF_RECORD_HEADER_ATTR:
err = tool->attr(event, &session->evlist); err = tool->attr(event, &session->evlist);
if (err == 0) if (err == 0)
perf_session__update_sample_type(session); perf_session__set_id_hdr_size(session);
return err; return err;
case PERF_RECORD_HEADER_EVENT_TYPE: case PERF_RECORD_HEADER_EVENT_TYPE:
return tool->event_type(tool, event); return tool->event_type(tool, event);
......
...@@ -44,7 +44,6 @@ struct perf_session { ...@@ -44,7 +44,6 @@ struct perf_session {
int fd; int fd;
bool fd_pipe; bool fd_pipe;
bool repipe; bool repipe;
u16 id_hdr_size;
int cwdlen; int cwdlen;
char *cwd; char *cwd;
struct ordered_samples ordered_samples; struct ordered_samples ordered_samples;
...@@ -83,7 +82,7 @@ void perf_event__attr_swap(struct perf_event_attr *attr); ...@@ -83,7 +82,7 @@ void perf_event__attr_swap(struct perf_event_attr *attr);
int perf_session__create_kernel_maps(struct perf_session *self); int perf_session__create_kernel_maps(struct perf_session *self);
void perf_session__update_sample_type(struct perf_session *self); void perf_session__set_id_hdr_size(struct perf_session *session);
void perf_session__remove_thread(struct perf_session *self, struct thread *th); void perf_session__remove_thread(struct perf_session *self, struct thread *th);
static inline static inline
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment