aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-08-01 17:53:11 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-01 17:53:11 -0400
commitbde09467b56c5a3cfe2a29d58edc5f7172c15184 (patch)
tree5a5bfcdd800a7fbe2a750b86f153e83e866f99c5 /tools/perf/util/session.c
parent0ecf4f0c02b7802de5d1251e03e6eab360f158e1 (diff)
perf evsel: Precalculate the sample size
So that we don't have to store it in the perf_session instance, because in the future perf_session instances may have multiple evlists, each with different sample_type/sizes. 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-ptod86fxkpgq3h62m9refkv4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8e4f0755d2a..b8da60d1ecb 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -16,6 +16,19 @@
16#include "cpumap.h" 16#include "cpumap.h"
17#include "event-parse.h" 17#include "event-parse.h"
18 18
19int perf_session__parse_sample(struct perf_session *session,
20 const union perf_event *event,
21 struct perf_sample *sample)
22{
23 struct perf_evsel *first;
24 first = list_entry(session->evlist->entries.next, struct perf_evsel, node);
25
26 return perf_event__parse_sample(event, session->sample_type,
27 first->sample_size,
28 session->sample_id_all, sample,
29 session->header.needs_swap);
30}
31
19static int perf_session__open(struct perf_session *self, bool force) 32static int perf_session__open(struct perf_session *self, bool force)
20{ 33{
21 struct stat input_stat; 34 struct stat input_stat;
@@ -83,7 +96,6 @@ out_close:
83void perf_session__update_sample_type(struct perf_session *self) 96void perf_session__update_sample_type(struct perf_session *self)
84{ 97{
85 self->sample_type = perf_evlist__sample_type(self->evlist); 98 self->sample_type = perf_evlist__sample_type(self->evlist);
86 self->sample_size = __perf_evsel__sample_size(self->sample_type);
87 self->sample_id_all = perf_evlist__sample_id_all(self->evlist); 99 self->sample_id_all = perf_evlist__sample_id_all(self->evlist);
88 self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); 100 self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist);
89 self->host_machine.id_hdr_size = self->id_hdr_size; 101 self->host_machine.id_hdr_size = self->id_hdr_size;