Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278436

[PATCH 07/13] perf script: Pass perf_script into process_event

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 07/13] perf script: Pass perf_script into process_event
Date 2015-11-26 21:50 +0100
Message-ID <qzbEm-1Ge-11@gated-at.bofh.it> (permalink)
References <qzbEl-1Ge-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jiri Olsa <jolsa@redhat.com>

Passing perf_script struct into process_event function, so we could
process configuration data for event printing.

It will be used in following patch to get event name string width.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20151126175521.GA18979@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 8e3f8048d2d0..3c3f8d0e3064 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -588,8 +588,17 @@ static void print_sample_flags(u32 flags)
 	printf("  %-4s ", str);
 }
 
-static void process_event(union perf_event *event, struct perf_sample *sample,
-			  struct perf_evsel *evsel, struct addr_location *al)
+struct perf_script {
+	struct perf_tool	tool;
+	struct perf_session	*session;
+	bool			show_task_events;
+	bool			show_mmap_events;
+	bool			show_switch_events;
+};
+
+static void process_event(struct perf_script *script __maybe_unused, union perf_event *event,
+			  struct perf_sample *sample, struct perf_evsel *evsel,
+			  struct addr_location *al)
 {
 	struct thread *thread = al->thread;
 	struct perf_event_attr *attr = &evsel->attr;
@@ -663,12 +672,13 @@ static int cleanup_scripting(void)
 	return scripting_ops ? scripting_ops->stop_script() : 0;
 }
 
-static int process_sample_event(struct perf_tool *tool __maybe_unused,
+static int process_sample_event(struct perf_tool *tool,
 				union perf_event *event,
 				struct perf_sample *sample,
 				struct perf_evsel *evsel,
 				struct machine *machine)
 {
+	struct perf_script *scr = container_of(tool, struct perf_script, tool);
 	struct addr_location al;
 
 	if (debug_mode) {
@@ -697,21 +707,13 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
 	if (scripting_ops)
 		scripting_ops->process_event(event, sample, evsel, &al);
 	else
-		process_event(event, sample, evsel, &al);
+		process_event(scr, event, sample, evsel, &al);
 
 out_put:
 	addr_location__put(&al);
 	return 0;
 }
 
-struct perf_script {
-	struct perf_tool	tool;
-	struct perf_session	*session;
-	bool			show_task_events;
-	bool			show_mmap_events;
-	bool			show_switch_events;
-};
-
 static int process_attr(struct perf_tool *tool, union perf_event *event,
 			struct perf_evlist **pevlist)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 07/13] perf script: Pass perf_script into process_event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 09/13] perf symbols: Refactor vmlinux_path__init() to ease path additions Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 03/13] perf script: Remove default_scripting_ops Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 04/13] perf build: Fix traceevent plugins build race Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 10/13] perf symbols: Add the path to vmlinux.debug Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 01/13] perf callchain: Honor hide_unresolved Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 06/13] perf tools: Correctly identify anon_hugepage when generating map (v2) Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 02/13] perf top: Fix freeze on --call-graph flat/folded Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 05/13] perf machine: Adjust dso->long_name for offline module Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 11/13] perf stat: Clear sample_(type|period) for counting Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  [PATCH 08/13] tools build: Use fixdep with OUTPUT path prefix Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 21:50 +0100
  Re: [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-11-27 08:40 +0100

csiph-web