[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120209163441.GD2526@infradead.org>
Date: Thu, 9 Feb 2012 14:34:41 -0200
From: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To: Joerg Roedel <joerg.roedel@....com>
Cc: Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
Jason Wang <jasowang@...hat.com>
Subject: Re: [PATCH 1/2] perf-tool: Don't process samples with no valid
machine object
Em Thu, Feb 09, 2012 at 05:07:38PM +0100, Joerg Roedel escreveu:
> The perf sample processing code relies on a valid machine
> object. Make sure that this path is only entered when such a
> object exists.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@....com>
> ---
> tools/perf/builtin-top.c | 2 +-
> tools/perf/util/session.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index dd162aa..7c81d1d 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -805,7 +805,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
> }
>
>
> - if (event->header.type == PERF_RECORD_SAMPLE) {
> + if (event->header.type == PERF_RECORD_SAMPLE && machine != NULL) {
Shouldn't we warn the user, even if just once, on the status (last line
on the screen) line?
> perf_event__process_sample(&top->tool, event, evsel,
> &sample, machine);
> } else if (event->header.type < PERF_RECORD_MAX) {
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index b5ca2558..c9593c7 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -792,7 +792,7 @@ static int perf_session_deliver_event(struct perf_session *session,
> switch (event->header.type) {
> case PERF_RECORD_SAMPLE:
> dump_sample(session, event, sample);
> - if (evsel == NULL) {
> + if (evsel == NULL || machine == NULL) {
> ++session->hists.stats.nr_unknown_id;
> return -1;
> }
> --
> 1.7.5.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists