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


Groups > linux.kernel > #1232715 > unrolled thread

[PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support

Started byHe Kuang <hekuang@huawei.com>
First post2015-09-25 13:20 +0200
Last post2015-09-27 22:40 +0200
Articles 3 — 2 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 v2 3/4] perf tools: Adds the tracepoint name parsing support He Kuang <hekuang@huawei.com> - 2015-09-25 13:20 +0200
    Re: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing  support Jiri Olsa <jolsa@redhat.com> - 2015-09-27 22:40 +0200
    Re: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing  support Jiri Olsa <jolsa@redhat.com> - 2015-09-27 22:40 +0200

#1232715 — [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support

FromHe Kuang <hekuang@huawei.com>
Date2015-09-25 13:20 +0200
Subject[PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support
Message-ID<qczcJ-88V-3@gated-at.bofh.it>
Adds rules for parsing tracepoint names. Change rules of tracepoint
which derives of PE_NAMEs into tracepoint names directly, so adding
more rules based on tracepoint names will be easier.

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/util/parse-events.y | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 8bcc458..279c01c 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -67,6 +67,7 @@ static inc_group_count(struct list_head *list,
 %type <head> event_legacy_cache
 %type <head> event_legacy_mem
 %type <head> event_legacy_tracepoint
+%type <tracepoint_name> __event_legacy_tracepoint
 %type <head> event_legacy_numeric
 %type <head> event_legacy_raw
 %type <head> event_def
@@ -84,6 +85,10 @@ static inc_group_count(struct list_head *list,
 	u64 num;
 	struct list_head *head;
 	struct parse_events_term *term;
+	struct tracepoint_name{
+		char *sys;
+		char *event;
+	} tracepoint_name;
 }
 %%
 
@@ -368,36 +373,39 @@ PE_PREFIX_MEM PE_VALUE sep_dc
 }
 
 event_legacy_tracepoint:
-PE_NAME '-' PE_NAME ':' PE_NAME
+__event_legacy_tracepoint
 {
 	struct parse_events_evlist *data = _data;
 	struct parse_events_error *error = data->error;
 	struct list_head *list;
-	char sys_name[128];
-	snprintf(&sys_name, 128, "%s-%s", $1, $3);
 
 	ALLOC_LIST(list);
-	if (parse_events_add_tracepoint(list, &data->idx, &sys_name, $5, error)) {
+	if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
+					error)) {
 		if (error)
 			error->idx = @1.first_column;
 		return -1;
 	}
 	$$ = list;
 }
+
+__event_legacy_tracepoint:
+PE_NAME '-' PE_NAME ':' PE_NAME
+{
+	char sys_name[128];
+	struct tracepoint_name tracepoint;
+
+	snprintf(&sys_name, 128, "%s-%s", $1, $3);
+	tracepoint.sys = &sys_name;
+	tracepoint.event = $5;
+
+	$$ = tracepoint;
+}
 |
 PE_NAME ':' PE_NAME
 {
-	struct parse_events_evlist *data = _data;
-	struct parse_events_error *error = data->error;
-	struct list_head *list;
-
-	ALLOC_LIST(list);
-	if (parse_events_add_tracepoint(list, &data->idx, $1, $3, error)) {
-		if (error)
-			error->idx = @1.first_column;
-		return -1;
-	}
-	$$ = list;
+	struct tracepoint_name tracepoint = {$1, $3};
+	$$ = tracepoint;
 }
 
 event_legacy_numeric:
-- 
1.8.5.2

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


#1233745 — Re: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-27 22:40 +0200
SubjectRe: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support
Message-ID<qdqTL-17t-1@gated-at.bofh.it>
In reply to#1232715
On Fri, Sep 25, 2015 at 11:11:50AM +0000, He Kuang wrote:
> Adds rules for parsing tracepoint names. Change rules of tracepoint
> which derives of PE_NAMEs into tracepoint names directly, so adding
> more rules based on tracepoint names will be easier.
> 
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
>  tools/perf/util/parse-events.y | 38 +++++++++++++++++++++++---------------
>  1 file changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index 8bcc458..279c01c 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -67,6 +67,7 @@ static inc_group_count(struct list_head *list,
>  %type <head> event_legacy_cache
>  %type <head> event_legacy_mem
>  %type <head> event_legacy_tracepoint
> +%type <tracepoint_name> __event_legacy_tracepoint
>  %type <head> event_legacy_numeric
>  %type <head> event_legacy_raw
>  %type <head> event_def
> @@ -84,6 +85,10 @@ static inc_group_count(struct list_head *list,
>  	u64 num;
>  	struct list_head *head;
>  	struct parse_events_term *term;
> +	struct tracepoint_name{
                              ^^^ missing space

you could use scripts/checkpatch.pl and follow some of the recomendations


jirka
--
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]


#1233746 — Re: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support

FromJiri Olsa <jolsa@redhat.com>
Date2015-09-27 22:40 +0200
SubjectRe: [PATCH v2 3/4] perf tools: Adds the tracepoint name parsing support
Message-ID<qdqTM-17t-5@gated-at.bofh.it>
In reply to#1232715
On Fri, Sep 25, 2015 at 11:11:50AM +0000, He Kuang wrote:
> Adds rules for parsing tracepoint names. Change rules of tracepoint
> which derives of PE_NAMEs into tracepoint names directly, so adding
> more rules based on tracepoint names will be easier.
> 
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
>  tools/perf/util/parse-events.y | 38 +++++++++++++++++++++++---------------
>  1 file changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index 8bcc458..279c01c 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -67,6 +67,7 @@ static inc_group_count(struct list_head *list,
>  %type <head> event_legacy_cache
>  %type <head> event_legacy_mem
>  %type <head> event_legacy_tracepoint
> +%type <tracepoint_name> __event_legacy_tracepoint
>  %type <head> event_legacy_numeric
>  %type <head> event_legacy_raw
>  %type <head> event_def
> @@ -84,6 +85,10 @@ static inc_group_count(struct list_head *list,
>  	u64 num;
>  	struct list_head *head;
>  	struct parse_events_term *term;
> +	struct tracepoint_name{
> +		char *sys;
> +		char *event;
> +	} tracepoint_name;
>  }
>  %%
>  
> @@ -368,36 +373,39 @@ PE_PREFIX_MEM PE_VALUE sep_dc
>  }
>  
>  event_legacy_tracepoint:
> -PE_NAME '-' PE_NAME ':' PE_NAME
> +__event_legacy_tracepoint
>  {
>  	struct parse_events_evlist *data = _data;
>  	struct parse_events_error *error = data->error;
>  	struct list_head *list;
> -	char sys_name[128];
> -	snprintf(&sys_name, 128, "%s-%s", $1, $3);
>  
>  	ALLOC_LIST(list);
> -	if (parse_events_add_tracepoint(list, &data->idx, &sys_name, $5, error)) {
> +	if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
> +					error)) {
>  		if (error)
>  			error->idx = @1.first_column;
>  		return -1;
>  	}
>  	$$ = list;
>  }
> +
> +__event_legacy_tracepoint:

how about the tracepoint_name label change?

thanks,
jirka
--
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