diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-14 11:23:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-14 11:34:56 -0500 |
commit | c019879bcc5692ec9267c1cedad91f1794d0b693 (patch) | |
tree | ec499400b1ee0b1d93e961cc67b9dead9cd8c9a9 /tools/perf/builtin-trace.c | |
parent | a328626b61aeda1a7d00a80c475c76ca1b815e0d (diff) |
perf session: Adopt the sample_type variable
All tools had copies, and perf diff would have to specify a
sample_type_check method just for copying it.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260807780-19377-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index adce442dd603..9ee976dc395b 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -61,8 +61,6 @@ static int cleanup_scripting(void) | |||
61 | 61 | ||
62 | static char const *input_name = "perf.data"; | 62 | static char const *input_name = "perf.data"; |
63 | 63 | ||
64 | static u64 sample_type; | ||
65 | |||
66 | static int process_sample_event(event_t *event, struct perf_session *session) | 64 | static int process_sample_event(event_t *event, struct perf_session *session) |
67 | { | 65 | { |
68 | struct sample_data data; | 66 | struct sample_data data; |
@@ -73,7 +71,7 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
73 | data.cpu = -1; | 71 | data.cpu = -1; |
74 | data.period = 1; | 72 | data.period = 1; |
75 | 73 | ||
76 | event__parse_sample(event, sample_type, &data); | 74 | event__parse_sample(event, session->sample_type, &data); |
77 | 75 | ||
78 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", | 76 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", |
79 | event->header.misc, | 77 | event->header.misc, |
@@ -88,7 +86,7 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
88 | return -1; | 86 | return -1; |
89 | } | 87 | } |
90 | 88 | ||
91 | if (sample_type & PERF_SAMPLE_RAW) { | 89 | if (session->sample_type & PERF_SAMPLE_RAW) { |
92 | /* | 90 | /* |
93 | * FIXME: better resolve from pid from the struct trace_entry | 91 | * FIXME: better resolve from pid from the struct trace_entry |
94 | * field, although it should be the same than this perf | 92 | * field, although it should be the same than this perf |
@@ -103,11 +101,9 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
103 | return 0; | 101 | return 0; |
104 | } | 102 | } |
105 | 103 | ||
106 | static int sample_type_check(u64 type, struct perf_session *session __used) | 104 | static int sample_type_check(struct perf_session *session) |
107 | { | 105 | { |
108 | sample_type = type; | 106 | if (!(session->sample_type & PERF_SAMPLE_RAW)) { |
109 | |||
110 | if (!(sample_type & PERF_SAMPLE_RAW)) { | ||
111 | fprintf(stderr, | 107 | fprintf(stderr, |
112 | "No trace sample to read. Did you call perf record " | 108 | "No trace sample to read. Did you call perf record " |
113 | "without -R?"); | 109 | "without -R?"); |