Commit 2a08c3ec authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf header: Recognize version number for perf data file

Keep the recognized data file version within 'struct perf_header'.
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1374083403-14591-8-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8d541e97
...@@ -2480,6 +2480,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz, ...@@ -2480,6 +2480,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz,
/* check for legacy format */ /* check for legacy format */
ret = memcmp(&magic, __perf_magic1, sizeof(magic)); ret = memcmp(&magic, __perf_magic1, sizeof(magic));
if (ret == 0) { if (ret == 0) {
ph->version = PERF_HEADER_VERSION_1;
pr_debug("legacy perf.data format\n"); pr_debug("legacy perf.data format\n");
if (is_pipe) if (is_pipe)
return try_all_pipe_abis(hdr_sz, ph); return try_all_pipe_abis(hdr_sz, ph);
...@@ -2501,6 +2502,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz, ...@@ -2501,6 +2502,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz,
return -1; return -1;
ph->needs_swap = true; ph->needs_swap = true;
ph->version = PERF_HEADER_VERSION_2;
return 0; return 0;
} }
......
...@@ -34,6 +34,11 @@ enum { ...@@ -34,6 +34,11 @@ enum {
HEADER_FEAT_BITS = 256, HEADER_FEAT_BITS = 256,
}; };
enum perf_header_version {
PERF_HEADER_VERSION_1,
PERF_HEADER_VERSION_2,
};
struct perf_file_section { struct perf_file_section {
u64 offset; u64 offset;
u64 size; u64 size;
...@@ -85,12 +90,13 @@ struct perf_session_env { ...@@ -85,12 +90,13 @@ struct perf_session_env {
}; };
struct perf_header { struct perf_header {
bool needs_swap; enum perf_header_version version;
u64 data_offset; bool needs_swap;
u64 data_size; u64 data_offset;
u64 feat_offset; u64 data_size;
u64 feat_offset;
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
struct perf_session_env env; struct perf_session_env env;
}; };
struct perf_evlist; struct perf_evlist;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment