[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150928201442.GD9392@kernel.org>
Date: Mon, 28 Sep 2015 17:14:42 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 22/25] perf tools: Add perf_evlist__del()
Em Mon, Sep 28, 2015 at 10:33:32AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Sep 25, 2015 at 04:15:53PM +0300, Adrian Hunter escreveu:
> > Add a counterpart to perf_evlist__add() that does the opposite
> > and deletes the evsel.
> >
> > This will be used by perf inject to remove unwanted evsels
>
> I think perf_evsel__remove() is better, as __del() looks like a shortcut
> for __delete(), which has different semantics than removing an entry
> from a list.
>
> I'll fix up the patches.
Ouch, but it also deletes the evsel, I think in this case it is better
to either have a perf_evlist__delete_evsel() or plain use
perf_evlist__remove() + perf_evsel__delete(). Doing the later, we can
rediscuss if you feel strongly about it.
- Arnaldo
> - Arnaldo
>
> > Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> > ---
> > tools/perf/util/evlist.c | 8 ++++++++
> > tools/perf/util/evlist.h | 1 +
> > 2 files changed, 9 insertions(+)
> >
> > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> > index e6760380d731..0bb15e6d12a0 100644
> > --- a/tools/perf/util/evlist.c
> > +++ b/tools/perf/util/evlist.c
> > @@ -165,6 +165,14 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry)
> > __perf_evlist__propagate_maps(evlist, entry);
> > }
> >
> > +void perf_evlist__del(struct perf_evlist *evlist, struct perf_evsel *evsel)
> > +{
> > + evsel->evlist = NULL;
> > + list_del_init(&evsel->node);
> > + evlist->nr_entries -= 1;
> > + perf_evsel__delete(evsel);
> > +}
> > +
> > void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
> > struct list_head *list)
> > {
> > diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
> > index 0edf0d4f4efa..7fab57d85fa1 100644
> > --- a/tools/perf/util/evlist.h
> > +++ b/tools/perf/util/evlist.h
> > @@ -73,6 +73,7 @@ void perf_evlist__exit(struct perf_evlist *evlist);
> > void perf_evlist__delete(struct perf_evlist *evlist);
> >
> > void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
> > +void perf_evlist__del(struct perf_evlist *evlist, struct perf_evsel *evsel);
> > int perf_evlist__add_default(struct perf_evlist *evlist);
> > int __perf_evlist__add_default_attrs(struct perf_evlist *evlist,
> > struct perf_event_attr *attrs, size_t nr_attrs);
> > --
> > 1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists