linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 06/16] perf symbols: Add dso__last_symbol()
Date: Fri, 23 Sep 2016 17:38:38 +0300	[thread overview]
Message-ID: <1474641528-18776-7-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1474641528-18776-1-git-send-email-adrian.hunter@intel.com>

Add a function to find the last symbol in a DSO. This will be used when
parsing address filters to calculate a region that includes the entire DSO.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/symbol.c | 15 +++++++++++++++
 tools/perf/util/symbol.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 19c9c558454f..aecff69a510d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -345,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols)
 	return NULL;
 }
 
+static struct symbol *symbols__last(struct rb_root *symbols)
+{
+	struct rb_node *n = rb_last(symbols);
+
+	if (n)
+		return rb_entry(n, struct symbol, rb_node);
+
+	return NULL;
+}
+
 static struct symbol *symbols__next(struct symbol *sym)
 {
 	struct rb_node *n = rb_next(&sym->rb_node);
@@ -466,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type)
 	return symbols__first(&dso->symbols[type]);
 }
 
+struct symbol *dso__last_symbol(struct dso *dso, enum map_type type)
+{
+	return symbols__last(&dso->symbols[type]);
+}
+
 struct symbol *dso__next_symbol(struct symbol *sym)
 {
 	return symbols__next(sym);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0dacfb7d5b67..d964844eb314 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -259,6 +259,7 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
 struct symbol *symbol__next_by_name(struct symbol *sym);
 
 struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
+struct symbol *dso__last_symbol(struct dso *dso, enum map_type type);
 struct symbol *dso__next_symbol(struct symbol *sym);
 
 enum dso_type dso__type_fd(int fd);
-- 
1.9.1

  parent reply	other threads:[~2016-09-23 14:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 14:38 [PATCH 00/16] perf tools: Add support for using symbols in address filters Adrian Hunter
2016-09-23 14:38 ` [PATCH 01/16] perf record: Fix documentation 'event_sources' -> 'event_source' Adrian Hunter
2016-09-29 18:10   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 02/16] perf tools: Fix MMAP event synthesis broken by MAP_HUGETLB change Adrian Hunter
2016-09-29 18:10   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 03/16] perf script: Fix vanished idle symbols Adrian Hunter
2016-09-29 18:13   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 04/16] perf record: Rename label 'out_symbol_exit' Adrian Hunter
2016-09-29 18:14   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 05/16] perf record: Fix error paths Adrian Hunter
2016-09-29 18:14   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` Adrian Hunter [this message]
2016-09-29 18:14   ` [tip:perf/core] perf symbols: Add dso__last_symbol() tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 07/16] perf record: Add support for using symbols in address filters Adrian Hunter
2016-09-29 18:15   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 08/16] perf tools: Increase debug level of SDT debug messages Adrian Hunter
2016-09-24  0:15   ` Masami Hiramatsu
2016-09-26  7:27     ` Adrian Hunter
2016-09-27 17:42       ` Masami Hiramatsu
2016-09-29 18:15   ` [tip:perf/core] perf probe: " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 09/16] perf intel-pt: Fix snapshot overlap detection decoder errors Adrian Hunter
2016-09-29 18:16   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 10/16] perf intel-pt: Add support for recording the max non-turbo ratio Adrian Hunter
2016-09-29 18:16   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 11/16] perf intel-pt: Fix missing error codes processing auxtrace_info Adrian Hunter
2016-09-29 18:17   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 12/16] perf intel-pt: Add a helper function for processing AUXTRACE_INFO Adrian Hunter
2016-09-29 18:17   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 13/16] perf intel-pt: Record address filter in AUXTRACE_INFO event Adrian Hunter
2016-09-29 18:17   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 14/16] perf intel-pt: Read address filter from " Adrian Hunter
2016-09-29 18:18   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 15/16] perf intel-pt: Enable decoder to handle TIP.PGD with missing IP Adrian Hunter
2016-09-29 18:18   ` [tip:perf/core] " tip-bot for Adrian Hunter
2016-09-23 14:38 ` [PATCH 16/16] perf intel-pt: Fix decoding when there are address filters Adrian Hunter
2016-09-29 18:19   ` [tip:perf/core] " tip-bot for Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474641528-18776-7-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).