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


Groups > linux.kernel > #1234845

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

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

Show all headers | View raw


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

perf evlist: Add perf_evlist__id2evsel_strict()

perf_evlist__id2evsel_strict() is the same as perf_evlist__id2evsel()
except that it ensures that the id must match.

This will be used by perf inject to find a specific evsel that is to be
deleted, hence the need to match exactly.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1443186956-18718-22-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 15 +++++++++++++++
 tools/perf/util/evlist.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a864373..e676038 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -617,6 +617,21 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
 	return NULL;
 }
 
+struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
+						u64 id)
+{
+	struct perf_sample_id *sid;
+
+	if (!id)
+		return NULL;
+
+	sid = perf_evlist__id2sid(evlist, id);
+	if (sid)
+		return sid->evsel;
+
+	return NULL;
+}
+
 static int perf_evlist__event2id(struct perf_evlist *evlist,
 				 union perf_event *event, u64 *id)
 {
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 115d8b5..0edf0d4 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -104,6 +104,8 @@ int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mas
 int perf_evlist__poll(struct perf_evlist *evlist, int timeout);
 
 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
+struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
+						u64 id);
 
 struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
 
--
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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/25] perf tools: minor improvements to Intel PT related stuff Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
  [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    Re: [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 16:20 +0200
    Re: [PATCH 01/25] perf auxtrace: Fix 'instructions' period of zero Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 16:20 +0200
    [tip:perf/core] perf auxtrace: Fix 'instructions' period of zero tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 11:00 +0200
  [PATCH 12/25] perf inject: Set branch stack feature flag when synthesizing branch stacks Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf inject:   Set branch stack feature flag when synthesizing branch stacks tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 04/25] perf intel-pt: Make logging slightly more efficient Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf intel-pt:   Make logging slightly more efficient tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 07/25] perf tools: Add more documentation to export-to-postgresql.py script Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf tools:   Add more documentation to export-to-postgresql.py script tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 21/25] perf tools: Add perf_evlist__id2evsel_strict() Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf evlist: Add perf_evlist__id2evsel_strict() tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  [PATCH 14/25] perf intel-pt: Support generating branch stack Adrian Hunter <adrian.hunter@intel.com> - 2015-09-25 15:30 +0200
    [tip:perf/core] perf intel-pt: Support generating branch stack tip-bot for Adrian Hunter <tipbot@zytor.com> - 2015-09-29 10:50 +0200
  Re: [PATCH 00/25] perf tools: minor improvements to Intel PT related  stuff Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 22:40 +0200
    Re: [PATCH 00/25] perf tools: minor improvements to Intel PT related  stuff Adrian Hunter <adrian.hunter@intel.com> - 2015-09-29 13:20 +0200

csiph-web