From: Jiri Olsa <jolsa@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>
Subject: [PATCH 14/25] perf tools: Introduce perf.data version 3 format
Date: Sun, 1 Sep 2013 12:36:25 +0200 [thread overview]
Message-ID: <1378031796-17892-15-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1378031796-17892-1-git-send-email-jolsa@redhat.com>
Introducing perf.data version 3 format. No functional change,
just introducing doc, magic bytes and the struct.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.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>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
---
tools/perf/Documentation/perf-data-file-v3.txt | 63 ++++++++++++++++++++++++++
| 8 +++-
| 8 ++++
3 files changed, 78 insertions(+), 1 deletion(-)
create mode 100644 tools/perf/Documentation/perf-data-file-v3.txt
diff --git a/tools/perf/Documentation/perf-data-file-v3.txt b/tools/perf/Documentation/perf-data-file-v3.txt
new file mode 100644
index 0000000..9bf9464
--- /dev/null
+++ b/tools/perf/Documentation/perf-data-file-v3.txt
@@ -0,0 +1,63 @@
+perf-data-file-v3(5)
+====================
+
+NAME
+----
+perf-data-file-v3 - The perf tool file format version 3
+
+
+DESCRIPTION
+-----------
+Following text describes version 3 of the perf data file format,
+which is version that is currently used by perf tool.
+
+In version 3 we got rid of following sections:
+ EVENT IDS
+ EVENT ATTRIBUTES
+ EVENT TYPES
+
+and keep only data and features sections. All the data
+from above listed sections are now read from specific
+FEATURES sections.
+
+High level view of the format:
+ FILE HEADER
+ EVENT DATA
+ FEATURES
+
+
+FILE HEADER
+-----------
+Starting point of the data file with magic bytes and global
+section information.
+
+The section contains following data:
+ struct perf_file_header header
+
+struct perf_file_header::
+ struct perf_file_header {
+ u64 magic;
+ u64 size;
+ u64 attr_size;
+ struct perf_file_section data;
+ struct perf_file_section features;
+ DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
+ }
+
+ magic ID 'PERFILE3'
+ size header size sizeof(struct perf_file_header)
+ attr_size attribute size sizeof(struct perf_file_attr)
+ data location of 'EVENT DATA'
+ features location of 'EVENT TYPES'
+ adds_features 'FEATURES' bitmask
+
+
+EVENT DATA
+----------
+This section contains blob of all events' data - auxiliary events
+and samples.
+
+
+FEATURES
+--------
+Same as in version 2.
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index e43879e..db6b131 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -30,6 +30,7 @@ static const char **header_argv;
/*
* magic2 = "PERFILE2"
+ * magic3 = "PERFILE3"
* must be a numerical value to let the endianness
* determine the memory layout. That way we are able
* to detect endianness when reading the perf.data file
@@ -40,6 +41,8 @@ static const char **header_argv;
static const char *__perf_magic1 = "PERFFILE";
static const u64 __perf_magic2 = 0x32454c4946524550ULL;
static const u64 __perf_magic2_sw = 0x50455246494c4532ULL;
+static const u64 __perf_magic3 = 0x33454c4946524550ULL;
+static const u64 __perf_magic3_sw = 0x50455246494c4533ULL;
#define PERF_MAGIC __perf_magic2
@@ -2464,7 +2467,9 @@ bool is_perf_magic(u64 magic)
{
if (!memcmp(&magic, __perf_magic1, sizeof(magic))
|| magic == __perf_magic2
- || magic == __perf_magic2_sw)
+ || magic == __perf_magic2_sw
+ || magic == __perf_magic3
+ || magic == __perf_magic3_sw)
return true;
return false;
@@ -2506,6 +2511,7 @@ do { \
} while (0)
CHECK(__perf_magic2, PERF_HEADER_VERSION_2);
+ CHECK(__perf_magic3, PERF_HEADER_VERSION_3);
return -1;
}
--git a/tools/perf/util/header.h b/tools/perf/util/header.h
index c6ea4603..bcd3e64 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -37,6 +37,7 @@ enum {
enum perf_header_version {
PERF_HEADER_VERSION_1,
PERF_HEADER_VERSION_2,
+ PERF_HEADER_VERSION_3,
};
struct perf_file_section {
@@ -52,6 +53,12 @@ struct perf_file_header_v2 {
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
};
+struct perf_file_header_v3 {
+ struct perf_file_section data;
+ struct perf_file_section features;
+ DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
+};
+
struct perf_file_header {
u64 magic;
u64 size;
@@ -60,6 +67,7 @@ struct perf_file_header {
/* version specific data */
union {
struct perf_file_header_v2 v2;
+ struct perf_file_header_v3 v3;
};
};
--
1.7.11.7
next prev parent reply other threads:[~2013-09-01 10:37 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-01 10:36 [PATCHv2 00/25] perf tool: Add support for multiple data file storage Jiri Olsa
2013-09-01 10:36 ` [PATCH 01/25] perf tools: Check mmap pages value early Jiri Olsa
2013-10-15 5:24 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-09-01 10:36 ` [PATCH 02/25] perf tools: Add possibility to specify mmap size Jiri Olsa
2013-10-15 5:25 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-09-01 10:36 ` [PATCH 03/25] perf tools: Introduce perf_evlist__new_default function Jiri Olsa
2013-10-15 5:25 ` [tip:perf/core] perf evlist: " tip-bot for Jiri Olsa
2013-09-01 10:36 ` [PATCH 04/25] perf tools: Adding throttle event data struct support Jiri Olsa
2013-10-15 5:25 ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-09-01 10:36 ` [PATCH 05/25] perf tests: Add simple session read/write test Jiri Olsa
2013-09-01 10:36 ` [PATCH 06/25] perf tests: Add session reading test for little endian perf data Jiri Olsa
2013-09-01 10:36 ` [PATCH 07/25] perf tests: Add session reading test for big " Jiri Olsa
2013-09-01 10:36 ` [PATCH 08/25] perf doc: Add perf data file documentation Jiri Olsa
2013-09-01 10:36 ` [PATCH 09/25] perf tools: Introduce perf data file version CHECK macro Jiri Olsa
2013-09-01 10:36 ` [PATCH 10/25] perf tools: Introduce swap_features function Jiri Olsa
2013-09-01 10:36 ` [PATCH 11/25] perf tools: Introduce swap_header function Jiri Olsa
2013-09-01 10:36 ` [PATCH 12/25] perf tools: Separate version 2 specific perf data header bits Jiri Olsa
2013-09-01 10:36 ` [PATCH 13/25] perf tools: Using evlist as a holder for event_desc feature Jiri Olsa
2013-09-01 10:36 ` Jiri Olsa [this message]
2013-09-01 10:36 ` [PATCH 15/25] perf tools: Add perf data version 3 header swap Jiri Olsa
2013-09-01 10:36 ` [PATCH 16/25] perf tools: Add perf data version 3 header read Jiri Olsa
2013-09-01 10:36 ` [PATCH 17/25] perf tools: Add perf.data version 3 header write Jiri Olsa
2013-09-01 10:36 ` [PATCH 18/25] perf tools: Get rid of post_processing_offset in record command Jiri Olsa
2013-09-01 10:36 ` [PATCH 19/25] perf tools: Move synthesizing into single function Jiri Olsa
2013-09-01 10:36 ` [PATCH 20/25] perf tools: Add perf_data_file__open interface to data object Jiri Olsa
2013-09-01 10:36 ` [PATCH 21/25] perf tools: Separating data file properties from session Jiri Olsa
2013-09-01 10:36 ` [PATCH 22/25] perf tests: Add session reading test for little endian perf data v3 Jiri Olsa
2013-09-01 10:36 ` [PATCH 23/25] perf tests: Add session reading test for big " Jiri Olsa
2013-09-01 10:36 ` [PATCH 24/25] perf tools: Add multi file '-M' option for record command Jiri Olsa
2013-09-02 7:52 ` Adrian Hunter
2013-09-02 8:37 ` Jiri Olsa
2013-09-02 9:11 ` Adrian Hunter
2013-09-02 9:40 ` Jiri Olsa
2013-09-01 10:36 ` [PATCH 25/25] perf tools: Have the process properly sythesized in subsequent data files Jiri Olsa
2013-09-02 2:42 ` [PATCHv2 00/25] perf tool: Add support for multiple data file storage Andi Kleen
2013-09-09 11:17 ` Peter Zijlstra
2013-09-09 11:36 ` Jiri Olsa
2013-09-09 11:55 ` Peter Zijlstra
2013-09-09 14:03 ` Jiri Olsa
2013-09-09 14:11 ` David Ahern
2013-09-09 14:31 ` Jiri Olsa
2013-09-09 15:03 ` David Ahern
2013-09-14 18:32 ` David Ahern
2013-09-09 16:06 ` Ingo Molnar
2013-09-10 17:29 ` David Ahern
2013-09-10 6:54 ` Adrian Hunter
2013-09-10 9:15 ` Peter Zijlstra
2013-09-10 8:57 ` Namhyung Kim
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=1378031796-17892-15-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=dsahern@gmail.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).