public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Arnaldo Carvalho de Melo <acme@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, acme@redhat.com,
	hpa@zytor.com, mingo@redhat.com, peterz@infradead.org,
	efault@gmx.de, fweisbec@gmail.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:perf/core] perf tools: Introduce dsos__fprintf_buildid
Date: Mon, 16 Nov 2009 21:10:33 GMT	[thread overview]
Message-ID: <tip-9e03eb2d512e7f3a1e562d4b922aa8b1891750b6@git.kernel.org> (raw)
In-Reply-To: <1258396365-29217-4-git-send-email-acme@infradead.org>

Commit-ID:  9e03eb2d512e7f3a1e562d4b922aa8b1891750b6
Gitweb:     http://git.kernel.org/tip/9e03eb2d512e7f3a1e562d4b922aa8b1891750b6
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 16 Nov 2009 16:32:44 -0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 16 Nov 2009 22:05:51 +0100

perf tools: Introduce dsos__fprintf_buildid

To print the buildids in the list of dsos. Will be used by 'perf
buildid-list'

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1258396365-29217-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/symbol.c |   30 ++++++++++++++++++++++++++----
 tools/perf/util/symbol.h |    2 ++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 93e4b52..53de9c4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -212,14 +212,21 @@ int build_id__sprintf(u8 *self, int len, char *bf)
 	return raw - self;
 }
 
-size_t dso__fprintf(struct dso *self, FILE *fp)
+size_t dso__fprintf_buildid(struct dso *self, FILE *fp)
 {
 	char sbuild_id[BUILD_ID_SIZE * 2 + 1];
-	struct rb_node *nd;
-	size_t ret;
 
 	build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id);
-	ret = fprintf(fp, "dso: %s (%s)\n", self->short_name, sbuild_id);
+	return fprintf(fp, "%s", sbuild_id);
+}
+
+size_t dso__fprintf(struct dso *self, FILE *fp)
+{
+	struct rb_node *nd;
+	size_t ret = fprintf(fp, "dso: %s (", self->short_name);
+
+	ret += dso__fprintf_buildid(self, fp);
+	ret += fprintf(fp, ")\n");
 
 	for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
 		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
@@ -1428,6 +1435,21 @@ void dsos__fprintf(FILE *fp)
 		dso__fprintf(pos, fp);
 }
 
+size_t dsos__fprintf_buildid(FILE *fp)
+{
+	struct dso *pos;
+	size_t ret = 0;
+
+	list_for_each_entry(pos, &dsos, node) {
+		ret += dso__fprintf_buildid(pos, fp);
+		if (verbose)
+			ret += fprintf(fp, " %s\n", pos->long_name);
+		else
+			ret += fprintf(fp, "\n");
+	}
+	return ret;
+}
+
 int load_kernel(symbol_filter_t filter)
 {
 	if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0)
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0a34a54..51c5a4a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -80,7 +80,9 @@ int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules);
 struct dso *dsos__findnew(const char *name);
 int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
 void dsos__fprintf(FILE *fp);
+size_t dsos__fprintf_buildid(FILE *fp);
 
+size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
 size_t dso__fprintf(struct dso *self, FILE *fp);
 char dso__symtab_origin(const struct dso *self);
 void dso__set_build_id(struct dso *self, void *build_id);

  parent reply	other threads:[~2009-11-16 21:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16 18:32 [PATCH 1/5] perf symbols: pass the offset to perf_header__read_build_ids Arnaldo Carvalho de Melo
2009-11-16 18:32 ` [PATCH 2/5] perf tools: debug.h needs to include event.h for event_t Arnaldo Carvalho de Melo
2009-11-16 18:32   ` [PATCH 3/5] perf tools: Generalize perf_header__adds_read Arnaldo Carvalho de Melo
2009-11-16 18:32     ` [PATCH 4/5] perf tools: Introduce dsos__fprintf_buildid Arnaldo Carvalho de Melo
2009-11-16 18:32       ` [PATCH 5/5] perf buildid-list: New plumbing command Arnaldo Carvalho de Melo
2009-11-16 18:58         ` Frederic Weisbecker
2009-11-16 19:41           ` Arnaldo Carvalho de Melo
2009-11-16 20:58             ` Ingo Molnar
2009-11-16 21:04               ` Arnaldo Carvalho de Melo
2009-11-16 21:07                 ` Ingo Molnar
2009-11-16 21:05             ` Peter Zijlstra
2009-11-16 21:02         ` Ingo Molnar
2009-11-16 21:05           ` Arnaldo Carvalho de Melo
2009-11-16 21:06             ` Ingo Molnar
2009-11-16 21:10         ` [tip:perf/core] " tip-bot for Arnaldo Carvalho de Melo
2009-11-16 21:10       ` tip-bot for Arnaldo Carvalho de Melo [this message]
2009-11-16 19:02     ` [PATCH 3/5] perf tools: Generalize perf_header__adds_read Frederic Weisbecker
2009-11-16 21:10     ` [tip:perf/core] perf tools: Generalize perf_header__adds_read() tip-bot for Arnaldo Carvalho de Melo
2009-11-16 21:10   ` [tip:perf/core] perf tools: Debug.h needs to include event.h for event_t tip-bot for Arnaldo Carvalho de Melo
2009-11-16 21:09 ` [tip:perf/core] perf symbols: Pass the offset to perf_header__read_build_ids() tip-bot for Arnaldo Carvalho de Melo

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=tip-9e03eb2d512e7f3a1e562d4b922aa8b1891750b6@git.kernel.org \
    --to=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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