All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	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>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 42/76] perf tools: Fix missing tool parameter
Date: Thu, 18 Jul 2013 16:49:29 -0300	[thread overview]
Message-ID: <1374177003-3706-43-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1374177003-3706-1-git-send-email-acme@infradead.org>

From: Adrian Hunter <adrian.hunter@intel.com>

The 'inject' command expects to get a reference to 'struct perf_inject'
from its 'tool' member.  For that to work, 'tool' needs to be a
parameter of all tool callbacks.  Make it so.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1372944040-32690-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-inject.c | 26 +++++++++++---------------
 tools/perf/util/header.c    |  6 ++++--
 tools/perf/util/header.h    |  6 ++++--
 tools/perf/util/session.c   | 11 +++++++----
 tools/perf/util/tool.h      |  9 ++++-----
 5 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index f299ddf..c943513 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -73,22 +73,17 @@ static int perf_event__repipe_event_type_synth(struct perf_tool *tool,
 	return perf_event__repipe_synth(tool, event);
 }
 
-static int perf_event__repipe_tracing_data_synth(union perf_event *event,
-						 struct perf_session *session
-						 __maybe_unused)
-{
-	return perf_event__repipe_synth(NULL, event);
-}
-
-static int perf_event__repipe_attr(union perf_event *event,
-				   struct perf_evlist **pevlist __maybe_unused)
+static int perf_event__repipe_attr(struct perf_tool *tool,
+				   union perf_event *event,
+				   struct perf_evlist **pevlist)
 {
 	int ret;
-	ret = perf_event__process_attr(event, pevlist);
+
+	ret = perf_event__process_attr(tool, event, pevlist);
 	if (ret)
 		return ret;
 
-	return perf_event__repipe_synth(NULL, event);
+	return perf_event__repipe_synth(tool, event);
 }
 
 static int perf_event__repipe(struct perf_tool *tool,
@@ -147,13 +142,14 @@ static int perf_event__repipe_fork(struct perf_tool *tool,
 	return err;
 }
 
-static int perf_event__repipe_tracing_data(union perf_event *event,
+static int perf_event__repipe_tracing_data(struct perf_tool *tool,
+					   union perf_event *event,
 					   struct perf_session *session)
 {
 	int err;
 
-	perf_event__repipe_synth(NULL, event);
-	err = perf_event__process_tracing_data(event, session);
+	perf_event__repipe_synth(tool, event);
+	err = perf_event__process_tracing_data(tool, event, session);
 
 	return err;
 }
@@ -407,7 +403,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
 			.unthrottle	= perf_event__repipe,
 			.attr		= perf_event__repipe_attr,
 			.event_type	= perf_event__repipe_event_type_synth,
-			.tracing_data	= perf_event__repipe_tracing_data_synth,
+			.tracing_data	= perf_event__repipe_op2_synth,
 			.build_id	= perf_event__repipe_op2_synth,
 		},
 		.input_name  = "-",
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a4dafbe..d12d79c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2922,7 +2922,8 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,
 	return err;
 }
 
