[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc@git.kernel.org>
Date: Thu, 8 Oct 2009 20:16:38 GMT
From: tip-bot for Frederic Weisbecker <fweisbec@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com,
hpa@...or.com, mingo@...hat.com, efault@....de,
peterz@...radead.org, fweisbec@...il.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perf/core] perf tools: Provide backward compatibility with previous perf.data version
Commit-ID: 26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc
Gitweb: http://git.kernel.org/tip/26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc
Author: Frederic Weisbecker <fweisbec@...il.com>
AuthorDate: Thu, 8 Oct 2009 22:07:29 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 8 Oct 2009 22:11:02 +0200
perf tools: Provide backward compatibility with previous perf.data version
We have merged the trace.info file into perf.data by adding one
section in the perf headers. This makes it incompatible with
previous version: the new perf tools can't read the older
perf.data.
To support the previous format, we check the headers size. If they
have the same size than in the previous format, then ignore the
trace info section that doesn't exist.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
LKML-Reference: <1255032449-12022-1-git-send-email-fweisbec@...il.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/util/header.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 212fade..9aae360 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -287,10 +287,16 @@ struct perf_header *perf_header__read(int fd)
do_read(fd, &f_header, sizeof(f_header));
if (f_header.magic != PERF_MAGIC ||
- f_header.size != sizeof(f_header) ||
f_header.attr_size != sizeof(f_attr))
die("incompatible file format");
+ if (f_header.size != sizeof(f_header)) {
+ /* Support the previous format */
+ if (f_header.size == offsetof(typeof(f_header), trace_info))
+ f_header.trace_info.size = 0;
+ else
+ die("incompatible file format");
+ }
nr_attrs = f_header.attrs.size / sizeof(f_attr);
lseek(fd, f_header.attrs.offset, SEEK_SET);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists