diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
| -rw-r--r-- | tools/perf/builtin-report.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index db10c0e8ecae..08259184cedb 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -156,14 +156,14 @@ static int process_read_event(event_t *event, struct perf_session *session __use | |||
| 156 | return 0; | 156 | return 0; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | static int sample_type_check(struct perf_session *session) | 159 | static int perf_session__setup_sample_type(struct perf_session *self) |
| 160 | { | 160 | { |
| 161 | if (!(session->sample_type & PERF_SAMPLE_CALLCHAIN)) { | 161 | if (!(self->sample_type & PERF_SAMPLE_CALLCHAIN)) { |
| 162 | if (sort__has_parent) { | 162 | if (sort__has_parent) { |
| 163 | fprintf(stderr, "selected --sort parent, but no" | 163 | fprintf(stderr, "selected --sort parent, but no" |
| 164 | " callchain data. Did you call" | 164 | " callchain data. Did you call" |
| 165 | " perf record without -g?\n"); | 165 | " perf record without -g?\n"); |
| 166 | return -1; | 166 | return -EINVAL; |
| 167 | } | 167 | } |
| 168 | if (symbol_conf.use_callchain) { | 168 | if (symbol_conf.use_callchain) { |
| 169 | fprintf(stderr, "selected -g but no callchain data." | 169 | fprintf(stderr, "selected -g but no callchain data." |
| @@ -176,7 +176,7 @@ static int sample_type_check(struct perf_session *session) | |||
| 176 | if (register_callchain_param(&callchain_param) < 0) { | 176 | if (register_callchain_param(&callchain_param) < 0) { |
| 177 | fprintf(stderr, "Can't register callchain" | 177 | fprintf(stderr, "Can't register callchain" |
| 178 | " params\n"); | 178 | " params\n"); |
| 179 | return -1; | 179 | return -EINVAL; |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
| 182 | 182 | ||
| @@ -191,13 +191,11 @@ static struct perf_event_ops event_ops = { | |||
| 191 | .process_fork_event = event__process_task, | 191 | .process_fork_event = event__process_task, |
| 192 | .process_lost_event = event__process_lost, | 192 | .process_lost_event = event__process_lost, |
| 193 | .process_read_event = process_read_event, | 193 | .process_read_event = process_read_event, |
| 194 | .sample_type_check = sample_type_check, | ||
| 195 | }; | 194 | }; |
| 196 | 195 | ||
| 197 | |||
| 198 | static int __cmd_report(void) | 196 | static int __cmd_report(void) |
| 199 | { | 197 | { |
| 200 | int ret; | 198 | int ret = -EINVAL; |
| 201 | struct perf_session *session; | 199 | struct perf_session *session; |
| 202 | 200 | ||
| 203 | session = perf_session__new(input_name, O_RDONLY, force); | 201 | session = perf_session__new(input_name, O_RDONLY, force); |
| @@ -207,6 +205,10 @@ static int __cmd_report(void) | |||
| 207 | if (show_threads) | 205 | if (show_threads) |
| 208 | perf_read_values_init(&show_threads_values); | 206 | perf_read_values_init(&show_threads_values); |
| 209 | 207 | ||
| 208 | ret = perf_session__setup_sample_type(session); | ||
| 209 | if (ret) | ||
| 210 | goto out_delete; | ||
| 211 | |||
| 210 | ret = perf_session__process_events(session, &event_ops); | 212 | ret = perf_session__process_events(session, &event_ops); |
| 211 | if (ret) | 213 | if (ret) |
| 212 | goto out_delete; | 214 | goto out_delete; |
