diff options
Diffstat (limited to 'tools/perf/builtin-kmem.c')
-rw-r--r-- | tools/perf/builtin-kmem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index a85936f09f3e..73b065022e27 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -345,7 +345,6 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
345 | static struct perf_event_ops event_ops = { | 345 | static struct perf_event_ops event_ops = { |
346 | .process_sample_event = process_sample_event, | 346 | .process_sample_event = process_sample_event, |
347 | .process_comm_event = event__process_comm, | 347 | .process_comm_event = event__process_comm, |
348 | .sample_type_check = perf_session__has_traces, | ||
349 | }; | 348 | }; |
350 | 349 | ||
351 | static double fragmentation(unsigned long n_req, unsigned long n_alloc) | 350 | static double fragmentation(unsigned long n_req, unsigned long n_alloc) |
@@ -492,11 +491,14 @@ static void sort_result(void) | |||
492 | 491 | ||
493 | static int __cmd_kmem(void) | 492 | static int __cmd_kmem(void) |
494 | { | 493 | { |
495 | int err; | 494 | int err = -EINVAL; |
496 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); | 495 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); |
497 | if (session == NULL) | 496 | if (session == NULL) |
498 | return -ENOMEM; | 497 | return -ENOMEM; |
499 | 498 | ||
499 | if (!perf_session__has_traces(session, "kmem record")) | ||
500 | goto out_delete; | ||
501 | |||
500 | setup_pager(); | 502 | setup_pager(); |
501 | err = perf_session__process_events(session, &event_ops); | 503 | err = perf_session__process_events(session, &event_ops); |
502 | if (err != 0) | 504 | if (err != 0) |