All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [PATCH 6/9] perf symbols: Introduce method to iterate symbols ordered by name
Date: Wed, 21 Jan 2015 12:01:07 -0300	[thread overview]
Message-ID: <1421852470-20153-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1421852470-20153-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Given a symbol, go to the next entry in a rbtree sorted by symbol name.

Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/n/tip-aq210drxprnu2so4dye5xa3j@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 11 +++++++++++
 tools/perf/util/symbol.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 3cb928e51a99..a194702a0a2f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -450,6 +450,17 @@ struct symbol *dso__next_symbol(struct symbol *sym)
 	return symbols__next(sym);
 }
 
+struct symbol *symbol__next_by_name(struct symbol *sym)
+{
+	struct symbol_name_rb_node *s = container_of(sym, struct symbol_name_rb_node, sym);
+	struct rb_node *n = rb_next(&s->rb_node);
+
+	return n ? &rb_entry(n, struct symbol_name_rb_node, rb_node)->sym : NULL;
+}
+
+ /*
+  * Teturns first symbol that matched with @name.
+  */
 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
 					const char *name)
 {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 9d602e9c6f59..1650dcb3a67b 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -231,6 +231,7 @@ struct symbol *dso__find_symbol(struct dso *dso, enum map_type type,
 				u64 addr);
 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
 					const char *name);
+struct symbol *symbol__next_by_name(struct symbol *sym);
 
 struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
 struct symbol *dso__next_symbol(struct symbol *sym);
-- 
1.9.3


  parent reply	other threads:[~2015-01-21 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 15:01 [GIT PULL 0/9] perf/urgent fixes Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 1/9] perf evlist: Remove extraneous 'was' on error message Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 2/9] perf scripting perl: Force to use stdbool Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 3/9] perf annotate: Handle ins parsing failures Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 4/9] perf annotate: Fix memory leaks in LOCK handling Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 5/9] perf symbols: Return the first entry with a given name in find_by_name method Arnaldo Carvalho de Melo
2015-01-21 15:01 ` Arnaldo Carvalho de Melo [this message]
2015-01-21 15:01 ` [PATCH 7/9] perf probe: Do not rely on map__load() filter to find symbols Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 8/9] perf symbols: Introduce 'for' method to iterate over the symbols with a given name Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 9/9] perf probe: Fix probing kretprobes Arnaldo Carvalho de Melo
2015-01-28 14:42 ` [GIT PULL 0/9] perf/urgent fixes Ingo Molnar

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=1421852470-20153-7-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.