From: David Ahern <dsahern@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@elte.hu, acme@redhat.com
Subject: Re: [PATCH v2 1/5] perf inject: fix broken perf inject -b
Date: Tue, 15 May 2012 19:58:59 -0600 [thread overview]
Message-ID: <4FB309E3.10901@gmail.com> (raw)
In-Reply-To: <1337081295-10303-2-git-send-email-eranian@google.com>
On 5/15/12 5:28 AM, Stephane Eranian wrote:
> perf inject -b was broken. It would not inject any build_id
> into the stream. Furthermore, it would strip samples from the
> stream.
>
> The reason was a missing initialization of the event attribute
> structure. The perf_tool.tool.attr() callback was pointing to
> a simple repipe. But there was no initialization of the internal
> data structures to keep track of events and event ids. That later
> caused event id lookups to fail, and sample would get removed.
>
> The patch simply adds back the call to perf_event__process_attr()
> to initialize the evlist structure and now build_ids are again
> injected.
>
> Signed-off-by: Stephane Eranian<eranian@google.com>
> ---
> tools/perf/builtin-inject.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> index 09c1061..3beab48 100644
> --- a/tools/perf/builtin-inject.c
> +++ b/tools/perf/builtin-inject.c
> @@ -60,6 +60,11 @@ static int perf_event__repipe_tracing_data_synth(union perf_event *event,
> static int perf_event__repipe_attr(union perf_event *event,
> struct perf_evlist **pevlist __used)
The _used can be dropped now that pevlist is used.
> {
> + int ret;
> + ret = perf_event__process_attr(event, pevlist);
> + if (ret)
> + return ret;
> +
> return perf_event__repipe_synth(NULL, event, NULL);
> }
>
The change seems right, but I could not recreate the dropped events. In
both cases running:
perf record -o - -m 256 /tmp/a.sh | perf inject -b | perf report -i - -D
where /tmp/a.sh is:
#!/bin/sh
cd /opt/sw/ahern/kernels/kernel.git
make O=/tmp/kbuild -j 32 >/dev/null 2>&1
just to give it some "real work."
With your patch:
TOTAL events: 284211
MMAP events: 69236
COMM events: 10863
EXIT events: 22858
THROTTLE events: 11
UNTHROTTLE events: 11
FORK events: 11428
SAMPLE events: 169779
ATTR events: 1
EVENT_TYPE events: 1
BUILD_ID events: 23
cycles stats:
TOTAL events: 284186
MMAP events: 69236
COMM events: 10863
EXIT events: 22858
THROTTLE events: 11
UNTHROTTLE events: 11
FORK events: 11428
SAMPLE events: 169779
Current acme/core:
TOTAL events: 288990
MMAP events: 69236
COMM events: 10863
EXIT events: 22858
THROTTLE events: 20
UNTHROTTLE events: 20
FORK events: 11428
SAMPLE events: 174538
ATTR events: 1
EVENT_TYPE events: 1
BUILD_ID events: 25
cycles stats:
TOTAL events: 288963
MMAP events: 69236
COMM events: 10863
EXIT events: 22858
THROTTLE events: 20
UNTHROTTLE events: 20
FORK events: 11428
SAMPLE events: 174538
David
[1] Both tests have Namhyung's patch:
https://lkml.org/lkml/2012/5/15/280
next prev parent reply other threads:[~2012-05-16 1:59 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 [this message]
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:perf/core] perf buildid-list: Work " tip-bot for Stephane Eranian
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=4FB309E3.10901@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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.