Messages in this thread | | | Date | Thu, 9 Feb 2012 14:34:41 -0200 | From | Arnaldo Carvalho de Melo <> | 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@amd.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 >
| |