summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-08-01 23:53:11 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-01 23:53:11 +0200
commitbde09467b56c5a3cfe2a29d58edc5f7172c15184 (patch)
tree5a5bfcdd800a7fbe2a750b86f153e83e866f99c5 /tools/perf/util/session.c
parentperf target: Fix check on buffer size (diff)
downloadlinux-bde09467b56c5a3cfe2a29d58edc5f7172c15184.tar.xz
linux-bde09467b56c5a3cfe2a29d58edc5f7172c15184.zip
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 8e4f0755d2aa..b8da60d1ecb5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -16,6 +16,19 @@
#include "cpumap.h"
#include "event-parse.h"
+int perf_session__parse_sample(struct perf_session *session,
+ const union perf_event *event,
+ struct perf_sample *sample)
+{
+ struct perf_evsel *first;
+ first = list_entry(session->evlist->entries.next, struct perf_evsel, node);
+
+ return perf_event__parse_sample(event, session->sample_type,
+ first->sample_size,
+ session->sample_id_all, sample,
+ session->header.needs_swap);
+}
+
static int perf_session__open(struct perf_session *self, bool force)
{
struct stat input_stat;
@@ -83,7 +96,6 @@ out_close:
void perf_session__update_sample_type(struct perf_session *self)
{
self->sample_type = perf_evlist__sample_type(self->evlist);
- self->sample_size = __perf_evsel__sample_size(self->sample_type);
self->sample_id_all = perf_evlist__sample_id_all(self->evlist);
self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist);
self->host_machine.id_hdr_size = self->id_hdr_size;