diff options
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 7cca7c15b40a..65021fe1361e 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include "util/symbol.h" | 6 | #include "util/symbol.h" |
7 | #include "util/thread.h" | 7 | #include "util/thread.h" |
8 | #include "util/header.h" | 8 | #include "util/header.h" |
9 | #include "util/session.h" | ||
9 | 10 | ||
10 | #include "util/parse-options.h" | 11 | #include "util/parse-options.h" |
11 | #include "util/trace-event.h" | 12 | #include "util/trace-event.h" |
@@ -21,7 +22,6 @@ | |||
21 | 22 | ||
22 | static char const *input_name = "perf.data"; | 23 | static char const *input_name = "perf.data"; |
23 | 24 | ||
24 | static struct perf_header *header; | ||
25 | static u64 sample_type; | 25 | static u64 sample_type; |
26 | 26 | ||
27 | static char default_sort_order[] = "avg, max, switch, runtime"; | 27 | static char default_sort_order[] = "avg, max, switch, runtime"; |
@@ -1663,11 +1663,18 @@ static struct perf_file_handler file_handler = { | |||
1663 | 1663 | ||
1664 | static int read_events(void) | 1664 | static int read_events(void) |
1665 | { | 1665 | { |
1666 | int err; | ||
1667 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); | ||
1668 | |||
1669 | if (session == NULL) | ||
1670 | return -ENOMEM; | ||
1671 | |||
1666 | register_idle_thread(); | 1672 | register_idle_thread(); |
1667 | register_perf_file_handler(&file_handler); | 1673 | register_perf_file_handler(&file_handler); |
1668 | 1674 | ||
1669 | return mmap_dispatch_perf_file(&header, input_name, 0, 0, | 1675 | err = perf_session__process_events(session, 0, &event__cwdlen, &event__cwd); |
1670 | &event__cwdlen, &event__cwd); | 1676 | perf_session__delete(session); |
1677 | return err; | ||
1671 | } | 1678 | } |
1672 | 1679 | ||
1673 | static void print_bad_events(void) | 1680 | static void print_bad_events(void) |