lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 7 Mar 2016 21:38:39 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Stephane Eranian <eranian@...gle.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH v2 4/8] perf tools: Support multiple sort keys in a
 hierarchy level

Hi Arnaldo,

On Fri, Mar 04, 2016 at 06:48:48PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 04, 2016 at 11:59:38PM +0900, Namhyung Kim escreveu:
> > This implements having multiple sort keys in a single hierarchy level.
> 
> > +++ b/tools/perf/util/sort.c
> > @@ -2310,18 +2310,40 @@ static int setup_sort_list(char *str, struct perf_evlist *evlist)
> >  	char *tmp, *tok;
> >  	int ret = 0;
> >  	int level = 0;
> > +	int next_level = 1;
> > +	bool in_group = false;
> > +
> > +	do {
> > +		tok = str;
> > +		tmp = strpbrk(str, "{}, ");
> 
> Ok, I'll test this, but since we use lex/yacc for parsing event
> descriptions, perhaps we should use it here as well? Or do you think
> we're stopping at this level of complexity (I doubt) :-)

I'm not sure how the syntax of sort keys will become more complex.
But I don't think we should use lex/yacc at this level of complexity

Thanks,
Namhyung


> 
> > +		if (tmp) {
> > +			if (in_group)
> > +				next_level = level;
> > +			else
> > +				next_level = level + 1;
> > +
> > +			if (*tmp == '{')
> > +				in_group = true;
> > +			else if (*tmp == '}')
> > +				in_group = false;
> > +
> > +			*tmp = '\0';
> > +			str = tmp + 1;
> > +		}
> >  
> > -	for (tok = strtok_r(str, ", ", &tmp);
> > -			tok; tok = strtok_r(NULL, ", ", &tmp)) {
> > -		ret = sort_dimension__add(tok, evlist, level++);
> > -		if (ret == -EINVAL) {
> > -			error("Invalid --sort key: `%s'", tok);
> > -			break;
> > -		} else if (ret == -ESRCH) {
> > -			error("Unknown --sort key: `%s'", tok);
> > -			break;
> > +		if (*tok) {
> > +			ret = sort_dimension__add(tok, evlist, level);
> > +			if (ret == -EINVAL) {
> > +				error("Invalid --sort key: `%s'", tok);
> > +				break;
> > +			} else if (ret == -ESRCH) {
> > +				error("Unknown --sort key: `%s'", tok);
> > +				break;
> > +			}
> >  		}
> > -	}
> > +
> > +		level = next_level;
> > +	} while (tmp);
> >  
> >  	return ret;
> >  }
> > -- 
> > 2.7.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