lkml.org 
[lkml]   [2012]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] perf-tool: Don't process samples with no valid machine object
Date
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) {
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



\
 
 \ /
  Last update: 2012-02-09 17:11    [W:0.057 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site