Em Tue, Apr 24, 2018 at 03:18:34PM -0400, Liang, Kan escreveu:
> On 4/24/2018 2:53 PM, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Apr 24, 2018 at 11:20:14AM -0700, [email protected]
> > escreveu:
> > > + if (strstr(counter->name, counter->pmu_name))
> > > + return;
> > > if (asprintf(&new_name,
> > > "%s [%s]", counter->name,
> > > counter->pmu_name) > 0) {
> > > free(counter->name);
> > Humm, do you have any problem with the patch below instead?
> No. The patch as below looks good to me.
Thanks for checking,
- Arnaldo
> > +++ b/tools/perf/builtin-stat.c
> > @@ -1261,7 +1261,8 @@ static void uniquify_event_name(struct perf_evsel
> > *counter)
> > - if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
> > + if (counter->uniquified_name ||
> > + !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
> > strlen(counter->pmu_name)))
> > @@ -1279,6 +1280,8 @@ static void uniquify_event_name(struct perf_evsel
> > *counter)
> > }
> > +
> > + counter->uniquified_name = true;
> > +++ b/tools/perf/util/evsel.h
> > @@ -115,6 +115,7 @@ struct perf_evsel {
> > unsigned int sample_size;
> > int id_pos;
> > int is_pos;
> > + bool uniquified_name;