perf tools: Enable reading of perf.data files from different ABI rev
authorStephane Eranian <eranian@google.com>
Thu, 9 Feb 2012 22:21:06 +0000 (23:21 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 9 Mar 2012 07:26:06 +0000 (08:26 +0100)
commit69996df486fc3921bbaaa17fca0d68f537f9eabf
tree4d41484700db59dbf769af11b5e3f70ba34e222d
parentcb5d76999029ae7a517cb07dfa732c1b5a934fc2
perf tools: Enable reading of perf.data files from different ABI rev

This patch allows perf to process perf.data files generated
using an ABI that has a different perf_event_attr struct size,
i.e., a different ABI version.

The perf_event_attr can be extended, yet perf needs to cope with
older perf.data files. Similarly, perf must be able to cope with
a perf.data file which is using a newer version of the ABI than
what it knows about.

This patch adds read_attr(), a routine that reads a
perf_event_attr struct from a file incrementally based on its
advertised size. If the on-file struct is smaller than what perf
knows, then the extra fields are zeroed. If the on-file struct
is bigger, then perf only uses what it knows about, the rest is
skipped.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: peterz@infradead.org
Cc: acme@redhat.com
Cc: robert.richter@amd.com
Cc: ming.m.lin@intel.com
Cc: andi@firstfloor.org
Cc: asharma@fb.com
Cc: ravitillo@lbl.gov
Cc: vweaver1@eecs.utk.edu
Cc: khandual@linux.vnet.ibm.com
Cc: dsahern@gmail.com
Link: http://lkml.kernel.org/r/1328826068-11713-17-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/header.c
tools/perf/util/session.c