All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Stephane Eranian <eranian@google.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	eranian@google.com, hpa@zytor.com, mingo@kernel.org,
	peterz@infradead.org, dsahern@gmail.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:perf/core] perf buildid-list: Work better with pipe mode
Date: Wed, 23 May 2012 08:30:41 -0700	[thread overview]
Message-ID: <tip-299c345208ae15fbc1e1c96dc1b6ac61e4e5da10@git.kernel.org> (raw)
In-Reply-To: <1337081295-10303-6-git-send-email-eranian@google.com>

Commit-ID:  299c345208ae15fbc1e1c96dc1b6ac61e4e5da10
Gitweb:     http://git.kernel.org/tip/299c345208ae15fbc1e1c96dc1b6ac61e4e5da10
Author:     Stephane Eranian <eranian@google.com>
AuthorDate: Tue, 15 May 2012 13:28:15 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 22 May 2012 13:03:54 -0300

perf buildid-list: Work better with pipe mode

In order for perf buildid-list to work with pipe-mode files, it needs to
process buildids and event attr structs.

$ perf record -o - noploop 2 | ./perf inject -b | perf buildid-list -i - -H
noploop for 2 seconds
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.084 MB - (~3678 samples) ]
0000000000000000000000000000000000000000 [kernel.kallsyms]
3a0d0629efe74a8da3eeba372cdbd74ad9b8f5d5 /usr/local/bin/noploop

The reason [kernel.kallsyms] shows a 0 build-id comes from the
way buildids are injected in the stream.

The buildid for the kernel is provided by a BUILD_ID record. The
[kernel.kallsyms] is provided by a MMAP record. There is no clean and
obvious way to link the two, unfortunately.

In regular mode, the kernel buildid is generated from reading the ELF
image or kallsyms and perf knows to associate [kernel.kallsyms] to it.
Later on, when perf processes the [kernel.kallsyms] MMAP record, it will
already have a dso for it.

So for now, make sure perf buildid-list shows the buildids for
everything but the kernel image.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1337081295-10303-6-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-buildid-list.c |    6 +++++-
 tools/perf/util/build-id.c        |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 5248046..6b2bcfb 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -84,7 +84,11 @@ static int perf_session__list_build_ids(void)
 	if (filename__fprintf_build_id(session->filename, stdout))
 		goto out;
 
-	if (with_hits)
+	/*
+	 * in pipe-mode, the only way to get the buildids is to parse
+	 * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
+	 */
+	if (with_hits || session->fd_pipe)
 		perf_session__process_events(session, &build_id__mark_dso_hit_ops);
 
 	perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index dff9c7a..fd9a594 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -65,6 +65,8 @@ struct perf_tool build_id__mark_dso_hit_ops = {
 	.mmap	= perf_event__process_mmap,
 	.fork	= perf_event__process_task,
 	.exit	= perf_event__exit_del_thread,
+	.attr		 = perf_event__process_attr,
+	.build_id	 = perf_event__process_build_id,
 };
 
 char *dso__build_id_filename(struct dso *self, char *bf, size_t size)

  parent reply	other threads:[~2012-05-23 15:31 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 11:28 [PATCH v2 0/5] perf tools: add meta-data header support in pipe mode Stephane Eranian
2012-05-15 11:28 ` [PATCH v2 1/5] perf inject: fix broken perf inject -b Stephane Eranian
2012-05-16  1:58   ` David Ahern
2012-05-23 15:29   ` [tip:perf/core] perf inject: Fix " tip-bot for Stephane Eranian
2012-05-15 11:28 ` [PATCH v2 2/5] perf tools: fix piped mode read code Stephane Eranian
2012-05-16  2:24   ` David Ahern
2012-05-23 15:29   ` [tip:perf/core] perf tools: Fix " tip-bot for Stephane Eranian
2012-05-15 11:28 ` [PATCH v2 3/5] perf tools: rename HEADER_TRACE_INFO to HEADER_TRACING_DATA Stephane Eranian
2012-05-16  2:34   ` David Ahern
2012-05-23 15:28   ` [tip:perf/core] " tip-bot for Stephane Eranian
2012-05-15 11:28 ` [PATCH v2 4/5] perf record: add meta-data support for pipe-mode Stephane Eranian
2012-05-16  3:34   ` David Ahern
2012-05-16  7:41     ` Stephane Eranian
2012-05-18 16:50       ` David Ahern
2012-05-18 17:19         ` Arnaldo Carvalho de Melo
2012-05-22 17:33           ` Peter Zijlstra
2012-05-22 17:51             ` Stephane Eranian
2012-05-23  0:45               ` Namhyung Kim
2012-05-23  1:01                 ` Arnaldo Carvalho de Melo
2012-05-23  8:10                   ` Peter Zijlstra
2012-05-23  8:21               ` Peter Zijlstra
2012-05-23 13:06                 ` Stephane Eranian
2012-05-24 15:36               ` David Ahern
2012-05-24 16:19                 ` Arnaldo Carvalho de Melo
2012-05-24 16:22                   ` David Ahern
2012-05-24 16:44                     ` Arnaldo Carvalho de Melo
2012-05-15 11:28 ` [PATCH v2 5/5] perf: make perf buildid-list work better with pipe mode Stephane Eranian
2012-05-16  3:55   ` David Ahern
2012-05-23 15:30   ` tip-bot for Stephane Eranian [this message]
2012-05-16  1:34 ` [PATCH v2 0/5] perf tools: add meta-data header support in " Namhyung Kim
2012-05-16  2:05   ` David Ahern
2012-05-16  2:32     ` Namhyung Kim
2012-05-16  2:38       ` David Ahern
2012-05-16  2:50         ` Namhyung Kim
2012-05-16 15:03         ` 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-299c345208ae15fbc1e1c96dc1b6ac61e4e5da10@git.kernel.org \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=dsahern@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@kernel.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 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.