]> Git Repo - linux.git/commitdiff
perf header: Recognize version number for perf data file
authorJiri Olsa <[email protected]>
Wed, 17 Jul 2013 17:49:47 +0000 (19:49 +0200)
committerArnaldo Carvalho de Melo <[email protected]>
Wed, 17 Jul 2013 20:04:00 +0000 (17:04 -0300)
Keep the recognized data file version within 'struct perf_header'.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/header.c
tools/perf/util/header.h

index eefb052190f36acf1da3d239fb9df0c30435567a..f558f83769af1a7e7b9fe0780ab4c6b4793f260c 100644 (file)
@@ -2480,6 +2480,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz,
        /* check for legacy format */
        ret = memcmp(&magic, __perf_magic1, sizeof(magic));
        if (ret == 0) {
+               ph->version = PERF_HEADER_VERSION_1;
                pr_debug("legacy perf.data format\n");
                if (is_pipe)
                        return try_all_pipe_abis(hdr_sz, ph);
@@ -2501,6 +2502,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz,
                return -1;
 
        ph->needs_swap = true;
+       ph->version = PERF_HEADER_VERSION_2;
 
        return 0;
 }
index e6387dcb95c0945826ddc0dc54000f66e1bac7b6..307c9aed972ed0d6403fe58da4d9edae4109abdf 100644 (file)
@@ -34,6 +34,11 @@ enum {
        HEADER_FEAT_BITS        = 256,
 };
 
+enum perf_header_version {
+       PERF_HEADER_VERSION_1,
+       PERF_HEADER_VERSION_2,
+};
+
 struct perf_file_section {
        u64 offset;
        u64 size;
@@ -85,12 +90,13 @@ struct perf_session_env {
 };
 
 struct perf_header {
-       bool                    needs_swap;
-       u64                     data_offset;
-       u64                     data_size;
-       u64                     feat_offset;
+       enum perf_header_version        version;
+       bool                            needs_swap;
+       u64                             data_offset;
+       u64                             data_size;
+       u64                             feat_offset;
        DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
-       struct perf_session_env env;
+       struct perf_session_env         env;
 };
 
 struct perf_evlist;
This page took 0.051339 seconds and 4 git commands to generate.