Re: [PATCHv2 0/9] perf stat: Separate shadow counters code

From: Arnaldo Carvalho de Melo
Date: Wed Jun 03 2015 - 18:42:24 EST


Em Thu, Jun 04, 2015 at 12:38:24AM +0200, Jiri Olsa escreveu:
> On Wed, Jun 03, 2015 at 07:24:53PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Jun 03, 2015 at 07:07:05PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Wed, Jun 03, 2015 at 04:25:50PM +0200, Jiri Olsa escreveu:
> > > > hi,
> > > > sending cleanup/move of shadow counters. I need it
> > > > for my other changes of stat scripting, but I think
> > > > it can stand alone as a cleanup.
> > > >
> > > > v2 changes:
> > > > - move evsel id into 'struct perf_stat'
> > > > and change the id functions namespace
> > >
> > > Thanks, applied.
> >
> > 15: struct perf_event_attr setup :sh: line 1: 27101 Segmentation fault (core dumped) PERF_TEST_ATTR=/tmp/tmptb9pWi /home/acme/bin/perf stat -o /tmp/tmptb9pWi/perf.data kill > /dev/null 2>&1
> > sh: line 1: 27104 Segmentation fault (core dumped) PERF_TEST_ATTR=/tmp/tmpWgRK9D /home/acme/bin/perf stat -o /tmp/tmpWgRK9D/perf.data -d kill > /dev/null 2>&1
> > sh: line 1: 27107 Segmentation fault (core dumped) PERF_TEST_ATTR=/tmp/tmpmCOyBe /home/acme/bin/perf stat -o /tmp/tmpmCOyBe/perf.data -dd kill > /dev/null 2>&1
> > sh: line 1: 27110 Segmentation fault (core dumped) PERF_TEST_ATTR=/tmp/tmpJP9x2e /home/acme/bin/perf stat -o /tmp/tmpJP9x2e/perf.data -ddd kill > /dev/null 2>&1
> > Ok
> >
> > Can you please check?
>
> arghh.. sry, I remember running tests :-\ really ;-)
> it's the -d default events that do not set evsel->name

> attached patch fixes it, but I'll send v3 for the first patch
>
> thanks,
> jirka
>
>
> ---
> diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
> index d22791d02db0..dba762da5679 100644
> --- a/tools/perf/util/stat.c
> +++ b/tools/perf/util/stat.c
> @@ -88,7 +88,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel)
> /* ps->id is 0 hence PERF_STAT_EVSEL_ID__NONE by default */
>
> for (i = 0; i < PERF_STAT_EVSEL_ID__MAX; i++) {
> - if (!strcmp(evsel->name, id_str[i])) {
> + if (evsel->name && !strcmp(evsel->name, id_str[i])) {

Why not use perf_evsel__name() then?

> ps->id = i;
> break;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/