linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Ingo Molnar <mingo@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH V4 19/21] perf tools: move struct ip_event
Date: Thu,  4 Jul 2013 16:20:38 +0300	[thread overview]
Message-ID: <1372944040-32690-20-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1372944040-32690-1-git-send-email-adrian.hunter@intel.com>

struct ip_event assumes fixed positions for ip, pid
and tid.  That is no longer true with the addition of
PERF_SAMPLE_IDENTIFIER.

struct ip_event is no longer used except by hists_link.c.
Move it there.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/tests/hists_link.c | 23 +++++++++++++++++++----
 tools/perf/util/event.h       | 11 -----------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 6fa9aa6..5bcbeb3 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -194,6 +194,19 @@ static struct sample fake_samples[][5] = {
 	},
 };
 
+/* PERF_SAMPLE_IP | PERF_SAMPLE_TID | * but not PERF_SAMPLE_IDENTIFIER */
+struct ip_event {
+	struct perf_event_header header;
+	u64 ip;
+	u32 pid, tid;
+	unsigned char __more_data[];
+};
+
+union perf_ip_event {
+	struct ip_event ip;
+	union perf_event event;
+};
+
 static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
 {
 	struct perf_evsel *evsel;
@@ -209,7 +222,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
 	 */
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
-			const union perf_event event = {
+			const union perf_ip_event ip_event = {
 				.ip = {
 					.header = {
 						.misc = PERF_RECORD_MISC_USER,
@@ -218,10 +231,11 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
 					.ip  = fake_common_samples[k].ip,
 				},
 			};
+			const union perf_event *event = &ip_event.event;
 
 			sample.pid = ip_event.ip.pid;
 			sample.ip = ip_event.ip.ip;
-			if (perf_event__preprocess_sample(&event, machine, &al,
+			if (perf_event__preprocess_sample(event, machine, &al,
 							  &sample, 0) < 0)
 				goto out;
 
@@ -235,7 +249,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
 		}
 
 		for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) {
-			const union perf_event event = {
+			const union perf_ip_event ip_event = {
 				.ip = {
 					.header = {
 						.misc = PERF_RECORD_MISC_USER,
@@ -244,10 +258,11 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
 					.ip  = fake_samples[i][k].ip,
 				},
 			};
+			const union perf_event *event = &ip_event.event;
 
 			sample.pid = ip_event.ip.pid;
 			sample.ip = ip_event.ip.ip;
-			if (perf_event__preprocess_sample(&event, machine, &al,
+			if (perf_event__preprocess_sample(event, machine, &al,
 							  &sample, 0) < 0)
 				goto out;
 
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 3aef78c..a7b2245 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -8,16 +8,6 @@
 #include "map.h"
 #include "build-id.h"
 
-/*
- * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
- */
-struct ip_event {
-	struct perf_event_header header;
-	u64 ip;
-	u32 pid, tid;
-	unsigned char __more_data[];
-};
-
 struct mmap_event {
 	struct perf_event_header header;
 	u32 pid, tid;
@@ -162,7 +152,6 @@ struct tracing_data_event {
 
 union perf_event {
 	struct perf_event_header	header;
-	struct ip_event			ip;
 	struct mmap_event		mmap;
 	struct comm_event		comm;
 	struct fork_event		fork;
-- 
1.7.11.7


  parent reply	other threads:[~2013-07-04 13:15 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 13:20 [PATCH V4 00/15] perf tools: some fixes and tweaks Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 01/21] perf tools: remove unused parameter Adrian Hunter
2013-07-19  7:49   ` [tip:perf/core] perf inject: Remove " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 02/21] perf tools: fix missing tool parameter Adrian Hunter
2013-07-19  7:49   ` [tip:perf/core] perf tools: Fix " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 03/21] perf tools: fix missing 'finished_round' Adrian Hunter
2013-07-19  7:49   ` [tip:perf/core] perf inject: Add " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 04/21] perf tools: fix parse_events_terms() segfault on error path Adrian Hunter
2013-07-12  8:51   ` [tip:perf/urgent] perf tools: Fix " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 05/21] perf tools: fix new_term() missing free " Adrian Hunter
2013-07-12  8:51   ` [tip:perf/urgent] perf tools: Fix " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 06/21] perf tools: add const specifier to perf_pmu__find name parameter Adrian Hunter
2013-07-19  7:49   ` [tip:perf/core] perf tools: Add " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 07/21] perf tools: tidy duplicated munmap code Adrian Hunter
2013-07-19  7:49   ` [tip:perf/core] perf evlist: Tidy " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 08/21] perf tools: validate perf event header size Adrian Hunter
2013-07-19  7:50   ` [tip:perf/core] perf tools: Validate " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 09/21] perf tools: add debug prints Adrian Hunter
2013-07-05 16:59   ` Arnaldo Carvalho de Melo
2013-07-04 13:20 ` [PATCH V4 10/21] perf tools: fix symbol_conf.nr_events Adrian Hunter
2013-07-12  8:51   ` [tip:perf/urgent] perf tools: Update symbol_conf.nr_events when processing attribute events tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 11/21] perf tools: allow non-matching sample types Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 12/21] perf tools: struct thread has a tid not a pid Adrian Hunter
2013-07-19  7:50   ` [tip:perf/core] " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 13/21] perf tools: add pid to struct thread Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 14/21] perf tools: change "machine" functions to set thread pid Adrian Hunter
2013-07-06 15:58   ` David Ahern
2013-07-04 13:20 ` [PATCH V4 15/21] perf tools: fix missing increment in sample parsing Adrian Hunter
2013-07-05 17:08   ` Arnaldo Carvalho de Melo
2013-07-12  8:51   ` [tip:perf/urgent] perf evsel: Fix " tip-bot for Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 16/21] perf tools: tidy up sample parsing overflow checking Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 17/21] perf tools: remove unnecessary callchain validation Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 18/21] perf tools: remove references to struct ip_event Adrian Hunter
2013-07-04 13:20 ` Adrian Hunter [this message]
2013-07-04 13:20 ` [PATCH V4 20/21] perf: make events stream always parsable Adrian Hunter
2013-07-05 13:24   ` Namhyung Kim
2013-07-11 13:26     ` Adrian Hunter
2013-07-04 13:20 ` [PATCH V4 21/21] perf tools: add support for PERF_SAMPLE_IDENTFIER Adrian Hunter

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=1372944040-32690-20-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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).