Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234853

[tip:perf/core] perf evlist: Add perf_evlist__remove()

From tip-bot for Adrian Hunter <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:perf/core] perf evlist: Add perf_evlist__remove()
Date 2015-09-29 10:50 +0200
Message-ID <qdYLO-1nH-53@gated-at.bofh.it> (permalink)
References <qcB4S-2t3-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  4768230ad57d4e4fc6d36c44e98e0062c89b0dc0
Gitweb:     http://git.kernel.org/tip/4768230ad57d4e4fc6d36c44e98e0062c89b0dc0
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 25 Sep 2015 16:15:53 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Sep 2015 17:15:31 -0300

perf evlist: Add perf_evlist__remove()

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.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1443186956-18718-23-git-send-email-adrian.hunter@intel.com
[ Renamed it from perf_evlist__del() to perf_evlist__remove() and removed the perf_evsel__delete() call ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 7 +++++++
 tools/perf/util/evlist.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e676038..8954622 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -165,6 +165,13 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry)
 	__perf_evlist__propagate_maps(evlist, entry);
 }
 
+void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel)
+{
+	evsel->evlist = NULL;
+	list_del_init(&evsel->node);
+	evlist->nr_entries -= 1;
+}
+
 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 0edf0d4..66bc9d4 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__remove(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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 22/25] perf tools: Add perf_evlist__del() Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:20 +0200
  Re: [PATCH 22/25] perf tools: Add perf_evlist__del() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 15:40 +0200
    Re: [PATCH 22/25] perf tools: Add perf_evlist__del() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 22:20 +0200
  [tip:perf/core] perf evlist: Add perf_evlist__remove() tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200

csiph-web