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


Groups > linux.kernel > #1278238 > unrolled thread

[PATCH 2/3] perf script: Pass perf_script into process_event

Started byJiri Olsa <jolsa@kernel.org>
First post2015-11-26 15:00 +0100
Last post2015-11-27 08:50 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] perf script: Pass perf_script into process_event Jiri Olsa <jolsa@kernel.org> - 2015-11-26 15:00 +0100
    Re: [PATCH 2/3] perf script: Pass perf_script into process_event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-26 17:30 +0100
      [PATCHv2 2/3] perf script: Pass perf_script into process_event Jiri Olsa <jolsa@redhat.com> - 2015-11-26 19:00 +0100
        [tip:perf/core] perf script: Pass perf_script into process_event tip-bot for Jiri Olsa <tipbot@zytor.com> - 2015-11-27 08:50 +0100

#1278238 — [PATCH 2/3] perf script: Pass perf_script into process_event

FromJiri Olsa <jolsa@kernel.org>
Date2015-11-26 15:00 +0100
Subject[PATCH 2/3] perf script: Pass perf_script into process_event
Message-ID<qz5fB-5UD-23@gated-at.bofh.it>
Passing perf_script struct into process_event function.

Link: http://lkml.kernel.org/n/tip-jad0bjspvazzf5v4bsnz74ax@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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.4.3

--
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/

[toc] | [next] | [standalone]


#1278323

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-11-26 17:30 +0100
Message-ID<qz7AK-7Bz-11@gated-at.bofh.it>
In reply to#1278238
Em Thu, Nov 26, 2015 at 02:55:24PM +0100, Jiri Olsa escreveu:
> Passing perf_script struct into process_event function.

For? Please write the motivation for a patch.

- Arnaldo
 
> Link: http://lkml.kernel.org/n/tip-jad0bjspvazzf5v4bsnz74ax@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  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.4.3
--
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/

[toc] | [prev] | [next] | [standalone]


#1278372 — [PATCHv2 2/3] perf script: Pass perf_script into process_event

FromJiri Olsa <jolsa@redhat.com>
Date2015-11-26 19:00 +0100
Subject[PATCHv2 2/3] perf script: Pass perf_script into process_event
Message-ID<qz8ZP-8oW-1@gated-at.bofh.it>
In reply to#1278323
On Thu, Nov 26, 2015 at 01:22:26PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Nov 26, 2015 at 02:55:24PM +0100, Jiri Olsa escreveu:
> > Passing perf_script struct into process_event function.
> 
> For? Please write the motivation for a patch.

for patch 3 ;-) attached with new changelog

perf/fixes branch is updated

thanks,
jirka


---
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.

Link: http://lkml.kernel.org/n/tip-jad0bjspvazzf5v4bsnz74ax@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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.4.3

--
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/

[toc] | [prev] | [next] | [standalone]


#1278593 — [tip:perf/core] perf script: Pass perf_script into process_event

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2015-11-27 08:50 +0100
Subject[tip:perf/core] perf script: Pass perf_script into process_event
Message-ID<qzlX4-8k4-29@gated-at.bofh.it>
In reply to#1278372
Commit-ID:  809e9423d7bc72e50d94d8267bab010a007a6137
Gitweb:     http://git.kernel.org/tip/809e9423d7bc72e50d94d8267bab010a007a6137
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Thu, 26 Nov 2015 18:55:21 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Nov 2015 16:06:16 -0300

perf script: Pass perf_script into process_event

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 8e3f804..3c3f8d0 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)
 {
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web