From: tip-bot for Frederic Weisbecker <fweisbec@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, acme@redhat.com,
hpa@zytor.com, mingo@redhat.com, efault@gmx.de,
peterz@infradead.org, fweisbec@gmail.com, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:perf/core] perf tools: Provide backward compatibility with previous perf.data version
Date: Thu, 8 Oct 2009 20:16:38 GMT [thread overview]
Message-ID: <tip-26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc@git.kernel.org> (raw)
In-Reply-To: <1255032449-12022-1-git-send-email-fweisbec@gmail.com>
Commit-ID: 26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc
Gitweb: http://git.kernel.org/tip/26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Thu, 8 Oct 2009 22:07:29 +0200
Committer: Ingo Molnar <mingo@elte.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@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1255032449-12022-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
| 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
--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);
next prev parent reply other threads:[~2009-10-08 20:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 20:07 [PATCH] " Frederic Weisbecker
2009-10-08 20:12 ` Ingo Molnar
2009-10-08 20:28 ` Frederic Weisbecker
2009-10-08 20:31 ` Ingo Molnar
2009-10-08 20:16 ` tip-bot for Frederic Weisbecker [this message]
2009-10-08 20:22 ` Frederic Weisbecker
2009-10-12 9:10 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-26dd2cb074d9dc41c9e3cddd7bf175fd0a41febc@git.kernel.org \
--to=fweisbec@gmail.com \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome