summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-09-26 12:48:18 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-26 12:48:18 -0300
commit0807d2d8a381f4fc600ad481c3e77e5cdb624eed (patch)
tree3cd46552cea3e1a9c7c872250f790cb180f6cccf /tools/perf/util/header.c
parenta14bb7a6fd4a3d563ca971daf462ba4dc294a7a6 (diff)
downloadop-kernel-dev-0807d2d8a381f4fc600ad481c3e77e5cdb624eed.zip
op-kernel-dev-0807d2d8a381f4fc600ad481c3e77e5cdb624eed.tar.gz
perf evsel: Know if byte swap is needed
Instead of passing it around for parsing as an explicit parameter, will help with reading tracepoint fields when not using a perf session or pevent structure, i.e. for non perf.data centered workflows. 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-qa67ikv2sm49cwa7dyjhhp6g@git.kernel.org 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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 6aae329..7daad23 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1256,8 +1256,10 @@ read_event_desc(struct perf_header *ph, int fd)
if (ret != (ssize_t)sizeof(nr))
goto error;
- if (ph->needs_swap)
+ if (ph->needs_swap) {
nr = bswap_32(nr);
+ evsel->needs_swap = true;
+ }
evsel->name = do_read_string(fd, ph);
@@ -2626,6 +2628,8 @@ int perf_session__read_header(struct perf_session *session, int fd)
if (evsel == NULL)
goto out_delete_evlist;
+
+ evsel->needs_swap = header->needs_swap;
/*
* Do it before so that if perf_evsel__alloc_id fails, this
* entry gets purged too at perf_evlist__delete().
OpenPOWER on IntegriCloud