* [PATCH] perf report: delay sample_type checks in pipe mode
@ 2012-06-11 19:48 David Ahern
2012-06-11 19:49 ` David Ahern
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: David Ahern @ 2012-06-11 19:48 UTC (permalink / raw)
To: acme, linux-kernel
Cc: mingo, peterz, fweisbec, paulus, tglx, tim.c.chen, David Ahern
The pipeline:
perf record -a -g -o - sleep 5 |perf inject -v -b | perf report -g -i -
generates the warning:
Selected -g but no callchain data. Did you call 'perf record' without -g?
The problem is that the header data is not written to the pipe, so the
sample_type has not been available when perf_report__setup_sample_type is
called. For pipe mode, record dumps the sample type as part of the
synthesized events stream -- perf_event__synthesize_attrs(). Handle this
be detecting pipe mode and not doing early sanity checks on sample_type.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
tools/perf/builtin-report.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ebcb3e2..9b3e9e9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -246,11 +246,12 @@ static int process_read_event(struct perf_tool *tool,
return 0;
}
+/* For pipe mode, sample_type is not currently set */
static int perf_report__setup_sample_type(struct perf_report *rep)
{
struct perf_session *self = rep->session;
- if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
+ if (!self->fd_pipe && !(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) {
ui__error("Selected --sort parent, but no "
"callchain data. Did you call "
@@ -273,7 +274,8 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
}
if (sort__branch_mode == 1) {
- if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
+ if (!self->fd_pipe &&
+ !(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
ui__error("Selected -b but no branch data. "
"Did you call perf record without -b?\n");
return -1;
--
1.7.10.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf report: delay sample_type checks in pipe mode
2012-06-11 19:48 [PATCH] perf report: delay sample_type checks in pipe mode David Ahern
@ 2012-06-11 19:49 ` David Ahern
2012-06-12 0:05 ` Tim Chen
2012-06-22 19:38 ` David Ahern
2012-06-29 16:20 ` [tip:perf/core] perf report: Delay " tip-bot for David Ahern
2 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2012-06-11 19:49 UTC (permalink / raw)
To: David Ahern, tim.c.chen
Cc: acme, linux-kernel, mingo, peterz, fweisbec, paulus, tglx
On 6/11/12 1:48 PM, David Ahern wrote:
> The pipeline:
> perf record -a -g -o - sleep 5 |perf inject -v -b | perf report -g -i -
>
> generates the warning:
> Selected -g but no callchain data. Did you call 'perf record' without -g?
>
> The problem is that the header data is not written to the pipe, so the
> sample_type has not been available when perf_report__setup_sample_type is
> called. For pipe mode, record dumps the sample type as part of the
> synthesized events stream -- perf_event__synthesize_attrs(). Handle this
> be detecting pipe mode and not doing early sanity checks on sample_type.
Slightly different fix. Tim: can you re-test?
David
>
> Signed-off-by: David Ahern<dsahern@gmail.com>
> ---
> tools/perf/builtin-report.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ebcb3e2..9b3e9e9 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -246,11 +246,12 @@ static int process_read_event(struct perf_tool *tool,
> return 0;
> }
>
> +/* For pipe mode, sample_type is not currently set */
> static int perf_report__setup_sample_type(struct perf_report *rep)
> {
> struct perf_session *self = rep->session;
>
> - if (!(self->sample_type& PERF_SAMPLE_CALLCHAIN)) {
> + if (!self->fd_pipe&& !(self->sample_type& PERF_SAMPLE_CALLCHAIN)) {
> if (sort__has_parent) {
> ui__error("Selected --sort parent, but no "
> "callchain data. Did you call "
> @@ -273,7 +274,8 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
> }
>
> if (sort__branch_mode == 1) {
> - if (!(self->sample_type& PERF_SAMPLE_BRANCH_STACK)) {
> + if (!self->fd_pipe&&
> + !(self->sample_type& PERF_SAMPLE_BRANCH_STACK)) {
> ui__error("Selected -b but no branch data. "
> "Did you call perf record without -b?\n");
> return -1;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf report: delay sample_type checks in pipe mode
2012-06-11 19:49 ` David Ahern
@ 2012-06-12 0:05 ` Tim Chen
0 siblings, 0 replies; 5+ messages in thread
From: Tim Chen @ 2012-06-12 0:05 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel, mingo, peterz, fweisbec, paulus, tglx
On Mon, 2012-06-11 at 13:49 -0600, David Ahern wrote:
> On 6/11/12 1:48 PM, David Ahern wrote:
> > The pipeline:
> > perf record -a -g -o - sleep 5 |perf inject -v -b | perf report -g -i -
> >
> > generates the warning:
> > Selected -g but no callchain data. Did you call 'perf record' without -g?
> >
> > The problem is that the header data is not written to the pipe, so the
> > sample_type has not been available when perf_report__setup_sample_type is
> > called. For pipe mode, record dumps the sample type as part of the
> > synthesized events stream -- perf_event__synthesize_attrs(). Handle this
> > be detecting pipe mode and not doing early sanity checks on sample_type.
>
> Slightly different fix. Tim: can you re-test?
>
> David
>
Works for me.
Tim
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf report: delay sample_type checks in pipe mode
2012-06-11 19:48 [PATCH] perf report: delay sample_type checks in pipe mode David Ahern
2012-06-11 19:49 ` David Ahern
@ 2012-06-22 19:38 ` David Ahern
2012-06-29 16:20 ` [tip:perf/core] perf report: Delay " tip-bot for David Ahern
2 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2012-06-22 19:38 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, mingo, peterz, fweisbec, paulus, tglx, tim.c.chen
Hi Arnaldo
On 6/11/12 1:48 PM, David Ahern wrote:
> The pipeline:
> perf record -a -g -o - sleep 5 |perf inject -v -b | perf report -g -i -
>
> generates the warning:
> Selected -g but no callchain data. Did you call 'perf record' without -g?
>
> The problem is that the header data is not written to the pipe, so the
> sample_type has not been available when perf_report__setup_sample_type is
> called. For pipe mode, record dumps the sample type as part of the
> synthesized events stream -- perf_event__synthesize_attrs(). Handle this
> be detecting pipe mode and not doing early sanity checks on sample_type.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Haven't seen this one come through your queues.
David
> ---
> tools/perf/builtin-report.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ebcb3e2..9b3e9e9 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -246,11 +246,12 @@ static int process_read_event(struct perf_tool *tool,
> return 0;
> }
>
> +/* For pipe mode, sample_type is not currently set */
> static int perf_report__setup_sample_type(struct perf_report *rep)
> {
> struct perf_session *self = rep->session;
>
> - if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
> + if (!self->fd_pipe && !(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
> if (sort__has_parent) {
> ui__error("Selected --sort parent, but no "
> "callchain data. Did you call "
> @@ -273,7 +274,8 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
> }
>
> if (sort__branch_mode == 1) {
> - if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
> + if (!self->fd_pipe &&
> + !(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
> ui__error("Selected -b but no branch data. "
> "Did you call perf record without -b?\n");
> return -1;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf report: Delay sample_type checks in pipe mode
2012-06-11 19:48 [PATCH] perf report: delay sample_type checks in pipe mode David Ahern
2012-06-11 19:49 ` David Ahern
2012-06-22 19:38 ` David Ahern
@ 2012-06-29 16:20 ` tip-bot for David Ahern
2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for David Ahern @ 2012-06-29 16:20 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, peterz, tim.c.chen,
fweisbec, dsahern, tglx
Commit-ID: 300aa941650e98966ad85847527537df5b11a87e
Gitweb: http://git.kernel.org/tip/300aa941650e98966ad85847527537df5b11a87e
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Mon, 11 Jun 2012 13:48:41 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 Jun 2012 13:19:14 -0300
perf report: Delay sample_type checks in pipe mode
The pipeline:
perf record -a -g -o - sleep 5 |perf inject -v -b | perf report -g -i -
generates the warning:
Selected -g but no callchain data. Did you call 'perf record' without -g?
The problem is that the header data is not written to the pipe, so the
sample_type has not been available when perf_report__setup_sample_type
is called. For pipe mode, record dumps the sample type as part of the
synthesized events stream -- perf_event__synthesize_attrs(). Handle this
be detecting pipe mode and not doing early sanity checks on sample_type.
Signed-off-by: David Ahern <dsahern@gmail.com>
Tested-by: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Link: http://lkml.kernel.org/r/1339444121-26236-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 40b0ffc..69b1c11 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -245,11 +245,12 @@ static int process_read_event(struct perf_tool *tool,
return 0;
}
+/* For pipe mode, sample_type is not currently set */
static int perf_report__setup_sample_type(struct perf_report *rep)
{
struct perf_session *self = rep->session;
- if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
+ if (!self->fd_pipe && !(self->sample_type & PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) {
ui__error("Selected --sort parent, but no "
"callchain data. Did you call "
@@ -272,7 +273,8 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
}
if (sort__branch_mode == 1) {
- if (!(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
+ if (!self->fd_pipe &&
+ !(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) {
ui__error("Selected -b but no branch data. "
"Did you call perf record without -b?\n");
return -1;
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-29 16:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11 19:48 [PATCH] perf report: delay sample_type checks in pipe mode David Ahern
2012-06-11 19:49 ` David Ahern
2012-06-12 0:05 ` Tim Chen
2012-06-22 19:38 ` David Ahern
2012-06-29 16:20 ` [tip:perf/core] perf report: Delay " tip-bot for David Ahern
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.