diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 13:13:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 13:13:22 -0500 |
commit | 2205afa7d13ec716935dfd4b8ff71059ee7aeb0c (patch) | |
tree | 19e63ed8040e8a82c3cdd331458d246247466a28 /tools/perf/builtin-trace.c | |
parent | 491424c0f46c282a854b88830212bdb0763e93dc (diff) | |
parent | 2cd9046cc53dd2625e2cf5854d6cbb1ba61de914 (diff) |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf sched: Fix build failure on sparc
perf bench: Add "all" pseudo subsystem and "all" pseudo suite
perf tools: Introduce perf_session class
perf symbols: Ditch dso->find_symbol
perf symbols: Allow lookups by symbol name too
perf symbols: Add missing "Variables" entry to map_type__name
perf symbols: Add support for 'variable' symtabs
perf symbols: Introduce ELF counterparts to symbol_type__is_a
perf symbols: Introduce symbol_type__is_a
perf symbols: Rename kthreads to kmaps, using another abstraction for it
perf tools: Allow building for ARM
hw-breakpoints: Handle bad modify_user_hw_breakpoint off-case return value
perf tools: Allow cross compiling
tracing, slab: Fix no callsite ifndef CONFIG_KMEMTRACE
tracing, slab: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
Trivial conflict due to different fixes to modify_user_hw_breakpoint()
in include/linux/hw_breakpoint.h
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index c2fcc34486f5..0756664666f1 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "util/header.h" | 7 | #include "util/header.h" |
8 | #include "util/exec_cmd.h" | 8 | #include "util/exec_cmd.h" |
9 | #include "util/trace-event.h" | 9 | #include "util/trace-event.h" |
10 | #include "util/session.h" | ||
10 | 11 | ||
11 | static char const *script_name; | 12 | static char const *script_name; |
12 | static char const *generate_script_lang; | 13 | static char const *generate_script_lang; |
@@ -61,7 +62,7 @@ static int cleanup_scripting(void) | |||
61 | 62 | ||
62 | static char const *input_name = "perf.data"; | 63 | static char const *input_name = "perf.data"; |
63 | 64 | ||
64 | static struct perf_header *header; | 65 | static struct perf_session *session; |
65 | static u64 sample_type; | 66 | static u64 sample_type; |
66 | 67 | ||
67 | static int process_sample_event(event_t *event) | 68 | static int process_sample_event(event_t *event) |
@@ -126,11 +127,18 @@ static struct perf_file_handler file_handler = { | |||
126 | 127 | ||
127 | static int __cmd_trace(void) | 128 | static int __cmd_trace(void) |
128 | { | 129 | { |
130 | int err; | ||
131 | |||
132 | session = perf_session__new(input_name, O_RDONLY, 0); | ||
133 | if (session == NULL) | ||
134 | return -ENOMEM; | ||
135 | |||
129 | register_idle_thread(); | 136 | register_idle_thread(); |
130 | register_perf_file_handler(&file_handler); | 137 | register_perf_file_handler(&file_handler); |
131 | 138 | ||
132 | return mmap_dispatch_perf_file(&header, input_name, | 139 | err = perf_session__process_events(session, 0, &event__cwdlen, &event__cwd); |
133 | 0, 0, &event__cwdlen, &event__cwd); | 140 | perf_session__delete(session); |
141 | return err; | ||
134 | } | 142 | } |
135 | 143 | ||
136 | struct script_spec { | 144 | struct script_spec { |
@@ -348,11 +356,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
348 | return -1; | 356 | return -1; |
349 | } | 357 | } |
350 | 358 | ||
351 | header = perf_header__new(); | 359 | perf_header__read(&session->header, input); |
352 | if (header == NULL) | ||
353 | return -1; | ||
354 | |||
355 | perf_header__read(header, input); | ||
356 | err = scripting_ops->generate_script("perf-trace"); | 360 | err = scripting_ops->generate_script("perf-trace"); |
357 | goto out; | 361 | goto out; |
358 | } | 362 | } |