Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1351580
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 4/8] perf tools: Support multiple sort keys in a hierarchy level |
| Date | 2016-03-07 13:50 +0100 |
| Message-ID | <ra2LM-2Ud-1@gated-at.bofh.it> (permalink) |
| References | <r8ZwB-8vJ-11@gated-at.bofh.it> <r8ZwE-8vJ-71@gated-at.bofh.it> <r95LI-4GI-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCHSET 0/8] perf tools: Support multiple keys in a single hierarchy level (v2) Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
[PATCH v2 1/8] perf tools: Add level field to struct perf_hpp_fmt Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
[tip:perf/core] perf hists: Add level field to struct perf_hpp_fmt tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-08 11:40 +0100
[PATCH v2 7/8] perf hists browser: Use hierarchy hpp list Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
[PATCH v2 5/8] perf tools: Fix indent for multiple hierarchy sort key Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
[PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-04 23:00 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-04 23:00 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Namhyung Kim <namhyung@kernel.org> - 2016-03-07 13:50 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Namhyung Kim <namhyung@kernel.org> - 2016-03-07 15:00 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Jiri Olsa <jolsa@redhat.com> - 2016-03-06 19:50 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Namhyung Kim <namhyung@kernel.org> - 2016-03-07 14:10 +0100
Re: [PATCH v2 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Jiri Olsa <jolsa@redhat.com> - 2016-03-07 14:20 +0100
[PATCH v2 8/8] perf report: Use hierarchy hpp list on gtk Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
[PATCH v2 4/8] perf tools: Support multiple sort keys in a hierarchy level Namhyung Kim <namhyung@kernel.org> - 2016-03-04 16:10 +0100
Re: [PATCH v2 4/8] perf tools: Support multiple sort keys in a hierarchy level Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-04 22:50 +0100
Re: [PATCH v2 4/8] perf tools: Support multiple sort keys in a hierarchy level Namhyung Kim <namhyung@kernel.org> - 2016-03-07 13:50 +0100
csiph-web