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


Groups > linux.kernel > #1553922 > unrolled thread

Re: [PATCH 02/11] perf, tools: Parse eventcode as number in jevents

Started byJiri Olsa <jolsa@redhat.com>
First post2017-01-08 20:00 +0100
Last post2017-01-10 02:20 +0100
Articles 2 — 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

  Re: [PATCH 02/11] perf, tools: Parse eventcode as number in jevents Jiri Olsa <jolsa@redhat.com> - 2017-01-08 20:00 +0100
    Re: [PATCH 02/11] perf, tools: Parse eventcode as number in jevents Andi Kleen <andi@firstfloor.org> - 2017-01-10 02:20 +0100

#1553922 — Re: [PATCH 02/11] perf, tools: Parse eventcode as number in jevents

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-08 20:00 +0100
SubjectRe: [PATCH 02/11] perf, tools: Parse eventcode as number in jevents
Message-ID<sXqRb-1KB-15@gated-at.bofh.it>
On Tue, Jan 03, 2017 at 07:08:24AM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> The next patch needs to modify event code. Previously eventcode was just
> passed through as a string. Now parse it as a number.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  tools/perf/pmu-events/jevents.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index 41611d7f9873..ee5eeeaed378 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -135,7 +135,6 @@ static struct field {
>  	const char *field;
>  	const char *kernel;
>  } fields[] = {
> -	{ "EventCode",	"event=" },
>  	{ "UMask",	"umask=" },
>  	{ "CounterMask", "cmask=" },
>  	{ "Invert",	"inv=" },
> @@ -164,6 +163,10 @@ static int match_field(char *map, jsmntok_t *field, int nz,
>  
>  	for (f = fields; f->field; f++)
>  		if (json_streq(map, field, f->field) && nz) {
> +			/* Handle all variations of 0 encounted in JSON */
> +			if (json_streq(map, val, "0x00") ||
> +			     json_streq(map, val, "0x0"))
> +				return 1;

how is this related to the patch? also shouldn't it return 0 ?

jirka

[toc] | [next] | [standalone]


#1554845

FromAndi Kleen <andi@firstfloor.org>
Date2017-01-10 02:20 +0100
Message-ID<sXTgt-33k-5@gated-at.bofh.it>
In reply to#1553922
> >  	for (f = fields; f->field; f++)
> >  		if (json_streq(map, field, f->field) && nz) {
> > +			/* Handle all variations of 0 encounted in JSON */
> > +			if (json_streq(map, val, "0x00") ||
> > +			     json_streq(map, val, "0x0"))
> > +				return 1;
> 
> how is this related to the patch? also shouldn't it return 0 ?

I removed it now. It avoids some extra umask=0x0 entries, but these
don't hurt.

-Andi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web