linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
	namhyung@kernel.org, jolsa@redhat.com, fweisbec@gmail.com,
	ak@linux.intel.com, dsahern@gmail.com, tglx@linutronix.de,
	cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perf/core] perf header: Recognize version number for perf data file
Date: Fri, 19 Jul 2013 00:54:50 -0700	[thread overview]
Message-ID: <tip-2a08c3ec4f7d6058a450d2d4bc6e366955872707@git.kernel.org> (raw)
In-Reply-To: <1374083403-14591-8-git-send-email-jolsa@redhat.com>

Commit-ID:  2a08c3ec4f7d6058a450d2d4bc6e366955872707
Gitweb:     http://git.kernel.org/tip/2a08c3ec4f7d6058a450d2d4bc6e366955872707
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 17 Jul 2013 19:49:47 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 17 Jul 2013 17:04:00 -0300

perf header: Recognize version number for perf data file

Keep the recognized data file version within 'struct perf_header'.

Signed-off-by: Jiri 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.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c |  2 ++
 tools/perf/util/header.h | 16 +++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index eefb052..f558f83 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -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;
 }
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index e6387dc..307c9ae 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -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;

  reply	other threads:[~2013-07-19  7:55 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17 17:49 [RFC 0/23] perf tool: Add support for multiple data file storage Jiri Olsa
2013-07-17 17:49 ` [PATCH 01/23] perf tools: Use session->fd instead of passing fd as argument Jiri Olsa
2013-07-19  7:54   ` [tip:perf/core] perf session: Use session-> fd " tip-bot for Jiri Olsa
2013-07-17 17:49 ` [PATCH 02/23] perf tools: Remove data_offset seek as it's not needed Jiri Olsa
2013-07-18  7:27   ` Namhyung Kim
2013-07-18 12:46     ` Jiri Olsa
2013-07-19  7:54   ` [tip:perf/core] perf header: Remove data_offset seek as it' s " tip-bot for Jiri Olsa
2013-07-17 17:49 ` [PATCH 03/23] perf tools: Remove attr_offset from perf_header Jiri Olsa
2013-07-19  7:54   ` [tip:perf/core] perf header: " tip-bot for Jiri Olsa
2013-07-17 17:49 ` [PATCH 04/23] perf tools: Introduce feat_offset into perf_header Jiri Olsa
2013-07-19  7:54   ` [tip:perf/core] perf header: " tip-bot for Jiri Olsa
2013-07-17 17:49 ` [PATCH 05/23] perf tests: Add simple session read/write test Jiri Olsa
2013-07-18  7:46   ` Namhyung Kim
2013-07-18 12:52     ` Jiri Olsa
     [not found]   ` <20130717193313.GA5127@infradead.org>
2013-07-18 12:52     ` Jiri Olsa
2013-07-18 14:26     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 06/23] perf doc: Add perf data file documentation Jiri Olsa
2013-07-17 19:59   ` Arnaldo Carvalho de Melo
2013-07-18 12:40     ` Jiri Olsa
2013-07-19 15:46   ` Andi Kleen
2013-07-17 17:49 ` [PATCH 07/23] perf tools: Recognize version number for perf data file Jiri Olsa
2013-07-19  7:54   ` tip-bot for Jiri Olsa [this message]
2013-07-17 17:49 ` [PATCH 08/23] perf tools: Introduce perf data file version CHECK macro Jiri Olsa
     [not found]   ` <20130717194250.GB5127@infradead.org>
2013-07-18 12:39     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 09/23] perf tools: Introduce swap_features function Jiri Olsa
2013-07-17 17:49 ` [PATCH 10/23] perf tools: Introduce swap_header function Jiri Olsa
2013-07-19 11:33   ` Namhyung Kim
2013-07-22 13:44     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 11/23] perf tools: Separate version 2 specific perf data header bits Jiri Olsa
2013-07-17 17:49 ` [PATCH 12/23] perf tools: Using evlist as a holder for event_desc feature Jiri Olsa
2013-07-17 17:49 ` [PATCH 13/23] perf tools: Introduce perf.data version 3 format Jiri Olsa
2013-07-19 12:06   ` Namhyung Kim
2013-07-22 10:00     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 14/23] perf tools: Add perf data version 3 header swap Jiri Olsa
2013-07-17 17:49 ` [PATCH 15/23] perf tools: Add perf data version 3 header read Jiri Olsa
2013-07-19 12:11   ` Namhyung Kim
2013-07-22 10:02     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 16/23] perf tools: Add perf.data version 3 header write Jiri Olsa
2013-07-17 17:49 ` [PATCH 17/23] perf tools: Get rid of post_processing_offset in record command Jiri Olsa
2013-07-17 17:49 ` [PATCH 18/23] perf tools: Move synthetizing into single function Jiri Olsa
2013-07-19 12:30   ` Namhyung Kim
2013-07-22 10:15     ` Jiri Olsa
2013-07-17 17:49 ` [PATCH 19/23] perf tools: Add data object to handle perf data file Jiri Olsa
2013-07-17 17:50 ` [PATCH 20/23] perf tools: Add perf_data_file__open interface to data object Jiri Olsa
2013-07-17 17:50 ` [PATCH 21/23] perf tools: Separating data file properties from session Jiri Olsa
2013-07-17 17:50 ` [PATCH 22/23] perf tools: Add multi file '-M' option for record command Jiri Olsa
2013-07-19 13:02   ` Namhyung Kim
2013-07-22 10:17     ` Jiri Olsa
2013-07-17 17:50 ` [PATCH 23/23] perf tools: Have the process properly sythesized in subsequent data files Jiri Olsa

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=tip-2a08c3ec4f7d6058a450d2d4bc6e366955872707@git.kernel.org \
    --to=tipbot@zytor.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=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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).