-int perf_event__process_attr(union perf_event *event,
+int perf_event__process_attr(struct perf_tool *tool __maybe_unused,
+			     union perf_event *event,
 			     struct perf_evlist **pevlist)
 {
 	u32 i, ids, n_ids;
@@ -3065,7 +3066,8 @@ int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd,
 	return aligned_size;
 }
 
-int perf_event__process_tracing_data(union perf_event *event,
+int perf_event__process_tracing_data(struct perf_tool *tool __maybe_unused,
+				     union perf_event *event,
 				     struct perf_session *session)
 {
 	ssize_t size_read, padding, size = event->tracing_data.size;
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 16a3e83..2d1ca7d 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -130,7 +130,8 @@ int perf_event__synthesize_attr(struct perf_tool *tool,
 int perf_event__synthesize_attrs(struct perf_tool *tool,
 				 struct perf_session *session,
 				 perf_event__handler_t process);
-int perf_event__process_attr(union perf_event *event, struct perf_evlist **pevlist);
+int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
+			     struct perf_evlist **pevlist);
 
 int perf_event__synthesize_event_type(struct perf_tool *tool,
 				      u64 event_id, char *name,
@@ -145,7 +146,8 @@ int perf_event__process_event_type(struct perf_tool *tool,
 int perf_event__synthesize_tracing_data(struct perf_tool *tool,
 					int fd, struct perf_evlist *evlist,
 					perf_event__handler_t process);
-int perf_event__process_tracing_data(union perf_event *event,
+int perf_event__process_tracing_data(struct perf_tool *tool,
+				     union perf_event *event,
 				     struct perf_session *session);
 
 int perf_event__synthesize_build_id(struct perf_tool *tool,
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ad47fb9..6b71b88 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -193,7 +193,9 @@ void perf_session__delete(struct perf_session *self)
 	vdso__exit();
 }
 
-static int process_event_synth_tracing_data_stub(union perf_event *event
+static int process_event_synth_tracing_data_stub(struct perf_tool *tool
+						 __maybe_unused,
+						 union perf_event *event
 						 __maybe_unused,
 						 struct perf_session *session
 						__maybe_unused)
@@ -202,7 +204,8 @@ static int process_event_synth_tracing_data_stub(union perf_event *event
 	return 0;
 }
 
-static int process_event_synth_attr_stub(union perf_event *event __maybe_unused,
+static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_unused,
+					 union perf_event *event __maybe_unused,
 					 struct perf_evlist **pevlist
 					 __maybe_unused)
 {
@@ -921,7 +924,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
 	/* These events are processed right away */
 	switch (event->header.type) {
 	case PERF_RECORD_HEADER_ATTR:
-		err = tool->attr(event, &session->evlist);
+		err = tool->attr(tool, event, &session->evlist);
 		if (err == 0)
 			perf_session__set_id_hdr_size(session);
 		return err;
@@ -930,7 +933,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
 	case PERF_RECORD_HEADER_TRACING_DATA:
 		/* setup for reading amidst mmap */
 		lseek(session->fd, file_offset, SEEK_SET);
-		return tool->tracing_data(event, session);
+		return tool->tracing_data(tool, event, session);
 	case PERF_RECORD_HEADER_BUILD_ID:
 		return tool->build_id(tool, event, session);
 	case PERF_RECORD_FINISHED_ROUND:
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index b0e1aad..88f8cbd 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -18,12 +18,11 @@ typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event,
 typedef int (*event_op)(struct perf_tool *tool, union perf_event *event,
 			struct perf_sample *sample, struct machine *machine);
 
-typedef int (*event_attr_op)(union perf_event *event,
+typedef int (*event_attr_op)(struct perf_tool *tool,
+			     union perf_event *event,
 			     struct perf_evlist **pevlist);
-typedef int (*event_simple_op)(struct perf_tool *tool, union perf_event *event);
 
-typedef int (*event_synth_op)(union perf_event *event,
-			      struct perf_session *session);
+typedef int (*event_simple_op)(struct perf_tool *tool, union perf_event *event);
 
 typedef int (*event_op2)(struct perf_tool *tool, union perf_event *event,
 			 struct perf_session *session);
@@ -39,7 +38,7 @@ struct perf_tool {
 			throttle,
 			unthrottle;
 	event_attr_op	attr;
-	event_synth_op	tracing_data;
+	event_op2	tracing_data;
 	event_simple_op	event_type;
 	event_op2	finished_round,
 			build_id;
-- 
1.8.1.4


  parent reply	other threads:[~2013-07-18 19:54 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 19:48 [GIT PULL 00/76] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 01/76] perf tools: Rename cpu_map__all() to cpu_map__empty() Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 02/76] perf top: Add --objdump option Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 03/76] perf tools: Remove cwd from perf_session struct Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 04/76] perf tests: Omit end of the symbol check failure for test 1 Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 05/76] perf tests: Make TEST_ASSERT_VAL global Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 06/76] perf tools: Use default include path notation for libtraceevent headers Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 07/76] perf tools: Add methods for setting/retrieving priv element of thread struct Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 08/76] perf tools: Remove callchain_cursor_reset call Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 09/76] perf util: Move debugfs/tracing helper functions to util.c Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 10/76] perf util: Use evsel->name to get tracepoint_paths Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 11/76] perf tools: Do not elide parent symbol column Arnaldo Carvalho de Melo
2013-07-18 19:48 ` [PATCH 12/76] perf report: Fix perf_session__delete removal Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 13/76] perf tools: Make Power7 events available for perf Arnaldo Carvalho de Melo
2013-07-18 19:49   ` Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 14/76] perf evlist: Fix use of uninitialized variable Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 15/76] perf tools: Don't free list head in parse_events__free_terms Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 16/76] perf tests: Make terms a stack variable in test_term Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 17/76] perf parse events: Demystify memory allocations Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 18/76] tools lib traceevent: Remove unused install targets Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 19/76] tools lib traceevent: Get rid of unused gui target Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 20/76] tools lib traceevent: Add const qualifier to string arguments Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 21/76] tools lib traceevent: Add trace_seq_reset() Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 22/76] tools lib traceevent: Add page_size field to pevent Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 23/76] tools lib traceevent: Port kbuffer parser routines Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 24/76] perf util: Save page size in a trace file to pevent Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 25/76] perf util: Save long size of traced system Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 26/76] perf util: Make file/host_bigendian variable local Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 27/76] perf util: Skip reading header_event file Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 28/76] perf util: Parse header_page to get proper long size Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 29/76] perf util: Get rid of unused header_page_* variables Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 30/76] perf script: Adopt latency_format variable Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 31/76] perf util: Rename read_*() functions in trace-event-info.c Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 32/76] perf util: No need to call read_trace_init() in tracing_data_header() Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 33/76] perf util: Remove unused enum and macro in trace-event.h Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 34/76] perf sched: Move struct perf_sched definition out of cmd_sched() Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 35/76] perf gtk/hists: Use GtkTreeStore instead of GtkListStore Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 36/76] perf gtk/hists: Add support for callchains Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 37/76] perf gtk/hists: Display callchain overhead also Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 38/76] perf gtk/hists: Make column headers resizable Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 39/76] perf gtk/hists: Add a double-click handler for callchains Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 40/76] perf gtk/hists: Set rules hint for the hist browser Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 41/76] perf inject: Remove unused parameter Arnaldo Carvalho de Melo
2013-07-18 19:49 ` Arnaldo Carvalho de Melo [this message]
2013-07-18 19:49 ` [PATCH 43/76] perf inject: Add missing 'finished_round' Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 44/76] perf tools: Add const specifier to perf_pmu__find name parameter Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 45/76] perf evlist: Tidy duplicated munmap code Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 46/76] perf tools: Validate perf event header size Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 47/76] perf tools: struct thread has a tid not a pid Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 48/76] perf tools: Default to cpu// for events v5 Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 49/76] perf list: List kernel supplied event aliases Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 50/76] perf report/top: Add option to collapse undesired parts of call graph Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 51/76] perf tools: Add struct perf_hpp_fmt into hpp callbacks Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 52/76] perf tools: Centralize default columns init in perf_hpp__init Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 53/76] perf diff: Introducing diff_data object to hold files Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 54/76] perf diff: Switching the base hists to be pairs head Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 55/76] perf hists: Marking dummy hists entries Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 56/76] perf diff: Display data file info ahead of the diff output Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 57/76] perf diff: Move diff related columns into diff command Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 58/76] perf diff: Move columns into struct data__file Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 59/76] perf diff: Change diff command to work over multiple data files Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 60/76] perf diff: Update perf diff documentation for multiple data comparison Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 61/76] perf diff: Making compute functions static Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 62/76] perf diff: Add generic order option for compute sorting Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 63/76] perf tools: Move hist_entry__period_snprintf into stdio code Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 64/76] perf timechart: Use traceevent lib event-parse.h include Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 65/76] perf timechart: Remove event types framework only user Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 66/76] perf tools: Remove event types from perf data file Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 67/76] perf record: Remove event types pushing Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 68/76] perf tools: Remove event types framework completely Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 69/76] perf tools: Fix 'make tools/perf' Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 70/76] perf symbols: Do not apply symfs for an absolute vmlinux path Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 71/76] perf tests: Check proper prev_state size for sched_switch tp Arnaldo Carvalho de Melo
2013-07-18 19:49 ` [PATCH 72/76] perf session: Use session->fd instead of passing fd as argument Arnaldo Carvalho de Melo
2013-07-18 19:50 ` [PATCH 73/76] perf header: Remove data_offset seek as it's not needed Arnaldo Carvalho de Melo
2013-07-18 19:50 ` [PATCH 74/76] perf header: Remove attr_offset from perf_header Arnaldo Carvalho de Melo
2013-07-18 19:50 ` [PATCH 75/76] perf header: Introduce feat_offset into perf_header Arnaldo Carvalho de Melo
2013-07-18 19:50 ` [PATCH 76/76] perf header: Recognize version number for perf data file Arnaldo Carvalho de Melo
2013-07-19  7:40 ` [GIT PULL 00/76] perf/core improvements and fixes Ingo Molnar

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=1374177003-3706-43-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.