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>
This commit is contained in:

committed by
Ingo Molnar

parent
cb5d769990
commit
69996df486
@@ -24,7 +24,7 @@ static int perf_session__open(struct perf_session *self, bool force)
|
||||
self->fd = STDIN_FILENO;
|
||||
|
||||
if (perf_session__read_header(self, self->fd) < 0)
|
||||
pr_err("incompatible file format");
|
||||
pr_err("incompatible file format (rerun with -v to learn more)");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ static int perf_session__open(struct perf_session *self, bool force)
|
||||
}
|
||||
|
||||
if (perf_session__read_header(self, self->fd) < 0) {
|
||||
pr_err("incompatible file format");
|
||||
pr_err("incompatible file format (rerun with -v to learn more)");
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user